pub struct VirtualMuxAlarm<'a, A: Alarm<'a>> { /* private fields */ }
Expand description

An object to multiplex multiple “virtual” alarms over a single underlying alarm. A VirtualMuxAlarm is a node in a linked list of alarms that share the same underlying alarm.

Implementations§

source§

impl<'a, A: Alarm<'a>> VirtualMuxAlarm<'a, A>

source

pub fn new(mux_alarm: &'a MuxAlarm<'a, A>) -> VirtualMuxAlarm<'a, A>

After calling new, always call setup()

source

pub fn setup(&'a self)

Call this method immediately after new() to link this to the mux, otherwise alarms won’t fire

Trait Implementations§

source§

impl<'a, A: Alarm<'a>> Alarm<'a> for VirtualMuxAlarm<'a, A>

source§

fn set_alarm_client(&self, client: &'a dyn AlarmClient)

Specify the callback for when the counter reaches the alarm value. If there was a previously installed callback this call replaces it.
source§

fn disarm(&self) -> Result<(), ErrorCode>

Disable the alarm and stop it from firing in the future. Valid Result<(), ErrorCode> codes are: Read more
source§

fn is_armed(&self) -> bool

Returns whether the alarm is currently armed. Note that this does not reliably indicate whether there will be a future callback: it is possible that the alarm has triggered (and disarmed) and a callback is pending and has not been called yet. In this case it possible for is_armed to return false yet to receive a callback.
source§

fn set_alarm(&self, reference: Self::Ticks, dt: Self::Ticks)

Specify when the callback should be called and enable it. The callback will be enqueued when Time::now() == reference + dt. The callback itself may not run exactly at this time, due to delays. However, it it assured to execute after reference + dt: it can be delayed but will never fire early. The method takes reference and dt rather than a single value denoting the counter value so it can distinguish between alarms which have very recently already passed and those in the far far future (see #1651).
source§

fn get_alarm(&self) -> Self::Ticks

Return the current alarm value. This is undefined at boot and otherwise returns now + dt from the last call to set_alarm.
source§

fn minimum_dt(&self) -> Self::Ticks

Return the minimum dt value that is supported. Any dt smaller than this will automatically be increased to this minimum value.
source§

impl<'a, A: Alarm<'a>> AlarmClient for VirtualMuxAlarm<'a, A>

source§

fn alarm(&self)

Callback indicating the alarm time has been reached. The alarm MUST be disabled when this is called. If a new alarm is needed, the client can call Alarm::set_alarm.
source§

impl<'a, A: Alarm<'a>> ListNode<'a, VirtualMuxAlarm<'a, A>> for VirtualMuxAlarm<'a, A>

source§

fn next(&self) -> &'a ListLink<'_, VirtualMuxAlarm<'a, A>>

source§

impl<'a, A: Alarm<'a>> Time for VirtualMuxAlarm<'a, A>

§

type Frequency = <A as Time>::Frequency

The number of ticks per second
§

type Ticks = <A as Time>::Ticks

The width of a time value
source§

fn now(&self) -> Self::Ticks

Returns a timestamp. Depending on the implementation of Time, this could represent either a static timestamp or a sample of a counter; if an implementation relies on it being constant or changing it should use Timestamp or Counter.

Auto Trait Implementations§

§

impl<'a, A> !Freeze for VirtualMuxAlarm<'a, A>

§

impl<'a, A> !RefUnwindSafe for VirtualMuxAlarm<'a, A>

§

impl<'a, A> !Send for VirtualMuxAlarm<'a, A>

§

impl<'a, A> !Sync for VirtualMuxAlarm<'a, A>

§

impl<'a, A> Unpin for VirtualMuxAlarm<'a, A>
where <A as Time>::Ticks: Unpin,

§

impl<'a, A> !UnwindSafe for VirtualMuxAlarm<'a, A>

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> ConvertTicks<<T as Time>::Ticks> for T
where T: Time + ?Sized,

source§

fn ticks_from_seconds(&self, s: u32) -> <T as Time>::Ticks

Returns the number of ticks in the provided number of seconds, rounding down any fractions. If the value overflows Ticks it returns Ticks::max_value().
source§

fn ticks_from_ms(&self, ms: u32) -> <T as Time>::Ticks

Returns the number of ticks in the provided number of milliseconds, rounding down any fractions. If the value overflows Ticks it returns Ticks::max_value().
source§

fn ticks_from_us(&self, us: u32) -> <T as Time>::Ticks

Returns the number of ticks in the provided number of microseconds, rounding down any fractions. If the value overflows Ticks it returns Ticks::max_value().
source§

fn ticks_to_seconds(&self, tick: <T as Time>::Ticks) -> u32

Returns the number of seconds in the provided number of ticks, rounding down any fractions. If the value overflows u32, u32::MAX is returned,
source§

fn ticks_to_ms(&self, tick: <T as Time>::Ticks) -> u32

Returns the number of milliseconds in the provided number of ticks, rounding down any fractions. If the value overflows u32, u32::MAX is returned,
source§

fn ticks_to_us(&self, tick: <T as Time>::Ticks) -> u32

Returns the number of microseconds in the provided number of ticks, rounding down any fractions. If the value overflows u32, u32::MAX is returned,
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> SizedTypeProperties for T

source§

#[doc(hidden)] const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
source§

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

§

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>,

§

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.