diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2023-04-04 20:03:58 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-04 20:03:58 +0000 |
| commit | 72ae46083e64acc012c6b85d3ef7a115657a01e3 (patch) | |
| tree | 024dbdb94cb5537312c5c34f121257265c165bea /rtic-monotonics/src/systick.rs | |
| parent | 064cf19265f72d7f01e0847c545e6250391a2172 (diff) | |
| parent | aeec8bd41bdf3d57098902407ec320f59365641a (diff) | |
Merge #721
721: Added nRF monotonics r=perlindgren a=korken89
Testing completed
Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
Diffstat (limited to 'rtic-monotonics/src/systick.rs')
| -rw-r--r-- | rtic-monotonics/src/systick.rs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/rtic-monotonics/src/systick.rs b/rtic-monotonics/src/systick.rs index f4345d4..6a28a11 100644 --- a/rtic-monotonics/src/systick.rs +++ b/rtic-monotonics/src/systick.rs @@ -1,4 +1,28 @@ -//! ... +//! A monotonics based on Cortex-M SysTick. Note that this implementation is inefficient as it +//! ticks, and generates interrupts, at a constant rate. +//! +//! # Example +//! +//! ``` +//! use rtic_monotonics::systick::*; +//! +//! fn init() { +//! # // This is normally provided by the selected PAC +//! # let systick = unsafe { core::mem::transmute(()) }; +//! // Generate the required token +//! let systick_token = rtic_monotonics::create_systick_token!(); +//! +//! // Start the monotonic +//! Systick::start(systick, 12_000_000, systick_token); +//! } +//! +//! async fn usage() { +//! loop { +//! // Use the monotonic +//! Systick::delay(100.millis()).await; +//! } +//! } +//! ``` use super::Monotonic; pub use super::{TimeoutError, TimerQueue}; |
