rtic/2/api/rtic_monotonics/index.html
github-merge-queue[bot] e04fb16c1b deploy: bbc37ca3fe
2025-11-12 19:06:49 +00:00

37 lines
No EOL
14 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="In-tree implementations of the `rtic_time::Monotonic` (reexported) trait for timers &#38; clocks found on commonly used microcontrollers."><title>rtic_monotonics - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-e56847b5.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="rtic_monotonics" data-themes="" data-resource-suffix="" data-rustdoc-version="1.91.1 (ed61e7d7e 2025-11-07)" data-channel="1.91.1" data-search-js="search-e256b49e.js" data-stringdex-js="stringdex-c3e638e9.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-6dc2a7f3.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Crate rtic_monotonics</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../rtic_monotonics/index.html">rtic_<wbr>monotonics</a><span class="version">2.1.0</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#cortex-m-systick" title="Cortex-M Systick">Cortex-M Systick</a></li><li><a href="#rp2040" title="RP2040">RP2040</a></li><li><a href="#rp2350" title="RP2350">RP2350</a></li><li><a href="#imx-rt" title="i.MX RT">i.MX RT</a></li><li><a href="#nrf" title="nRF">nRF</a></li><li><a href="#esp32c3-and-esp32c6" title="ESP32C3 and ESP32C6">ESP32C3 and ESP32C6</a></li><li><a href="#stm32" title="STM32">STM32</a></li><li><a href="#atsamd" title="ATSAMD">ATSAMD</a></li><li><a href="#priority-of-interrupt-handlers" title="Priority of interrupt handlers">Priority of interrupt handlers</a></li></ul><h3><a href="#reexports">Crate Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#macros" title="Macros">Macros</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>rtic_<wbr>monotonics</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/rtic_monotonics/lib.rs.html#1-137">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>In-tree implementations of the <a href="trait.Monotonic.html" title="trait rtic_monotonics::Monotonic"><code>rtic_time::Monotonic</code></a> (reexported) trait for
timers &amp; clocks found on commonly used microcontrollers.</p>
<p>If you are using a microcontroller where CAS operations are not available natively, you might
have to enable the <code>critical-section</code> or <code>unsafe-assume-single-core</code> feature of the
<a href="https://docs.rs/portable-atomic/latest/portable_atomic/"><code>portable-atomic</code></a> dependency
yourself for this dependency to compile.</p>
<p>To enable the implementations, you must enable a feature for the specific MCU youre targeting.</p>
<h2 id="cortex-m-systick"><a class="doc-anchor" href="#cortex-m-systick">§</a>Cortex-M Systick</h2>
<p>The <code>systick</code> monotonic works on all Arm Cortex-M parts, and requires that the feature <code>cortex-m-systick</code> is enabled.</p>
<h2 id="rp2040"><a class="doc-anchor" href="#rp2040">§</a>RP2040</h2>
<p>The RP2040 monotonics require that the <code>rp2040</code> feature is enabled.</p>
<h2 id="rp2350"><a class="doc-anchor" href="#rp2350">§</a>RP2350</h2>
<p>The RP2350 monotonics require that the <code>rp235x</code> feature is enabled.</p>
<h2 id="imx-rt"><a class="doc-anchor" href="#imx-rt">§</a>i.MX RT</h2>
<p>The i.MX RT monotonics require that the feature <code>imxrt_gpt1</code> or <code>imxrt_gpt2</code> is enabled.</p>
<h2 id="nrf"><a class="doc-anchor" href="#nrf">§</a>nRF</h2>
<p>nRF monotonics require that one of the available <code>nrf52*</code> features is enabled. Monotonic
implementations are available for both high-resolution TIMER and low-resolution RTC peripherals.</p>
<p>All implementations of timers for the nRF52 family are documented here. Monotonics that
are not available on all parts in this family will have an <code>Available on crate features X only</code>
tag, describing what parts <em>do</em> support that monotonic. Monotonics without an
<code>Available on crate features X only</code> tag are available on any <code>nrf52*</code> feature.</p>
<h2 id="esp32c3-and-esp32c6"><a class="doc-anchor" href="#esp32c3-and-esp32c6">§</a>ESP32C3 and ESP32C6</h2>
<p>Enable either the <code>esp32c3-systimer</code> or <code>esp32c6-systimer</code> feature, as appropriate.</p>
<h2 id="stm32"><a class="doc-anchor" href="#stm32">§</a>STM32</h2>
<p>Enable one of the <code>stm32*</code> features, as appropriate. Implementations are available for
a selection of STM32 timers.</p>
<h2 id="atsamd"><a class="doc-anchor" href="#atsamd">§</a>ATSAMD</h2>
<p>Monotonics for the ATSAMD family of parts using the real time clock (RTC) are provided in the
<a href="https://docs.rs/atsamd-hal/latest/atsamd_hal/rtc/rtic/index.html"><code>atsamd-hal</code></a>
crate with the <code>rtic</code> feature enabled.</p>
<h2 id="priority-of-interrupt-handlers"><a class="doc-anchor" href="#priority-of-interrupt-handlers">§</a>Priority of interrupt handlers</h2>
<p>The priority of timer interrupts are based on <code>RTIC_ASYNC_MAX_LOGICAL_PRIO</code> generated by RTIC.
It is calculated to be 1 less than the maximum hardware task priority (to not have impact on
hardware tasks), or, if no hardware task is available, is set to the maximum priority in the
system.</p>
</div></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><dl class="item-table reexports"><dt id="reexport.fugit"><code>pub use <a class="mod" href="../fugit/index.html" title="mod fugit">fugit</a>;</code></dt><dt id="reexport.rtic_time"><code>pub use <a class="mod" href="../rtic_time/index.html" title="mod rtic_time">rtic_time</a>;</code></dt></dl><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="imxrt/index.html" title="mod rtic_monotonics::imxrt">imxrt</a></dt><dd><a href="trait.Monotonic.html" title="trait rtic_monotonics::Monotonic"><code>Monotonic</code></a> implementations for i.MX RTs GPT peripherals.</dd><dt><a class="mod" href="nrf/index.html" title="mod rtic_monotonics::nrf">nrf</a></dt><dd><a href="trait.Monotonic.html" title="trait rtic_monotonics::Monotonic"><code>Monotonic</code></a> implementations for the nRF series of MCUs.</dd><dt><a class="mod" href="rp2040/index.html" title="mod rtic_monotonics::rp2040">rp2040</a></dt><dd><a href="trait.Monotonic.html" title="trait rtic_monotonics::Monotonic"><code>Monotonic</code></a> implementation for RP2040s Timer peripheral.</dd><dt><a class="mod" href="stm32/index.html" title="mod rtic_monotonics::stm32">stm32</a></dt><dd><a href="trait.Monotonic.html" title="trait rtic_monotonics::Monotonic"><code>Monotonic</code></a> implementations for STM32 chips.</dd><dt><a class="mod" href="systick/index.html" title="mod rtic_monotonics::systick">systick</a></dt><dd><a href="trait.Monotonic.html" title="trait rtic_monotonics::Monotonic"><code>Monotonic</code></a> based on Cortex-M SysTick.</dd></dl><h2 id="macros" class="section-header">Macros<a href="#macros" class="anchor">§</a></h2><dl class="item-table"><dt><a class="macro" href="macro.imxrt_gpt1_monotonic.html" title="macro rtic_monotonics::imxrt_gpt1_monotonic">imxrt_<wbr>gpt1_<wbr>monotonic</a></dt><dd>Create a GPT1 based monotonic and register the GPT1 interrupt for it.</dd><dt><a class="macro" href="macro.imxrt_gpt2_monotonic.html" title="macro rtic_monotonics::imxrt_gpt2_monotonic">imxrt_<wbr>gpt2_<wbr>monotonic</a></dt><dd>Create a GPT2 based monotonic and register the GPT2 interrupt for it.</dd><dt><a class="macro" href="macro.nrf_rtc0_monotonic.html" title="macro rtic_monotonics::nrf_rtc0_monotonic">nrf_<wbr>rtc0_<wbr>monotonic</a></dt><dd>Create an RTC0 based monotonic and register the RTC0 interrupt for it.</dd><dt><a class="macro" href="macro.nrf_rtc1_monotonic.html" title="macro rtic_monotonics::nrf_rtc1_monotonic">nrf_<wbr>rtc1_<wbr>monotonic</a></dt><dd>Create an RTC1 based monotonic and register the RTC1 interrupt for it.</dd><dt><a class="macro" href="macro.nrf_rtc2_monotonic.html" title="macro rtic_monotonics::nrf_rtc2_monotonic">nrf_<wbr>rtc2_<wbr>monotonic</a></dt><dd>Create an RTC2 based monotonic and register the RTC2 interrupt for it.</dd><dt><a class="macro" href="macro.nrf_timer0_monotonic.html" title="macro rtic_monotonics::nrf_timer0_monotonic">nrf_<wbr>timer0_<wbr>monotonic</a></dt><dd>Create an Timer0 based monotonic and register the TIMER0 interrupt for it.</dd><dt><a class="macro" href="macro.nrf_timer1_monotonic.html" title="macro rtic_monotonics::nrf_timer1_monotonic">nrf_<wbr>timer1_<wbr>monotonic</a></dt><dd>Create an Timer1 based monotonic and register the TIMER1 interrupt for it.</dd><dt><a class="macro" href="macro.nrf_timer2_monotonic.html" title="macro rtic_monotonics::nrf_timer2_monotonic">nrf_<wbr>timer2_<wbr>monotonic</a></dt><dd>Create an Timer2 based monotonic and register the TIMER2 interrupt for it.</dd><dt><a class="macro" href="macro.nrf_timer3_monotonic.html" title="macro rtic_monotonics::nrf_timer3_monotonic">nrf_<wbr>timer3_<wbr>monotonic</a></dt><dd>Create an Timer3 based monotonic and register the TIMER3 interrupt for it.</dd><dt><a class="macro" href="macro.nrf_timer4_monotonic.html" title="macro rtic_monotonics::nrf_timer4_monotonic">nrf_<wbr>timer4_<wbr>monotonic</a></dt><dd>Create an Timer4 based monotonic and register the TIMER4 interrupt for it.</dd><dt><a class="macro" href="macro.rp2040_timer_monotonic.html" title="macro rtic_monotonics::rp2040_timer_monotonic">rp2040_<wbr>timer_<wbr>monotonic</a></dt><dd>Create an RP2040 timer based monotonic and register the necessary interrupt for it.</dd><dt><a class="macro" href="macro.stm32_tim2_monotonic.html" title="macro rtic_monotonics::stm32_tim2_monotonic">stm32_<wbr>tim2_<wbr>monotonic</a></dt><dd>Create a TIM2 based monotonic and register the TIM2 interrupt for it.</dd><dt><a class="macro" href="macro.stm32_tim3_monotonic.html" title="macro rtic_monotonics::stm32_tim3_monotonic">stm32_<wbr>tim3_<wbr>monotonic</a></dt><dd>Create a TIM3 based monotonic and register the TIM3 interrupt for it.</dd><dt><a class="macro" href="macro.stm32_tim4_monotonic.html" title="macro rtic_monotonics::stm32_tim4_monotonic">stm32_<wbr>tim4_<wbr>monotonic</a></dt><dd>Create a TIM4 based monotonic and register the TIM4 interrupt for it.</dd><dt><a class="macro" href="macro.stm32_tim5_monotonic.html" title="macro rtic_monotonics::stm32_tim5_monotonic">stm32_<wbr>tim5_<wbr>monotonic</a></dt><dd>Create a TIM5 based monotonic and register the TIM5 interrupt for it.</dd><dt><a class="macro" href="macro.stm32_tim15_monotonic.html" title="macro rtic_monotonics::stm32_tim15_monotonic">stm32_<wbr>tim15_<wbr>monotonic</a></dt><dd>Create a TIM15 based monotonic and register the TIM15 interrupt for it.</dd><dt><a class="macro" href="macro.systick_monotonic.html" title="macro rtic_monotonics::systick_monotonic">systick_<wbr>monotonic</a></dt><dd>Create a Systick based monotonic and register the Systick interrupt for it.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.TimeoutError.html" title="struct rtic_monotonics::TimeoutError">Timeout<wbr>Error</a></dt><dd>This indicates that there was a timeout.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.Monotonic.html" title="trait rtic_monotonics::Monotonic">Monotonic</a></dt><dd>A monotonic clock / counter definition.</dd><dt><a class="trait" href="trait.TimerQueueBackend.html" title="trait rtic_monotonics::TimerQueueBackend">Timer<wbr>Queue<wbr>Backend</a></dt><dd>A backend definition for a monotonic clock/counter.</dd><dt><a class="trait" href="trait.TimerQueueBasedMonotonic.html" title="trait rtic_monotonics::TimerQueueBasedMonotonic">Timer<wbr>Queue<wbr>Based<wbr>Monotonic</a></dt><dd>A <a href="trait.Monotonic.html" title="trait rtic_monotonics::Monotonic"><code>Monotonic</code></a> that is backed by the <a href="../rtic_time/timer_queue/struct.TimerQueue.html" title="struct rtic_time::timer_queue::TimerQueue"><code>TimerQueue</code></a>.</dd></dl></section></div></main></body></html>