void isr_rtc(void) { if (RTC->MODE2.INTFLAG.bit.ALARM0) { rtc_callback.cb(rtc_callback.arg); /* clear flag */ RTC->MODE2.INTFLAG.reg |= RTC_MODE2_INTFLAG_ALARM0; } if (RTC->MODE2.INTFLAG.bit.OVF) { /* clear flag */ RTC->MODE2.INTFLAG.reg |= RTC_MODE2_INTFLAG_OVF; /* At 1Hz, RTC goes till 63 years (2^5, see 17.8.22 in datasheet) * Start RTC again with reference_year 64 years more (Be careful with alarm set) */ reference_year += 64; } cortexm_isr_end(); }
void isr_rtc(void) { RtcMode2 *rtcMode2 = &(RTC_DEV); uint16_t status = rtcMode2->INTFLAG.reg; if ((status & RTC_MODE2_INTFLAG_ALARM0) && (rtc_callback.cb != NULL)) { rtc_callback.cb(rtc_callback.arg); rtcMode2->INTFLAG.reg = RTC_MODE2_INTFLAG_ALARM0; } if (status & RTC_MODE2_INTFLAG_OVF) { /* At 1Hz, RTC goes till 63 years (2^5, see 17.8.22 in datasheet) * Start RTC again with reference_year 64 years more (Be careful with alarm set) */ reference_year += 64; rtcMode2->INTFLAG.reg = RTC_MODE2_INTFLAG_OVF; } cortexm_isr_end(); }
void isr_rtc(void) { RtcMode2 *rtcMode2 = &(RTC_DEV); uint16_t status = rtcMode2->INTFLAG.reg; if (status & RTC_MODE2_INTFLAG_ALARM0) { rtc_callback.cb(rtc_callback.arg); rtcMode2->INTFLAG.reg = RTC_MODE2_INTFLAG_ALARM0; } if (status & RTC_MODE2_INTFLAG_OVF) { /* At 1Hz, RTC goes till 63 years (2^5, see 17.8.22 in datasheet) * Start RTC again with reference_year 64 years more (Be careful with alarm set) */ reference_year += 64; rtcMode2->INTFLAG.reg = RTC_MODE2_INTFLAG_OVF; } if (sched_context_switch_request) { thread_yield(); } }
static void rtc_cb(void* arg) { if (rtc_callback.cb != NULL) { rtc_callback.cb(arg); } }