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: Rahix's avatarRahix <rahix@rahix.de>
parent 886443ac
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment