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 2424#define EPOCH_TIME_OFF 946684800 // This is 1st January 2000, 00:00:00 in epoch time
2525#define EPOCH_TIME_YEAR_OFF 100 // years since 1900
2626
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+
2735voidFuncPtr RTC_callBack = NULL ;
2836
2937RTCZero::RTCZero ()
@@ -88,10 +96,9 @@ void RTCZero::begin(bool resetTime)
8896 RTC->MODE2 .CLOCK .reg = oldTime.reg ;
8997 }
9098 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);
95102 }
96103 while (RTCisSyncing ())
97104 ;
You can’t perform that action at this time.
0 commit comments