Rtc

Struct Rtc 

Source
pub struct Rtc { /* private fields */ }
Expand description

RTC Abstraction

Implementations§

Source§

impl Rtc

Source

pub const BACKUP_REGISTER_COUNT: usize = 20usize

Source

pub fn rtc( rtc: RTC, apb1r1: &mut APB1R1, bdcr: &mut BDCR, pwrcr1: &mut CR1, rtc_config: RtcConfig, ) -> Self

Source

pub fn get_date_time(&self) -> (Date, Time)

Get date and time touple

Source

pub fn set_date_time(&mut self, date: Date, time: Time)

Set Date and Time

Source

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

Set Time Note: If setting both time and date, use set_date_time(…) to avoid errors.

Source

pub fn set_date(&mut self, date: Date)

Set Date Note: If setting both time and date, use set_date_time(…) to avoid errors.

Source

pub fn get_config(&self) -> RtcConfig

Source

pub fn set_alarm(&mut self, alarm: Alarm, date: Date, time: Time)

Sets the time at which an alarm will be triggered This also clears the alarm flag if it is set

Source

pub fn listen(&mut self, exti: &mut EXTI, event: Event)

Starts listening for an interrupt event

Source

pub fn unlisten(&mut self, exti: &mut EXTI, event: Event)

Stops listening for an interrupt event

Source

pub fn check_interrupt(&mut self, event: Event, clear: bool) -> bool

Checks for an interrupt event

Source

pub fn set_config( &mut self, bdcr: &mut BDCR, pwrcr1: &mut CR1, rtc_config: RtcConfig, )

Applies the RTC config It this changes the RTC clock source the time will be reset

Source

pub fn wakeup_timer(&mut self) -> WakeupTimer<'_>

Access the wakeup timer

Source

pub fn read_backup_register(&self, register: usize) -> Option<u32>

Read content of the backup register.

The registers retain their values during wakes from standby mode or system resets. They also retain their value when Vdd is switched off as long as V_BAT is powered.

Source

pub fn write_backup_register(&self, register: usize, value: u32)

Set content of the backup register.

The registers retain their values during wakes from standby mode or system resets. They also retain their value when Vdd is switched off as long as V_BAT is powered.

Auto Trait Implementations§

§

impl Freeze for Rtc

§

impl RefUnwindSafe for Rtc

§

impl Send for Rtc

§

impl !Sync for Rtc

§

impl Unpin for Rtc

§

impl UnwindSafe for Rtc

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.