aboutsummaryrefslogtreecommitdiff
path: root/rtic-monotonics
diff options
context:
space:
mode:
authorJonathan 'theJPster' Pallant <github@thejpster.org.uk>2025-06-14 21:19:32 +0000
committerEmil Fresk <emil.fresk@gmail.com>2025-06-15 10:43:43 +0000
commitfa0d9be6f1931ec8dc3c9e6c71bab4690e4a9277 (patch)
tree9b0b54a139025ddda3a71b06b3429d2ec127e005 /rtic-monotonics
parent53ff4feed23cffc1d35ab242e01552c8543a03af (diff)
Improved example and comments for the systick! macro.
Diffstat (limited to 'rtic-monotonics')
-rw-r--r--rtic-monotonics/src/systick.rs18
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