File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 24
24
#define EPOCH_TIME_OFF 946684800 // This is 1st January 2000, 00:00:00 in epoch time
25
25
#define EPOCH_TIME_YEAR_OFF 100 // years since 1900
26
26
27
+ // Default date & time after reset
28
+ #define DEFAULT_YEAR 2000 // 2000..2063
29
+ #define DEFAULT_MONTH 1 // 1..12
30
+ #define DEFAULT_DAY 1 // 1..31
31
+ #define DEFAULT_HOUR 0 // 1..23
32
+ #define DEFAULT_MINUTE 0 // 0..59
33
+ #define DEFAULT_SECOND 0 // 0..59
34
+
27
35
voidFuncPtr RTC_callBack = NULL ;
28
36
29
37
RTCZero::RTCZero ()
@@ -88,10 +96,9 @@ void RTCZero::begin(bool resetTime)
88
96
RTC->MODE2 .CLOCK .reg = oldTime.reg ;
89
97
}
90
98
else {
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 );
99
+ RTC->MODE2 .CLOCK .reg = RTC_MODE2_CLOCK_YEAR (DEFAULT_YEAR - 2000 ) | RTC_MODE2_CLOCK_MONTH (DEFAULT_MONTH)
100
+ | RTC_MODE2_CLOCK_DAY (DEFAULT_DAY) | RTC_MODE2_CLOCK_HOUR (DEFAULT_HOUR)
101
+ | RTC_MODE2_CLOCK_MINUTE (DEFAULT_MINUTE) | RTC_MODE2_CLOCK_SECOND (DEFAULT_SECOND);
95
102
}
96
103
while (RTCisSyncing ())
97
104
;
You can’t perform that action at this time.
0 commit comments