aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Finomnis <finomnis@gmail.com> 2023-11-09 00:35:47 +0100
committerGravatar Emil Fresk <emil.fresk@gmail.com> 2023-11-10 20:49:12 +0000
commitaf550483f50b3106a9be0990bd4b579e2da26e6e (patch)
tree237bbe0a60469c9c44c92d1daaa08ace0e99e230
parent413955fb39b72a1c08c6852052b0626a175b1ca8 (diff)
downloadrtic-af550483f50b3106a9be0990bd4b579e2da26e6e.tar.gz
rtic-af550483f50b3106a9be0990bd4b579e2da26e6e.tar.zst
rtic-af550483f50b3106a9be0990bd4b579e2da26e6e.zip
Add documentation for imxrt; other doc fixes
-rw-r--r--rtic-monotonics/CHANGELOG.md5
-rw-r--r--rtic-monotonics/Cargo.toml13
-rw-r--r--rtic-monotonics/src/imxrt.rs10
-rw-r--r--rtic-monotonics/src/lib.rs3
-rw-r--r--rtic-monotonics/src/nrf/timer.rs2
-rw-r--r--rtic-monotonics/src/rp2040.rs2
-rw-r--r--rtic-monotonics/src/stm32.rs4
-rw-r--r--rtic-monotonics/src/systick.rs4
8 files changed, 32 insertions, 11 deletions
diff --git a/rtic-monotonics/CHANGELOG.md b/rtic-monotonics/CHANGELOG.md
index d030bb02..2649e2c0 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 99679fcf..441e772f 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 ee7e2ffe..39448291 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<Self>) {
// Find a prescaler that creates our desired tick frequency
diff --git a/rtic-monotonics/src/lib.rs b/rtic-monotonics/src/lib.rs
index 2d7c74f8..6dc703eb 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 bd544d0b..589cc6fd 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 43e67702..130c7d3e 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 12845a8b..2676a346 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<Self>) {
_generated::$timer::enable();
diff --git a/rtic-monotonics/src/systick.rs b/rtic-monotonics/src/systick.rs
index fb4f8832..2bdb5e3a 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 {