From 87ef4e6c12c614f4d6d8299856a1aa29f1d736c2 Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Sun, 30 Jun 2024 11:28:25 -0700 Subject: [PATCH] Add SYST example Fixes #460 --- cortex-m/src/peripheral/syst.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cortex-m/src/peripheral/syst.rs b/cortex-m/src/peripheral/syst.rs index 345acc2f..40042e17 100644 --- a/cortex-m/src/peripheral/syst.rs +++ b/cortex-m/src/peripheral/syst.rs @@ -1,4 +1,18 @@ //! SysTick: System Timer +//! +//! # Example +//! +//! ```no_run +//! use cortex_m::peripheral::{Peripherals, SYST}; +//! +//! let core_periph = cortex_m::peripheral::Peripherals::take().unwrap(); +//! let mut syst = core_periph.SYST; +//! syst.set_reload(0xffffff); +//! syst.clear_current(); +//! syst.enable_counter(); +//! +//! let syst_value: u32 = SYST::get_current(); +//! ``` use volatile_register::{RO, RW};