Struct sodaq_sara_aff::rtc::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 PM ) -> 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 PM ) -> 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 CountDown for Rtc<Count32Mode>

§

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

Auto Trait Implementations§

§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.