Struct avr_hal_generic::delay::Delay
source · pub struct Delay<SPEED> { /* private fields */ }
Expand description
A busy-loop delay implementation
§Example
// Instead of arduino_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 arduino_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.impl<SPEED: Copy> Copy for Delay<SPEED>
Auto Trait Implementations§
impl<SPEED> Freeze for Delay<SPEED>
impl<SPEED> RefUnwindSafe for Delay<SPEED>where
SPEED: RefUnwindSafe,
impl<SPEED> Send for Delay<SPEED>where
SPEED: Send,
impl<SPEED> Sync for Delay<SPEED>where
SPEED: Sync,
impl<SPEED> Unpin for Delay<SPEED>where
SPEED: Unpin,
impl<SPEED> UnwindSafe for Delay<SPEED>where
SPEED: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more