File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -84,11 +84,14 @@ void RTCZero::begin(bool resetTime)
8484 RTCresetRemove ();
8585
8686 // If desired and valid, restore the time value, else use first valid time value
87- if ((!resetTime) && (validTime)) {
87+ if ((!resetTime) && (validTime) && (oldTime. reg != 0L ) ) {
8888 RTC->MODE2 .CLOCK .reg = oldTime.reg ;
8989 }
9090 else {
91- RTC->MODE2 .CLOCK .reg = RTC_MODE2_CLOCK_MONTH (1 ) | RTC_MODE2_CLOCK_DAY (1 );
91+ // Change the values here to set a default date and time
92+ // Use calendar year-2000, month and day values cannot be 0
93+ RTC->MODE2 .CLOCK .reg = RTC_MODE2_CLOCK_YEAR (0 ) | RTC_MODE2_CLOCK_MONTH (1 ) | RTC_MODE2_CLOCK_DAY (1 )
94+ | RTC_MODE2_CLOCK_HOUR (0 ) | RTC_MODE2_CLOCK_MINUTE (0 ) | RTC_MODE2_CLOCK_SECOND (0 );
9295 }
9396 while (RTCisSyncing ())
9497 ;
You can’t perform that action at this time.
0 commit comments