Skip to content

Commit 52da23b

Browse files
authored
Merge pull request #545 from newAM/syst-example
Add SYST example
2 parents a97747f + 87ef4e6 commit 52da23b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

cortex-m/src/peripheral/syst.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
//! SysTick: System Timer
2+
//!
3+
//! # Example
4+
//!
5+
//! ```no_run
6+
//! use cortex_m::peripheral::{Peripherals, SYST};
7+
//!
8+
//! let core_periph = cortex_m::peripheral::Peripherals::take().unwrap();
9+
//! let mut syst = core_periph.SYST;
10+
//! syst.set_reload(0xffffff);
11+
//! syst.clear_current();
12+
//! syst.enable_counter();
13+
//!
14+
//! let syst_value: u32 = SYST::get_current();
15+
//! ```
216
317
use volatile_register::{RO, RW};
418

0 commit comments

Comments
 (0)