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)
84
84
RTCresetRemove ();
85
85
86
86
// 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 ) ) {
88
88
RTC->MODE2 .CLOCK .reg = oldTime.reg ;
89
89
}
90
90
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 );
92
95
}
93
96
while (RTCisSyncing ())
94
97
;
You can’t perform that action at this time.
0 commit comments