WakeupTimer

Struct WakeupTimer 

Source
pub struct WakeupTimer<'r> { /* private fields */ }
Expand description

The RTC wakeup timer

This timer can be used in two ways:

  1. Continually call wait until it returns Ok(()).
  2. Set up the RTC interrupt.

If you use an interrupt, you should still call wait once, after the interrupt fired. This should return Ok(()) immediately. Doing this will reset the timer flag. If you don’t do this, the interrupt will not fire again, if you go to sleep.

You don’t need to call wait, if you call cancel, as that also resets the flag. Restarting the timer by calling start will also reset the flag.

Trait Implementations§

Source§

impl Cancel for WakeupTimer<'_>

Source§

type Error = Void

Error returned when a countdown can’t be canceled.
Source§

fn cancel(&mut self) -> Result<(), Self::Error>

Tries to cancel this countdown. Read more
Source§

impl CountDown for WakeupTimer<'_>

Source§

fn start<T>(&mut self, delay: T)
where T: Into<Self::Time>,

Starts the wakeup timer

The delay argument specifies the timer delay. If the wakeup_clock_config is set to CkSpre, the value is in seconds and up to 17 bits of delay are supported, giving us a range of over 36 hours. Otherwise, the timeunit depends on the RTCCLK and the configured wakeup_clock_config value.

§Panics

The delay argument must be in the range 1 <= delay <= 2^17. Panics, if delay is outside of that range.

Source§

type Time = u32

The unit of time used by this timer
Source§

fn wait(&mut self) -> Result<(), Void>

Non-blockingly “waits” until the count down finishes Read more
Source§

impl Periodic for WakeupTimer<'_>

Auto Trait Implementations§

§

impl<'r> Freeze for WakeupTimer<'r>

§

impl<'r> RefUnwindSafe for WakeupTimer<'r>

§

impl<'r> Send for WakeupTimer<'r>

§

impl<'r> !Sync for WakeupTimer<'r>

§

impl<'r> Unpin for WakeupTimer<'r>

§

impl<'r> !UnwindSafe for WakeupTimer<'r>

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.