diff options
| author | Jonathan 'theJPster' Pallant <github@thejpster.org.uk> | 2025-06-14 21:19:32 +0000 |
|---|---|---|
| committer | Emil Fresk <emil.fresk@gmail.com> | 2025-06-15 10:43:43 +0000 |
| commit | fa0d9be6f1931ec8dc3c9e6c71bab4690e4a9277 (patch) | |
| tree | 9b0b54a139025ddda3a71b06b3429d2ec127e005 /rtic-monotonics/src/systick.rs | |
| parent | 53ff4feed23cffc1d35ab242e01552c8543a03af (diff) | |
Improved example and comments for the systick! macro.
Diffstat (limited to 'rtic-monotonics/src/systick.rs')
| -rw-r--r-- | rtic-monotonics/src/systick.rs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/rtic-monotonics/src/systick.rs b/rtic-monotonics/src/systick.rs index 024c9ad..1666d6b 100644 --- a/rtic-monotonics/src/systick.rs +++ b/rtic-monotonics/src/systick.rs @@ -1,4 +1,5 @@ //! [`Monotonic`](rtic_time::Monotonic) based on Cortex-M SysTick. +//! //! Note: this implementation is inefficient as it //! ticks and generates interrupts at a constant rate. //! @@ -9,11 +10,9 @@ //! systick_monotonic!(Mono, 1_000); //! //! fn init() { -//! # // This is normally provided by the selected PAC -//! # let systick = unsafe { core::mem::transmute(()) }; -//! # -//! // Start the monotonic -//! Mono::start(systick, 12_000_000); +//! let core_peripherals = cortex_m::Peripherals::take().unwrap(); +//! // Start the monotonic using the cortex-m crate's Systick driver +//! Mono::start(core_peripherals.SYST, 12_000_000); //! } //! //! async fn usage() { @@ -134,6 +133,15 @@ impl TimerQueueBackend for SystickBackend { /// Create a Systick based monotonic and register the Systick interrupt for it. /// +/// This macro expands to produce a new type called `$name`, which has a `fn +/// start()` function for you to call. The type has an implementation of the +/// `rtic_monotonics::TimerQueueBasedMonotonic` trait, the +/// `embedded_hal::delay::DelayNs` trait and the +/// `embedded_hal_async::delay::DelayNs` trait. +/// +/// This macro also produces an interrupt handler for the SysTick interrupt, by +/// creating an `extern "C" fn SysTick() { ... }`. +/// /// See [`crate::systick`] for more details. /// /// # Arguments |
