Module stm32h7xx_hal::delay
source · [−]Expand description
Delay providers
There are currently two delay providers. In general you should prefer to use
Delay, however if you do not have access to SYST
you can use
DelayFromCountDownTimer with any timer that
implements the CountDown trait. This can be
useful if you’re using RTIC’s schedule API, which occupies
the SYST
peripheral.
Examples
Delay
let mut delay = Delay::new(core.SYST, device.clocks);
delay.delay_ms(500);
// Release SYST from the delay
let syst = delay.free();
DelayFromCountDownTimer
let timer2 = device
.TIM2
.timer(1.kHz(), device.peripheral.TIM2, &mut device.clocks);
let mut delay = DelayFromCountDownTimer::new(timer2);
delay.delay_ms(500);
// Release the timer from the delay
let timer2 = delay.free();
Structs
System timer (SysTick) as a delay provider
CountDown Timer as a delay provider