Improved example and comments for the systick! macro.

This commit is contained in:
Jonathan 'theJPster' Pallant 2025-06-14 21:19:32 +00:00 committed by Emil Fresk
parent 53ff4feed2
commit fa0d9be6f1

View file

@ -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