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 const BACKUP_REGISTER_COUNT: usize = 32usize
pub const BACKUP_REGISTER_COUNT: usize = 32usize
Number of backup registers of this instance.
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 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.