RTC tests

This commit is contained in:
Imbus 2025-10-30 22:36:55 +01:00
parent 3e94e11212
commit 31ecdffa7e

View file

@ -83,16 +83,20 @@ void start() {
buddy_free(mem); buddy_free(mem);
} }
{ {
uint64_t time = rtc_time_read(); const uint64_t time = rtc_time_read();
time = rtc_time_read();
rtc_alarm_set(time + 3000000000); /* Set alarm and check that its correct */
uint64_t alrm = rtc_alarm_read(); rtc_alarm_set(time + MS_TO_NS(1000));
assert(alrm > time); const uint64_t alrm = rtc_alarm_read();
uint32_t astatus = rtc_alarm_status(); assert(alrm == time + MS_TO_NS(1000));
assert(astatus == 0);
rtc_alarm_enable(); /* Should be one provided alarm is not elapsed */
astatus = rtc_alarm_status(); assert(rtc_alarm_status() == 1);
assert(astatus == 1); rtc_alarm_clear();
assert(rtc_alarm_status() == 0);
/* Time should have passed */
assert(time != rtc_time_read());
} }
{ {
uint64_t rn = badrand(); uint64_t rn = badrand();