Struct Rtc

Source
pub struct Rtc<'d> {
    pub rwdt: Rwdt,
    pub swd: Swd,
    /* private fields */
}
Available on crate feature unstable only.
Expand description

Low-power Management

Fields§

§rwdt: Rwdt

Reset Watchdog Timer.

§swd: Swd

Super Watchdog

Implementations§

Source§

impl<'d> Rtc<'d>

Source

pub fn new(rtc_cntl: impl Peripheral<P = LPWR> + 'd) -> Self

Create a new instance in crate::Blocking mode.

Optionally an interrupt handler can be bound.

Source

pub fn estimate_xtal_frequency(&mut self) -> u32

Return estimated XTAL frequency in MHz.

Source

pub fn time_since_boot(&self) -> Duration

Get the time since boot.

Source

pub fn current_time(&self) -> NaiveDateTime

Get the current time.

Source

pub fn set_current_time(&self, current_time: NaiveDateTime)

Set the current time.

§Panics

Panics if current_time is before the Unix epoch (meaning the underlying timestamp is negative).

Source

pub fn sleep_deep(&mut self, wake_sources: &[&dyn WakeSource]) -> !

Enter deep sleep and wake with the provided wake_sources.

Source

pub fn sleep_light(&mut self, wake_sources: &[&dyn WakeSource])

Enter light sleep and wake with the provided wake_sources.

Source

pub fn sleep( &mut self, config: &RtcSleepConfig, wake_sources: &[&dyn WakeSource], )

Enter sleep with the provided config and wake with the provided wake_sources.

Source

pub fn set_interrupt_handler(&mut self, handler: InterruptHandler)

Register an interrupt handler for the RTC.

Note that this will replace any previously registered interrupt handlers.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Trait Implementations§

Source§

impl InterruptConfigurable for Rtc<'_>

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

fn set_interrupt_handler(&mut self, handler: InterruptHandler)

Registers an interrupt handler for the peripheral. Read more

Auto Trait Implementations§

§

impl<'d> Freeze for Rtc<'d>

§

impl<'d> RefUnwindSafe for Rtc<'d>

§

impl<'d> Send for Rtc<'d>

§

impl<'d> Sync for Rtc<'d>

§

impl<'d> Unpin for Rtc<'d>

§

impl<'d> !UnwindSafe for Rtc<'d>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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.
§

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

Performs the conversion.