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 hal::prelude::*;
let mut delay = hal::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
impl<SPEED: Copy> Copy for Delay<SPEED>
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more