mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
Add documentation for imxrt; other doc fixes
This commit is contained in:
parent
413955fb39
commit
af550483f5
8 changed files with 32 additions and 11 deletions
|
@ -7,6 +7,11 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Missing documentation for i.MX RT monotonics
|
||||||
|
- Incorrect documentation of systick monotonic timer precision
|
||||||
|
|
||||||
## v1.3.0 - 2023-11-08
|
## v1.3.0 - 2023-11-08
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -16,7 +16,14 @@ description = "A library that provides implementations of the Monotonic trait fr
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[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"]
|
rustdoc-flags = ["--cfg", "docsrs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -51,7 +58,9 @@ imxrt-ral = { version = "0.5.3", optional = true }
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
proc-macro2 = { version = "1.0.36", optional = true }
|
proc-macro2 = { version = "1.0.36", optional = true }
|
||||||
quote = { version = "1.0.15", 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]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//! [`Monotonic`] impl for the i.MX RT.
|
//! [`Monotonic`] implementations for i.MX RT's GPT peripherals.
|
||||||
//!
|
//!
|
||||||
//! # Example
|
//! # 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")]
|
#[cfg(feature = "imxrt_gpt1")]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! create_imxrt_gpt1_token {
|
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")]
|
#[cfg(feature = "imxrt_gpt2")]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! create_imxrt_gpt2_token {
|
macro_rules! create_imxrt_gpt2_token {
|
||||||
|
@ -98,7 +98,7 @@ fn calc_now(period: u32, counter: u32) -> u64 {
|
||||||
|
|
||||||
macro_rules! make_timer {
|
macro_rules! make_timer {
|
||||||
($mono_name:ident, $timer:ident, $period:ident, $tq:ident$(, doc: ($($doc:tt)*))?) => {
|
($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)*)))]
|
#[cfg_attr(docsrs, doc(cfg($($doc)*)))]
|
||||||
)?
|
)?
|
||||||
|
@ -113,9 +113,11 @@ macro_rules! make_timer {
|
||||||
|
|
||||||
impl $mono_name {
|
impl $mono_name {
|
||||||
/// Starts the monotonic timer.
|
/// Starts the monotonic timer.
|
||||||
|
///
|
||||||
/// - `tick_freq_hz`: The tick frequency of the given timer.
|
/// - `tick_freq_hz`: The tick frequency of the given timer.
|
||||||
/// - `gpt`: The GPT timer register block instance.
|
/// - `gpt`: The GPT timer register block instance.
|
||||||
/// - `_interrupt_token`: Required for correct timer interrupt handling.
|
/// - `_interrupt_token`: Required for correct timer interrupt handling.
|
||||||
|
///
|
||||||
/// This method must be called only once.
|
/// This method must be called only once.
|
||||||
pub fn start(tick_freq_hz: u32, gpt: $timer, _interrupt_token: impl crate::InterruptToken<Self>) {
|
pub fn start(tick_freq_hz: u32, gpt: $timer, _interrupt_token: impl crate::InterruptToken<Self>) {
|
||||||
// Find a prescaler that creates our desired tick frequency
|
// Find a prescaler that creates our desired tick frequency
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
//! # RP2040
|
//! # RP2040
|
||||||
//! The RP2040 monotonics require that the `rp2040` feature is enabled.
|
//! 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
|
||||||
//! nRF monotonics require that one of the available `nrf52*` features is enabled.
|
//! nRF monotonics require that one of the available `nrf52*` features is enabled.
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//! [`Monotonic`] impl for the 32-bit timers of the nRF series.
|
//! [`Monotonic`] impl for the 32-bit timers of the nRF series.
|
||||||
//!
|
//!
|
||||||
//! Not all timers are available on all parts. Ensure that only the available
|
//! 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
|
//! # Example
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -31,7 +31,7 @@ use core::future::Future;
|
||||||
pub use fugit::{self, ExtU64};
|
pub use fugit::{self, ExtU64};
|
||||||
use rp2040_pac::{timer, Interrupt, NVIC, RESETS, TIMER};
|
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;
|
pub struct Timer;
|
||||||
|
|
||||||
impl Timer {
|
impl Timer {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//! [`Monotonic`] impl for the STM32.
|
//! [`Monotonic`] impl for the STM32.
|
||||||
//!
|
//!
|
||||||
//! Not all timers are available on all parts. Ensure that only available
|
//! 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
|
//! # Example
|
||||||
//!
|
//!
|
||||||
|
@ -137,8 +137,10 @@ macro_rules! make_timer {
|
||||||
|
|
||||||
impl $mono_name {
|
impl $mono_name {
|
||||||
/// Starts the monotonic timer.
|
/// Starts the monotonic timer.
|
||||||
|
///
|
||||||
/// - `tim_clock_hz`: `TIMx` peripheral clock frequency.
|
/// - `tim_clock_hz`: `TIMx` peripheral clock frequency.
|
||||||
/// - `_interrupt_token`: Required for correct timer interrupt handling.
|
/// - `_interrupt_token`: Required for correct timer interrupt handling.
|
||||||
|
///
|
||||||
/// This method must be called only once.
|
/// This method must be called only once.
|
||||||
pub fn start(tim_clock_hz: u32, _interrupt_token: impl crate::InterruptToken<Self>) {
|
pub fn start(tim_clock_hz: u32, _interrupt_token: impl crate::InterruptToken<Self>) {
|
||||||
_generated::$timer::enable();
|
_generated::$timer::enable();
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
//!
|
//!
|
||||||
//! | Feature | Tick rate | Precision |
|
//! | Feature | Tick rate | Precision |
|
||||||
//! |:----------------:|----------:|----------:|
|
//! |:----------------:|----------:|----------:|
|
||||||
//! | (none / default) | 1 Hz | 1 ms |
|
//! | (none / default) | 1 Hz | 1 s |
|
||||||
//! | systick-100hz | 100 Hz | 10 ms |
|
//! | systick-100hz | 100 Hz | 10 ms |
|
||||||
//! | systick-10khz | 10 KHz | 0.1 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;
|
pub struct Systick;
|
||||||
|
|
||||||
impl Systick {
|
impl Systick {
|
||||||
|
|
Loading…
Reference in a new issue