pub trait Timer<const TIMER_HZ: u32> {
    type Error: Debug;
    fn now(&mut self) -> TimerInstantU32<TIMER_HZ>;
fn start(
        &mut self,
        duration: TimerDurationU32<TIMER_HZ>
    ) -> Result<(), Self::Error>;
fn cancel(&mut self) -> Result<(), Self::Error>;
fn wait(&mut self) -> Result<(), Self::Error>; }
Expand description

Provides non-blocking CountDown timing capabilities

Associated Types

An error that might happen during waiting

Required methods

Return current time Instant

Start timer with a duration

Tries to stop this timer. An error will be returned if the timer has already been canceled or was never started. An error is also returned if the timer is not Periodic and has already expired.

Wait until timer duration has expired. Must return nb::Error::WouldBlock if timer duration is not yet over. Must return OK(()) as soon as timer duration has expired.

Implementors