rtic/stable/api/rtic_monotonics/index.html

27 lines
14 KiB
HTML
Raw Normal View History

<!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-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-492a78a4a87dcc01.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.82.0 (f6e511eec 2024-10-15)" data-channel="1.82.0" data-search-js="search-a99f1315e7cc5121.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-921df33f47b8780c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-3b12f09e550e0385.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../rtic_monotonics/index.html">rtic_<wbr>monotonics</a><span class="version">2.0.3</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#reexports">Re-exports</a></li><li><a href="#modules">Modules</a></li><li><a href="#macros">Macros</a></li><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li></ul></section></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <a class="mod" href="#">rtic_monotonics</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../src/rtic_monotonics/lib.rs.html#1-119">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></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 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="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.</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="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><ul class="item-table"><li><div class="item-name" id="reexport.fugit"><code>pub use <a class="mod" href="../fugit/index.html" title="mod fugit">fugit</a>;</code></div></li><li><div class="item-name" id="reexport.rtic_time"><code>pub use <a class="mod" href="../rtic_time/index.html" title="mod rtic_time">rtic_time</a>;</code></div></li></ul><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="imxrt/index.html" title="mod rtic_monotonics::imxrt">imxrt</a></div><div class="desc docblock-short"><a href="trait.Monotonic.html" title="trait rtic_monotonics::Monotonic"><code>Monotonic</code></a> implementations for i.MX RTs GPT peripherals.</div></li><li><div class="item-name"><a class="mod" href="nrf/index.html" title="mod rtic_monotonics::nrf">nrf</a></div><div class="desc docblock-short"><a href="trait.Monotonic.html" title="trait rtic_monotonics::Monotonic"><code>Monotonic</code></a> implementations for the nRF series of MCUs.</div></li><li><div class="item-name"><a class="mod" href="rp2040/index.html" title="mod rtic_monotonics::rp2040">rp2040</a></div><div class="desc docblock-short"><a href="trait.Monotonic.html" title="trait rtic_monotonics::Monotonic"><code>Monotonic</code></a> implementation for RP2040s Timer peripheral.</div></li><li><div class="item-name"><a class="mod" href="stm32/index.html" title="mod rtic_monotonics::stm32">stm32</a></div><div class="desc docblock-short"><a href="trait.Monotonic.html" title="trait rtic_monotonics::Monotonic"><code>Monotonic</code></a> implementations for STM32 chips.</div></li><li><div class="item-name"><a class="mod" href="systick/index.html" title="mod rtic_monotonics::systick">systick</a></div><div class="desc docblock-short"><a href="trait.Monotonic.html" title="trait rtic_monotonics::Monotonic"><code>Monotonic</code></a> based on Cortex-M SysTick.
Note: this implementation is inefficient as it
ticks and generates interrupts at a constant rate.</div></li></ul><h2 id="macros" class="section-header">Macros<a href="#macros" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="macro" href="macro.imxrt_gpt1_monotonic.html" title="macro rtic_monotonics::imxrt_gpt1_monotonic">imxrt_<wbr>gpt1_<wbr>monotonic</a></div><div class="desc docblock-short">Create a GPT1 based monotonic and register the GPT1 interrupt for it.</div></li><li><div class="item-name"><a class="macro" href="macro.imxrt_gpt2_monotonic.html" title="macro rtic_monotonics::imxrt_gpt2_monotonic">imxrt_<wbr>gpt2_<wbr>monotonic</a></div><div class="desc docblock-short">Create a GPT2 based monotonic and register the GPT2 interrupt for it.</div></li><li><div class="item-name"><a class="macro" href="macro.nrf_rtc0_monotonic.html" title="macro rtic_monotonics::nrf_rtc0_monotonic">nrf_<wbr>rtc0_<wbr>monotonic</a></div><div class="desc docblock-short">Create an RTC0 based monotonic and register the RTC0 interrupt for it.</div></li><li><div class="item-name"><a class="macro" href="macro.nrf_rtc1_monotonic.html" title="macro rtic_monotonics::nrf_rtc1_monotonic">nrf_<wbr>rtc1_<wbr>monotonic</a></div><div class="desc docblock-short">Create an RTC1 based monotonic and register the RTC1 interrupt for it.</div></li><li><div class="item-name"><a class="macro" href="macro.nrf_rtc2_monotonic.html" title="macro rtic_monotonics::nrf_rtc2_monotonic">nrf_<wbr>rtc2_<wbr>monotonic</a></div><div class="desc docblock-short">Create an RTC2 based monotonic and register the RTC2 interrupt for it.</div></li><li><div class="item-name"><a class="macro" href="macro.nrf_timer0_monotonic.html" title="macro rtic_monotonics::nrf_timer0_monotonic">nrf_<wbr>timer0_<wbr>monotonic</a></div><div class="desc docblock-short">Create an Timer0 based monotonic and register the TIMER0 interrupt for it.</div></li><li><div class="item-name"><a class="macro" href="macro.nrf_timer1_monotonic.html" title="macro rtic_monotonics::nrf_timer1_monotonic">nrf_<wbr>timer1_<wbr>monotonic</a></div><div class="desc docblock-short">Create an Timer1 based monotonic and register the TIMER1 interrupt for it.</div></li><li><div class="item-name"><a class="macro" href="macro.nrf_timer2_monotonic.html" title="macro rtic_monotonics::nrf_timer2_monotonic">nrf_<wbr>timer2_<wbr>monotonic</a></div><div class="desc docblock-short">Create an Timer2 based monotonic and register the TIMER2 interrupt for it.</div></li><li><div class="item-name"><a class="macro" href="macro.nrf_timer3_monotonic.html" title="macro rtic_monotonics::nrf_timer3_monotonic">nrf_<wbr>timer3_<wbr>monotonic</a></div><div class="desc docblock-short">Create an Timer3 based monotonic and register the TIMER3 interrupt for it.</div></li><li><div class="item-name"><a class="macro" href="macro.nrf_timer4_monotonic.html" title="macro rtic_monotonics::nrf_timer4_monotonic">nrf_<wbr>timer4_<wbr>monotonic</a></div><div class="desc docblock-short">Create an Timer4 based monotonic and register the TIMER4 interrupt for it.</div></li><li><div class="item-name"><a class="macro" href="macro.rp2040_timer_monotonic.html" title="macro rtic_monotonics::rp2040_timer_monotonic">rp2040_<wbr>timer_<wbr>monotonic</a></div><div class="desc docblock-short">Create an RP2040 timer based monotonic and register the necessary interrupt for it.</div></li><li><div class="item-name"><a class="macro" href="macro.stm32_tim2_monotonic.html" title="macro rtic_monotonics::stm32_tim2_monotonic">stm32_<wbr>tim2_<wbr>monotonic</a></div><div class="desc docblock-short">Create a TIM2 based monotonic and register the TIM2 interrupt for it.</div></li><li><div class="item-name"><a class="macro" href="macro.stm32_tim3_monotonic.html" title="macro rtic_monotonics::stm32_tim3_monotonic">stm32_<wbr>tim3_<wbr>monotonic</a></div><div class="desc docblock-short">Create a TIM3 based monotonic and register the TIM3 interrupt for it.</div></li><li><div class="item-name"><a class="macro" href="macro.stm32_tim4_monotonic.html" title="macro rtic_monotonics::stm32_tim4_monotonic">stm32_<w