We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bf2ded1 commit 31aa7faCopy full SHA for 31aa7fa
src/rtc.rs
@@ -194,6 +194,22 @@ impl Rtc {
194
rtc_struct
195
}
196
197
+ /// Check if the RTC has been initialized, i.e. if a date and time have been set.
198
+ pub fn initialized(&self) -> bool {
199
+ self.rtc.isr.read().inits().bit_is_set()
200
+ }
201
+
202
+ /// Wait for the calendar registers to be synchronized with the shadow registers.
203
+ ///
204
+ /// This must be called after a system reset or after waking up from low-power mode.
205
+ pub fn wait_for_sync(&self) {
206
+ self.rtc.isr.modify(|r, w| {
207
+ w.rsf().clear_bit()
208
+ });
209
210
+ while self.rtc.isr.read().rsf().bit_is_clear() {}
211
212
213
/// Set date and time.
214
pub fn set_datetime(&mut self, datetime: &PrimitiveDateTime) {
215
self.write(true, |rtc| {
0 commit comments