diff options
| author | Jonathan 'theJPster' Pallant <github@thejpster.org.uk> | 2025-06-15 12:51:53 +0100 |
|---|---|---|
| committer | Henrik Tjäder <henrik@tjaders.com> | 2025-06-15 12:52:16 +0000 |
| commit | f4b0c20f8249049c88923de55912865c10741042 (patch) | |
| tree | 00c1c29020548279b9878604c3cddd8ddbd51ad3 /rtic-monotonics/src/systick.rs | |
| parent | a2dfb62ffc0c242a3dd11b6385c0fea731e54bfc (diff) | |
More details about the arguments for the systick API.
Diffstat (limited to 'rtic-monotonics/src/systick.rs')
| -rw-r--r-- | rtic-monotonics/src/systick.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/rtic-monotonics/src/systick.rs b/rtic-monotonics/src/systick.rs index 1666d6b..1f705db 100644 --- a/rtic-monotonics/src/systick.rs +++ b/rtic-monotonics/src/systick.rs @@ -7,19 +7,24 @@ //! //! ``` //! 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); //! //! fn init() { //! 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); //! } //! //! async fn usage() { //! loop { -//! // Use the monotonic +//! // You can use the monotonic to get the time... //! 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; //! } //! } //! ``` |
