Struct Rtc

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

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

Implementations§

Source§

impl<Mode: RtcMode> Rtc<Mode>

Source

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

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

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 Pm) -> Self

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

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: Into<Nanoseconds>>( &mut self, timeout: T, ) -> &Self

This resets the internal counter, sets the prescaler to match the provided timeout, and starts the counter. 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 Pm) -> Self

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 DelayNs for Rtc<Count32Mode>

Source§

fn delay_ns(&mut self, ns: u32)

Pauses execution for at minimum ns nanoseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

fn delay_us(&mut self, us: u32)

Pauses execution for at minimum us microseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

fn delay_ms(&mut self, ms: u32)

Pauses execution for at minimum ms milliseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
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 start<T>(&mut self, timeout: T)
where T: Into<Nanoseconds>,

Starts the timer and puts it in periodic mode in which the counter counts up to the specified timeout and then resets repeatedly back to zero.

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§

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

Wait for the timer to finish counting down without blocking.
Source§

impl CountDown for Rtc<Count32Mode>

Source§

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

Starts the timer and puts it in periodic mode in which the counter counts up to the specified timeout and then resets repeatedly back to zero.

Source§

type Time = Duration<u32, 1, 1000000000>

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