More details about the arguments for the systick API.

This commit is contained in:
Jonathan 'theJPster' Pallant 2025-06-15 12:51:53 +01:00 committed by Henrik Tjäder
parent a2dfb62ffc
commit f4b0c20f82

View file

@ -7,19 +7,24 @@
//! //!
//! ``` //! ```
//! use rtic_monotonics::systick::prelude::*; //! use rtic_monotonics::systick::prelude::*;
//!
//! // Create the type `Mono`. It will manage the SysTick timer, and use it to
//! // generate 1000 interrupts per second.
//! systick_monotonic!(Mono, 1_000); //! systick_monotonic!(Mono, 1_000);
//! //!
//! fn init() { //! fn init() {
//! let core_peripherals = cortex_m::Peripherals::take().unwrap(); //! let core_peripherals = cortex_m::Peripherals::take().unwrap();
//! // Start the monotonic using the cortex-m crate's Systick driver //! // Start the monotonic using the cortex-m crate's Systick driver.
//! // We tell it we have a system clock of 12 MHz.
//! Mono::start(core_peripherals.SYST, 12_000_000); //! Mono::start(core_peripherals.SYST, 12_000_000);
//! } //! }
//! //!
//! async fn usage() { //! async fn usage() {
//! loop { //! loop {
//! // Use the monotonic //! // You can use the monotonic to get the time...
//! let timestamp = Mono::now(); //! let timestamp = Mono::now();
//! Systick::delay(100.millis()).await; //! // ...and you can use it to add a delay to this async function
//! Mono::delay(100.millis()).await;
//! } //! }
//! } //! }
//! ``` //! ```