Struct embassy_stm32::rtc::Rtc
source · pub struct Rtc { /* private fields */ }
Expand description
RTC driver.
Implementations§
source§impl Rtc
impl Rtc
sourcepub fn calibrate(&mut self, clock_drift: f32, period: RtcCalibrationCyclePeriod)
pub fn calibrate(&mut self, clock_drift: f32, period: RtcCalibrationCyclePeriod)
Calibrate the clock drift.
clock_drift
can be adjusted from -487.1 ppm to 488.5 ppm and is clamped to this range.
Note
To perform a calibration when async_prescaler
is less then 3, sync_prescaler
has to be reduced accordingly (see RM0351 Rev 9, sec 38.3.12).
source§impl Rtc
impl Rtc
sourcepub fn new(_rtc: impl Peripheral<P = RTC>, rtc_config: RtcConfig) -> Self
pub fn new(_rtc: impl Peripheral<P = RTC>, rtc_config: RtcConfig) -> Self
Create a new RTC instance.
sourcepub const fn time_provider(&self) -> RtcTimeProvider
pub const fn time_provider(&self) -> RtcTimeProvider
Acquire a RtcTimeProvider
instance.
sourcepub fn set_datetime(&mut self, t: DateTime) -> Result<(), RtcError>
pub fn set_datetime(&mut self, t: DateTime) -> Result<(), RtcError>
Set the datetime to a new value.
Errors
Will return RtcError::InvalidDateTime
if the datetime is not a valid range.
sourcepub fn get_daylight_savings(&self) -> bool
pub fn get_daylight_savings(&self) -> bool
Check if daylight savings time is active.
sourcepub fn set_daylight_savings(&mut self, daylight_savings: bool)
pub fn set_daylight_savings(&mut self, daylight_savings: bool)
Enable/disable daylight savings time.
sourcepub const BACKUP_REGISTER_COUNT: usize = 20usize
pub const BACKUP_REGISTER_COUNT: usize = 20usize
Number of backup registers of this instance.
sourcepub fn read_backup_register(&self, register: usize) -> Option<u32>
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.
sourcepub fn write_backup_register(&self, register: usize, value: u32)
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.