Function avr_device::asm::delay_cycles
source · pub fn delay_cycles(cycles: u32)
Expand description
Blocks the program for at least cycles
CPU cycles.
This is intended for very simple delays in low-level drivers, but it has some caveats:
-
The delay may be significantly longer if an interrupt is serviced at the same time, since the delay loop will not be executing during the interrupt. If you need precise timing, use a hardware timer peripheral instead.
-
The real-time delay depends on the CPU clock frequency. If you want to conveniently specify a delay value in real-time units like microseconds, then use the
delay
module in the HAL crate for your platform.