diff --git a/rtic-monotonics/CHANGELOG.md b/rtic-monotonics/CHANGELOG.md index d030bb0234..2649e2c033 100644 --- a/rtic-monotonics/CHANGELOG.md +++ b/rtic-monotonics/CHANGELOG.md @@ -7,6 +7,11 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top! ## Unreleased +### Fixed + +- Missing documentation for i.MX RT monotonics +- Incorrect documentation of systick monotonic timer precision + ## v1.3.0 - 2023-11-08 ### Added diff --git a/rtic-monotonics/Cargo.toml b/rtic-monotonics/Cargo.toml index 99679fcf2f..441e772f8b 100644 --- a/rtic-monotonics/Cargo.toml +++ b/rtic-monotonics/Cargo.toml @@ -16,7 +16,14 @@ description = "A library that provides implementations of the Monotonic trait fr license = "MIT OR Apache-2.0" [package.metadata.docs.rs] -features = ["cortex-m-systick", "rp2040", "nrf52840"] +features = [ + "cortex-m-systick", + "rp2040", + "nrf52840", + "imxrt_gpt1", + "imxrt_gpt2", + "imxrt-ral/imxrt1011", +] rustdoc-flags = ["--cfg", "docsrs"] [dependencies] @@ -51,7 +58,9 @@ imxrt-ral = { version = "0.5.3", optional = true } [build-dependencies] proc-macro2 = { version = "1.0.36", optional = true } quote = { version = "1.0.15", optional = true } -stm32-metapac = { version = "14.0.0", default-features = false, features = ["metadata"], optional = true } +stm32-metapac = { version = "14.0.0", default-features = false, features = [ + "metadata", +], optional = true } [features] default = [] diff --git a/rtic-monotonics/src/imxrt.rs b/rtic-monotonics/src/imxrt.rs index ee7e2ffed8..39448291a0 100644 --- a/rtic-monotonics/src/imxrt.rs +++ b/rtic-monotonics/src/imxrt.rs @@ -1,4 +1,4 @@ -//! [`Monotonic`] impl for the i.MX RT. +//! [`Monotonic`] implementations for i.MX RT's GPT peripherals. //! //! # Example //! @@ -55,7 +55,7 @@ macro_rules! __internal_create_imxrt_timer_interrupt { }}; } -/// Register GPT1 interrupt for the monotonic. +/// Register the GPT1 interrupt for the monotonic. #[cfg(feature = "imxrt_gpt1")] #[macro_export] macro_rules! create_imxrt_gpt1_token { @@ -64,7 +64,7 @@ macro_rules! create_imxrt_gpt1_token { }}; } -/// Register GPT2 interrupt for the monotonic. +/// Register the GPT2 interrupt for the monotonic. #[cfg(feature = "imxrt_gpt2")] #[macro_export] macro_rules! create_imxrt_gpt2_token { @@ -98,7 +98,7 @@ fn calc_now(period: u32, counter: u32) -> u64 { macro_rules! make_timer { ($mono_name:ident, $timer:ident, $period:ident, $tq:ident$(, doc: ($($doc:tt)*))?) => { - /// Monotonic timer queue implementation. + /// Timer implementing [`Monotonic`] which runs at 1 MHz. $( #[cfg_attr(docsrs, doc(cfg($($doc)*)))] )? @@ -113,9 +113,11 @@ macro_rules! make_timer { impl $mono_name { /// Starts the monotonic timer. + /// /// - `tick_freq_hz`: The tick frequency of the given timer. /// - `gpt`: The GPT timer register block instance. /// - `_interrupt_token`: Required for correct timer interrupt handling. + /// /// This method must be called only once. pub fn start(tick_freq_hz: u32, gpt: $timer, _interrupt_token: impl crate::InterruptToken) { // Find a prescaler that creates our desired tick frequency diff --git a/rtic-monotonics/src/lib.rs b/rtic-monotonics/src/lib.rs index 2d7c74f8b9..6dc703eb61 100644 --- a/rtic-monotonics/src/lib.rs +++ b/rtic-monotonics/src/lib.rs @@ -9,6 +9,9 @@ //! # RP2040 //! The RP2040 monotonics require that the `rp2040` feature is enabled. //! +//! # i.MX RT +//! The i.MX RT monotonics require that the feature `imxrt_gpt1` or `imxrt_gpt2` is enabled. +//! //! # nRF //! nRF monotonics require that one of the available `nrf52*` features is enabled. //! diff --git a/rtic-monotonics/src/nrf/timer.rs b/rtic-monotonics/src/nrf/timer.rs index bd544d0b38..589cc6fdfb 100644 --- a/rtic-monotonics/src/nrf/timer.rs +++ b/rtic-monotonics/src/nrf/timer.rs @@ -1,7 +1,7 @@ //! [`Monotonic`] impl for the 32-bit timers of the nRF series. //! //! Not all timers are available on all parts. Ensure that only the available -//! timers are exposed by having the correct `nrf52*` feature enabled for `rtic-monotonic`. +//! timers are exposed by having the correct `nrf52*` feature enabled for `rtic-monotonics`. //! //! # Example //! diff --git a/rtic-monotonics/src/rp2040.rs b/rtic-monotonics/src/rp2040.rs index 43e6770274..130c7d3e60 100644 --- a/rtic-monotonics/src/rp2040.rs +++ b/rtic-monotonics/src/rp2040.rs @@ -31,7 +31,7 @@ use core::future::Future; pub use fugit::{self, ExtU64}; use rp2040_pac::{timer, Interrupt, NVIC, RESETS, TIMER}; -/// Timer implementing `rtic_monotonic::Monotonic` which runs at 1 MHz. +/// Timer implementing [`Monotonic`] which runs at 1 MHz. pub struct Timer; impl Timer { diff --git a/rtic-monotonics/src/stm32.rs b/rtic-monotonics/src/stm32.rs index 12845a8b6f..2676a34627 100644 --- a/rtic-monotonics/src/stm32.rs +++ b/rtic-monotonics/src/stm32.rs @@ -1,7 +1,7 @@ //! [`Monotonic`] impl for the STM32. //! //! Not all timers are available on all parts. Ensure that only available -//! timers are exposed by having the correct `stm32*` feature enabled for `rtic-monotonic`. +//! timers are exposed by having the correct `stm32*` feature enabled for `rtic-monotonics`. //! //! # Example //! @@ -137,8 +137,10 @@ macro_rules! make_timer { impl $mono_name { /// Starts the monotonic timer. + /// /// - `tim_clock_hz`: `TIMx` peripheral clock frequency. /// - `_interrupt_token`: Required for correct timer interrupt handling. + /// /// This method must be called only once. pub fn start(tim_clock_hz: u32, _interrupt_token: impl crate::InterruptToken) { _generated::$timer::enable(); diff --git a/rtic-monotonics/src/systick.rs b/rtic-monotonics/src/systick.rs index fb4f8832a1..2bdb5e3a15 100644 --- a/rtic-monotonics/src/systick.rs +++ b/rtic-monotonics/src/systick.rs @@ -5,7 +5,7 @@ //! //! | Feature | Tick rate | Precision | //! |:----------------:|----------:|----------:| -//! | (none / default) | 1 Hz | 1 ms | +//! | (none / default) | 1 Hz | 1 s | //! | systick-100hz | 100 Hz | 10 ms | //! | systick-10khz | 10 KHz | 0.1 ms | @@ -67,7 +67,7 @@ cfg_if::cfg_if! { } } -/// Systick implementing `rtic_monotonic::Monotonic` which runs at 1 kHz, 100Hz or 10 kHz. +/// Systick implementing [`Monotonic`] which runs at 1 kHz, 100Hz or 10 kHz. pub struct Systick; impl Systick {