Module stm32f0xx_hal::delay [−][src]
Expand description
API for delays with the systick timer
Please be aware of potential overflows when using delay_us
.
E.g. at 48MHz the maximum delay is 89 seconds.
Consider using the timers api as a more flexible interface
Example
use stm32f0xx_hal as hal;
use crate::hal::pac;
use crate::hal::prelude::*;
use crate::hal::delay::Delay;
use cortex_m::peripheral::Peripherals;
let mut p = pac::Peripherals::take().unwrap();
let mut cp = cortex_m::Peripherals::take().unwrap();
let mut rcc = p.RCC.configure().freeze(&mut p.FLASH);
let mut delay = Delay::new(cp.SYST, &rcc);
loop {
delay.delay_ms(1_000_u16);
}
Structs
System timer (SysTick) as a delay provider