Struct Rtc

Source
pub struct Rtc<Mode>
where Mode: RtcMode,
{ /* private fields */ }
Expand description

Rtc represents the RTC peripheral for either clock/calendar or timer mode.

Implementations§

Source§

impl<Mode> Rtc<Mode>
where Mode: RtcMode,

Source

pub fn into_count32_mode(self) -> Rtc<Count32Mode>

Reonfigures the peripheral for 32bit counter mode.

Source

pub fn into_clock_mode(self) -> Rtc<ClockMode>

Reconfigures the peripheral for clock/calendar mode. Requires the source clock to be running at 1024 Hz.

Source

pub fn free(self) -> RTC

Releases the RTC resource

Source§

impl Rtc<Count32Mode>

Source

pub fn count32_mode( rtc: RTC, rtc_clock_freq: Hertz, pm: &mut MCLK, ) -> Rtc<Count32Mode>

Configures the RTC in 32-bit counter mode with no prescaler (default state after reset) and the counter initialized to zero.

Source

pub fn count32(&self) -> u32

Returns the internal counter value.

Source

pub fn set_count32(&mut self, count: u32)

Sets the internal counter value.

Source

pub fn reset_and_compute_prescaler<T>( &mut self, timeout: T, ) -> &Rtc<Count32Mode>
where T: Into<<Rtc<Count32Mode> as CountDown>::Time>,

This resets the internal counter and sets the prescaler to match the provided timeout. You should configure the prescaler using the longest timeout you plan to measure.

Source§

impl Rtc<ClockMode>

Source

pub fn clock_mode( rtc: RTC, rtc_clock_freq: Hertz, pm: &mut MCLK, ) -> Rtc<ClockMode>

Source

pub fn current_time(&self) -> Datetime

Returns the current clock/calendar value.

Source

pub fn set_time(&mut self, time: Datetime)

Updates the current clock/calendar value.

Trait Implementations§

Source§

impl InterruptDrivenTimer for Rtc<Count32Mode>

Source§

fn enable_interrupt(&mut self)

Enable the interrupt generation for this hardware timer. This method only sets the clock configuration to trigger the interrupt; it does not configure the interrupt controller or define an interrupt handler.

Source§

fn disable_interrupt(&mut self)

Disables interrupt generation for this hardware timer. This method only sets the clock configuration to prevent triggering the interrupt; it does not configure the interrupt controller.

Source§

impl CountDown for Rtc<Count32Mode>

Source§

type Time = Nanoseconds

The unit of time used by this timer
Source§

fn start<T>(&mut self, timeout: T)
where T: Into<<Rtc<Count32Mode> as CountDown>::Time>,

Starts a new count down
Source§

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

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

impl Periodic for Rtc<Count32Mode>

Auto Trait Implementations§

§

impl<Mode> Freeze for Rtc<Mode>

§

impl<Mode> RefUnwindSafe for Rtc<Mode>
where Mode: RefUnwindSafe,

§

impl<Mode> Send for Rtc<Mode>
where Mode: Send,

§

impl<Mode> !Sync for Rtc<Mode>

§

impl<Mode> Unpin for Rtc<Mode>
where Mode: Unpin,

§

impl<Mode> UnwindSafe for Rtc<Mode>
where Mode: UnwindSafe,

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> Same for T

Source§

type Output = T

Should always be Self
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.