File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 26
26
27
27
voidFuncPtr RTC_callBack = NULL ;
28
28
29
+ RTCZero::RTCZero ()
30
+ {
31
+ _configured = false ;
32
+ }
33
+
29
34
void RTCZero::begin ()
30
35
{
31
36
uint16_t tmp_reg = 0 ;
@@ -72,6 +77,8 @@ void RTCZero::begin()
72
77
73
78
RTCenable ();
74
79
RTCresetRemove ();
80
+
81
+ _configured = true ;
75
82
}
76
83
77
84
void RTC_Handler (void )
@@ -369,9 +376,11 @@ void RTCZero::config32kOSC()
369
376
370
377
/* Synchronise the CLOCK register for reading*/
371
378
inline void RTCZero::RTCreadRequest () {
372
- RTC->MODE2 .READREQ .reg = RTC_READREQ_RREQ;
373
- while (RTCisSyncing ())
374
- ;
379
+ if (_configured) {
380
+ RTC->MODE2 .READREQ .reg = RTC_READREQ_RREQ;
381
+ while (RTCisSyncing ())
382
+ ;
383
+ }
375
384
}
376
385
377
386
/* Wait for sync in write operations */
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ class RTCZero {
38
38
MATCH_YYMMDDHHMMSS = RTC_MODE2_MASK_SEL_YYMMDDHHMMSS_Val // Once, on a specific date and a specific time
39
39
};
40
40
41
- RTCZero () {} ;
41
+ RTCZero ();
42
42
void begin ();
43
43
44
44
void enableAlarm (Alarm_Match match);
@@ -99,6 +99,8 @@ class RTCZero {
99
99
void setY2kEpoch (uint32_t ts);
100
100
101
101
private:
102
+ bool _configured;
103
+
102
104
void config32kOSC (void );
103
105
void RTCreadRequest ();
104
106
bool RTCisSyncing (void );
You can’t perform that action at this time.
0 commit comments