[−][src]Trait embedded_async_timer::Timer
A clock device that supports throwing alarm interrupts at given instant.
This trait assumes that the clock is not (re)set after initial configuration.
Associated Types
type Duration: Clone
A length of time.
You will probably want to make this type as close to your Instant type as possible, with a focus on making addition and storage efficient.
type Instant: Clone + Ord + AddAssign<Self::Duration>
A moment in time.
You will probably make this type as close to the internal representation of an instant as used by your RTC peripheral.
Associated Constants
const DELTA: Self::Duration
A minimal time increment, i.e. the time it takes to execute a handful of instructions.
Used when scheduling the next deadline, but in the meantime the deadline has passed.
Required methods
fn reset(&mut self)
Initialize the clock and start counting.
You will need to run this sometime after initializing the static memory in which the timer lives, such that the interrupt handler can access the timer.
fn interrupt_free<F: FnOnce(&CriticalSection) -> R, R>(f: F) -> R
Execute the function in an interrupt free critical section.
Probably you want to directly feed through cortex_m::interrupt::free
or similar.
fn now(&self) -> Self::Instant
Yield the current time.
fn disarm(&mut self)
Disarm the set alarm.
fn arm(&mut self, deadline: &Self::Instant)
Set the alarm for a given time.