Skip to main content

LevelWakeTimes

Struct LevelWakeTimes 

Source
pub struct LevelWakeTimes { /* private fields */ }
Expand description

Each level’s next timer deadline, as the low 32 bits of a microsecond clock, compared by wrapping difference: 32-bit atomics, since a Cortex-M3 has no 64-bit ones.

Implementations§

Source§

impl LevelWakeTimes

Source

pub const HORIZON_US: u32

The furthest a deadline is armed ahead: half the 32-bit microsecond range (~35 min), so a wrapping difference stays unambiguous. A longer one wakes the level early and it re-arms the rest.

Source

pub const fn new() -> Self

No level armed, boot level 0.

Source

pub fn set_boot(&self, level: u8)

Which level boots. Its deadline never arms the wake: its own timers bound its own park.

Source

pub fn set(&self, level: u8, after_us: Option<u64>, now: u32)

Record level’s next deadline, after_us microseconds after now (None: its band arms no timer).

Source

pub fn soonest_after(&self, now: u32) -> Option<u32>

Microseconds from now to the earliest armed non-boot deadline (0 when one is already due); None when none is armed.

Source

pub fn is_due(&self, level: u8, now: u32) -> bool

Whether level’s deadline has passed at now.

Trait Implementations§

Source§

impl Default for LevelWakeTimes

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.