pub struct Rtc { /* private fields */ }rtc only.Expand description
Real Time Clock peripheral
Implementations§
Source§impl Rtc
impl Rtc
Sourcepub fn new(
rtc: RTC,
prediv_s: u16,
prediv_a: u8,
bypass: bool,
apb1: &mut APB1,
bdcr: &mut BDCR,
pwr: &mut PWR,
) -> Self
pub fn new( rtc: RTC, prediv_s: u16, prediv_a: u8, bypass: bool, apb1: &mut APB1, bdcr: &mut BDCR, pwr: &mut PWR, ) -> Self
Create and enable a new RTC, and configure its clock source and prescalers.
From AN4759, Table 7, when using the LSE (The only clock source this module
supports currently), set prediv_s to 255, and prediv_a to 127 to get a
calendar clock of 1Hz.
The bypass argument is true if you’re using an external oscillator that
doesn’t connect to OSC32_IN, such as a MEMS resonator.
Sourcepub fn set_24h_fmt(&mut self)
pub fn set_24h_fmt(&mut self)
Sets calendar clock to 24 hr format
Sourcepub fn set_12h_fmt(&mut self)
pub fn set_12h_fmt(&mut self)
Sets calendar clock to 12 hr format
Sourcepub fn is_24h_fmt(&self) -> bool
pub fn is_24h_fmt(&self) -> bool
Reads current hour format selection
Sourcepub unsafe fn peripheral(&mut self) -> &mut RTC
pub unsafe fn peripheral(&mut self) -> &mut RTC
Get access to the underlying register block.
§Safety
This function is not memory unsafe per se, but does not guarantee anything about assumptions of invariants made in this implementation.
Changing specific options can lead to un-expected behavior and nothing is guaranteed.
Trait Implementations§
Source§impl DateTimeAccess for Rtc
impl DateTimeAccess for Rtc
Source§impl Rtcc for Rtc
impl Rtcc for Rtc
Source§fn set_time(&mut self, time: &NaiveTime) -> Result<(), Self::Error>
fn set_time(&mut self, time: &NaiveTime) -> Result<(), Self::Error>
Set time using NaiveTime (ISO 8601 time without timezone)
Hour format is 24h