Skip to main content

Delay

Struct Delay 

Source
pub struct Delay<TIMERX> { /* private fields */ }
Expand description

A timer given over to blocking delays.

Unlike CountDownTimer it promises no interval: each call configures the dividers, waits, and stops the counter again, so any length can be asked for at any time.

Implementations§

Source§

impl<TIMERX: Instance> Delay<TIMERX>

Source

pub fn delay<const NOM: u64, const DENOM: u64>( &mut self, interval: Duration<u32, NOM, DENOM>, )

Blocks for interval, in whatever scale the caller wrote it in.

Rounding and the saturation ceiling are the same as in Timer::start_interval, the dividers being derived the same way.

Source

pub fn into_timer(self) -> Timer<TIMERX>

Takes the timer back out of delay duty, stopped and ready to be started.

Source

pub fn release(self, rcu: &mut Rcu) -> TIMERX

Returns the peripheral with its clock stopped.

Trait Implementations§

Source§

impl<TIMERX: Instance> DelayNs for Delay<TIMERX>

Blocking delays for portable drivers, delegating to Delay::delay.

Resolution is one timer tick — around 20 ns at 48 MHz — so a finer request is served as a single tick. delay_us/delay_ms are the trait’s own defaults, splitting long waits into chunks of at most u32::MAX nanoseconds, well inside what the dividers span.

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.

Auto Trait Implementations§

§

impl<TIMERX> Freeze for Delay<TIMERX>
where TIMERX: Freeze,

§

impl<TIMERX> RefUnwindSafe for Delay<TIMERX>
where TIMERX: RefUnwindSafe,

§

impl<TIMERX> Send for Delay<TIMERX>
where TIMERX: Send,

§

impl<TIMERX> Sync for Delay<TIMERX>
where TIMERX: Sync,

§

impl<TIMERX> Unpin for Delay<TIMERX>
where TIMERX: Unpin,

§

impl<TIMERX> UnsafeUnpin for Delay<TIMERX>
where TIMERX: UnsafeUnpin,

§

impl<TIMERX> UnwindSafe for Delay<TIMERX>
where TIMERX: 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>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.