File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 1
- //! Delays
1
+ //! API for delays with the systick timer
2
+ //!
3
+ //! Please be aware of potential overflows.
4
+ //! For example, the maximum delay with 48MHz is around 89 seconds
5
+ //!
6
+ //! Consider using the timers api as a more flexible interface
7
+ //!
8
+ //! # Example
9
+ //!
10
+ //! ``` no_run
11
+ //! use stm32f0xx_hal as hal;
12
+ //!
13
+ //! use crate::hal::stm32;
14
+ //! use crate::hal::prelude::*;
15
+ //! use crate::hal::delay::Delay;
16
+ //! use cortex_m::peripheral::Peripherals;
17
+ //!
18
+ //! let mut p = stm32::Peripherals::take().unwrap();
19
+ //! let mut cp = cortex_m::Peripherals::take().unwrap();
20
+ //!
21
+ //! let clocks = p.RCC.constrain().cfgr.freeze();
22
+ //! let mut delay = Delay::new(cp.SYST, clocks);
23
+ //! loop {
24
+ //! delay.delay_ms(1_000_u16);
25
+ //! }
26
+ //! ```
2
27
3
28
use cast:: { u16, u32} ;
4
29
use cortex_m:: peripheral:: syst:: SystClkSource ;
Original file line number Diff line number Diff line change @@ -73,6 +73,9 @@ impl Timer<SYST> {
73
73
}
74
74
}
75
75
76
+ /// Use the systick as a timer
77
+ ///
78
+ /// Be aware that intervals less than 4 Hertz may not function properly
76
79
impl CountDown for Timer < SYST > {
77
80
type Time = Hertz ;
78
81
You can’t perform that action at this time.
0 commit comments