Struct atmega_hal::delay::Delay
source · pub struct Delay<SPEED> { /* private fields */ }Expand description
A busy-loop delay implementation
§Example
// Instead of niti_hal below you may also use a different
// HAL based on avr_hal_generic like attiny_hal or atmega_hal
// depending on actual hardware. For example:
//
// use attiny_hal as hal;
use niti_hal as hal;
use embedded_hal_v0::prelude::*;
let mut delay = embedded_hal_v0::delay::Delay::<hal::clock::MHz16>::new();
// Wait 1 second
delay.delay_ms(1000);§Warning
The delay is not accurate for values above 4095µs because of a loop whose overhead is not accounted for. This will be fixed in a future version.
Implementations§
Trait Implementations§
source§impl<SPEED> DelayNs for Delay<SPEED>
impl<SPEED> DelayNs for Delay<SPEED>
source§fn delay_ns(&mut self, ns: u32)
fn delay_ns(&mut self, ns: u32)
Pauses execution for at minimum
ns nanoseconds. Pause can be longer
if the implementation requires it due to precision/timing issues.