Skip to content

Commit 74ff822

Browse files
committed
teensy4/startup: Put default time into a const variable
1 parent b1ce3b1 commit 74ff822

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

teensy4/startup.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,11 @@ static void ResetHandler2(void)
231231
PIT_TCTRL3 = 0;
232232

233233
// initialize RTC
234+
const uint32_t default_time = 1546300800; // Jan 1, 2019 UTC
234235
if (!(SNVS_LPCR & SNVS_LPCR_SRTC_ENV)) {
235-
// if SRTC isn't running, start it with default Jan 1, 2019
236-
SNVS_LPSRTCLR = 1546300800u << 15;
237-
SNVS_LPSRTCMR = 1546300800u >> 17;
236+
// if SRTC isn't running, start it with the default time
237+
SNVS_LPSRTCLR = default_time << 15;
238+
SNVS_LPSRTCMR = default_time >> 17;
238239
SNVS_LPCR |= SNVS_LPCR_SRTC_ENV;
239240
}
240241
SNVS_HPCR |= SNVS_HPCR_RTC_EN | SNVS_HPCR_HP_TS;

0 commit comments

Comments
 (0)