Trait rtic_monotonics::TimerQueueBackend

source ·
pub trait TimerQueueBackend: Sized + 'static {
    type Ticks: TimerQueueTicks;

    // Required methods
    fn now() -> Self::Ticks;
    fn set_compare(instant: Self::Ticks);
    fn clear_compare_flag();
    fn pend_interrupt();
    fn timer_queue() -> &'static TimerQueue<Self>;

    // Provided methods
    fn on_interrupt() { ... }
    fn enable_timer() { ... }
    fn disable_timer() { ... }
}
Expand description

A backend definition for a monotonic clock/counter.

Required Associated Types§

source

type Ticks: TimerQueueTicks

The type for ticks.

Required Methods§

source

fn now() -> Self::Ticks

Get the current time.

source

fn set_compare(instant: Self::Ticks)

Set the compare value of the timer interrupt.

Note: This method does not need to handle race conditions of the monotonic, the timer queue in RTIC checks this.

source

fn clear_compare_flag()

Clear the compare interrupt flag.

source

fn pend_interrupt()

Pend the timer’s interrupt.

source

fn timer_queue() -> &'static TimerQueue<Self>

Returns a reference to the underlying timer queue.

Provided Methods§

source

fn on_interrupt()

Optional. Runs on interrupt before any timer queue handling.

source

fn enable_timer()

Optional. This is used to save power, this is called when the timer queue is not empty.

Enabling and disabling the monotonic needs to propagate to now so that an instant based of now() is still valid.

NOTE: This may be called more than once.

source

fn disable_timer()

Optional. This is used to save power, this is called when the timer queue is empty.

Enabling and disabling the monotonic needs to propagate to now so that an instant based of now() is still valid.

NOTE: This may be called more than once.

Object Safety§

This trait is not object safe.

Implementors§