File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -194,6 +194,22 @@ impl Rtc {
194
194
rtc_struct
195
195
}
196
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
+
197
213
/// Set date and time.
198
214
pub fn set_datetime ( & mut self , datetime : & PrimitiveDateTime ) {
199
215
self . write ( true , |rtc| {
You can’t perform that action at this time.
0 commit comments