Skip to content
Snippets Groups Projects
Verified Commit 7d849b41 authored by rahix's avatar rahix
Browse files

fix(rtc): Trigger immediately if alarm is scheduled in the past


Signed-off-by: default avatarRahix <rahix@rahix.de>
parent 886443ac
No related branches found
No related tags found
No related merge requests found
Pipeline #2102 passed
......@@ -58,6 +58,15 @@ int epic_rtc_schedule_alarm(uint32_t timestamp)
{
int res;
/*
* Check if the timestamp lies in the past and if so, trigger
* immediately.
*/
if (epic_rtc_get_seconds() >= timestamp) {
api_interrupt_trigger(EPIC_INT_RTC_ALARM);
return 0;
}
NVIC_EnableIRQ(RTC_IRQn);
while ((res = RTC_SetTimeofdayAlarm(MXC_RTC, timestamp)) == E_BUSY)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment