Struct attiny_hal::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§

source§

impl<SPEED> Delay<SPEED>

source

pub fn new() -> Delay<SPEED>

Trait Implementations§

source§

impl<SPEED> Clone for Delay<SPEED>
where SPEED: Clone,

source§

fn clone(&self) -> Delay<SPEED>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<SPEED> Debug for Delay<SPEED>
where SPEED: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<SPEED> DelayNs for Delay<SPEED>
where Delay<SPEED>: DelayUs<u16>,

source§

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.
source§

fn delay_us(&mut self, us: u32)

Pauses execution for at minimum us microseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
source§

fn delay_ms(&mut self, ms: u32)

Pauses execution for at minimum ms milliseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
source§

impl<SPEED> DelayMs<u16> for Delay<SPEED>
where Delay<SPEED>: DelayUs<u32>,

source§

fn delay_ms(&mut self, ms: u16)

Pauses execution for ms milliseconds
source§

impl<SPEED> DelayMs<u8> for Delay<SPEED>
where Delay<SPEED>: DelayMs<u16>,

source§

fn delay_ms(&mut self, ms: u8)

Pauses execution for ms milliseconds
source§

impl DelayUs<u16> for Delay<MHz1>

source§

fn delay_us(&mut self, us: u16)

Pauses execution for us microseconds
source§

impl DelayUs<u16> for Delay<MHz10>

source§

fn delay_us(&mut self, us: u16)

Pauses execution for us microseconds
source§

impl DelayUs<u16> for Delay<MHz12>

source§

fn delay_us(&mut self, us: u16)

Pauses execution for us microseconds
source§

impl DelayUs<u16> for Delay<MHz16>

source§

fn delay_us(&mut self, us: u16)

Pauses execution for us microseconds
source§

impl DelayUs<u16> for Delay<MHz20>

source§

fn delay_us(&mut self, us: u16)

Pauses execution for us microseconds
source§

impl DelayUs<u16> for Delay<MHz24>

source§

fn delay_us(&mut self, us: u16)

Pauses execution for us microseconds
source§

impl DelayUs<u16> for Delay<MHz8>

source§

fn delay_us(&mut self, us: u16)

Pauses execution for us microseconds
source§

impl<SPEED> DelayUs<u32> for Delay<SPEED>
where Delay<SPEED>: DelayUs<u16>,

source§

fn delay_us(&mut self, us: u32)

Pauses execution for us microseconds
source§

impl<SPEED> DelayUs<u8> for Delay<SPEED>
where Delay<SPEED>: DelayUs<u16>,

source§

fn delay_us(&mut self, us: u8)

Pauses execution for us microseconds
source§

impl<SPEED> Copy for Delay<SPEED>
where SPEED: Copy,

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.