Trait rtic::Monotonic[][src]

pub trait Monotonic {
    type Instant: Copy + Ord + Sub;
    fn ratio() -> Fraction;
fn now() -> Self::Instant;
unsafe fn reset();
fn zero() -> Self::Instant; }

A monotonic clock / counter

Associated Types

type Instant: Copy + Ord + Sub[src]

A measurement of this clock, use CYCCNT as a reference implementation for Instant. Note that the Instant must be a signed value such as i32.

Loading content...

Required methods

fn ratio() -> Fraction[src]

The ratio between the system timer (SysTick) frequency and this clock frequency, i.e. Monotonic clock * Fraction = System clock

The ratio must be expressed in reduced Fraction form to prevent overflows. That is 2 / 3 instead of 4 / 6

fn now() -> Self::Instant[src]

Returns the current time

Correctness

This function is allowed to return nonsensical values if called before reset is invoked by the runtime. Therefore application authors should not call this function during the #[init] phase.

unsafe fn reset()[src]

Resets the counter to zero

Safety

This function will be called exactly once by the RTIC runtime after #[init] returns and before tasks can start; this is also the case in multi-core applications. User code must never call this function.

fn zero() -> Self::Instant[src]

A Self::Instant that represents a count of zero

Loading content...

Implementors

Loading content...