[][src]Trait kernel::hil::time::Timer

pub trait Timer<'a, W = u32>: Time<W> {
    fn set_client(&'a self, client: &'a dyn TimerClient);
fn oneshot(&self, interval: W);
fn repeat(&self, interval: W);
fn interval(&self) -> Option<W>;
fn time_remaining(&self) -> Option<W>;
fn cancel(&self); fn is_oneshot(&self) -> bool { ... }
fn is_repeating(&self) -> bool { ... }
fn is_enabled(&self) -> bool { ... } }

The Timer trait models a timer that can notify when a particular interval has elapsed.

Required methods

fn set_client(&'a self, client: &'a dyn TimerClient)

Set the client for interrupt events.

fn oneshot(&self, interval: W)

Sets a one-shot timer to fire in interval clock-tics.

Calling this method will override any existing oneshot or repeating timer.

fn repeat(&self, interval: W)

Sets repeating timer to fire every interval clock-tics.

Calling this method will override any existing oneshot or repeating timer.

fn interval(&self) -> Option<W>

Returns the interval for a repeating timer.

Returns None if the timer is disabled or in oneshot mode and Some(interval) if it is repeating.

fn time_remaining(&self) -> Option<W>

Returns the remaining time in clock tics for a oneshot or repeating timer.

Returns None if the timer is disabled.

fn cancel(&self)

Cancels an outstanding timer.

The implementation will always cancel the timer. delivered.

Loading content...

Provided methods

fn is_oneshot(&self) -> bool

Returns whether this is a oneshot (rather than repeating) timer.

fn is_repeating(&self) -> bool

Returns whether this is a repeating (rather than oneshot) timer.

fn is_enabled(&self) -> bool

Returns whether this timer is currently active (has time remaining).

Loading content...

Implementors

Loading content...