Skip to content

Commit

Permalink
Implement no RTC check
Browse files Browse the repository at this point in the history
  • Loading branch information
Lorenzooone authored and felixjones committed Nov 29, 2023
1 parent e4a670f commit 3076bf6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions source/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
/* Init results */
#define INIT_OK (0x00)
#define INIT_EPOWER (0x01)
#define INIT_E12HOUR (0x02)
#define INIT_ENORTC (0x02)

// Mask out data not needed from date and time
#define PM_TIME_FLAG ((unsigned int)0x00000080)
Expand Down Expand Up @@ -255,9 +255,12 @@ int __agbabi_rtc_init(void) {
rtc_set_status_24hr();
}

const unsigned int time = __agbabi_rtc_time();
const __agbabi_datetime_t datetime = __agbabi_rtc_datetime();

if(unlikely(datetime[0] == 0))
return INIT_ENORTC;

if (time & TM_TEST) {
if (datetime[1] & TM_TEST) {
rtc_reset(); /* Reset to leave test mode */
rtc_set_status_24hr();
}
Expand Down

0 comments on commit 3076bf6

Please sign in to comment.