/** * @brief RTC interrupt handler * @return Nothing */ void RTC_IRQHandler(void) { uint32_t sec; /* Toggle heart beat LED for each second field change interrupt */ if (Chip_RTC_GetIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE)) { /* Clear pending interrupt */ Chip_RTC_ClearIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE); On0 = (bool) !On0; Board_LED_Set(0, On0); } /* display timestamp every 5 seconds in the background */ sec = Chip_RTC_GetTime(LPC_RTC, RTC_TIMETYPE_SECOND); if (!(sec % 5)) { fIntervalReached = true; /* set flag for background */ } /* Check for alarm match */ if (Chip_RTC_GetIntPending(LPC_RTC, RTC_INT_ALARM)) { /* Clear pending interrupt */ Chip_RTC_ClearIntPending(LPC_RTC, RTC_INT_ALARM); fAlarmTimeMatched = true; /* set alarm handler flag */ } }
// Alarm void RTC_IRQHandler (void) { if(Chip_RTC_GetIntPending(LPC_RTC,RTC_INT_ALARM)==1) { if(rtcCallback!=NULL) rtcCallback(rtcCallbackArg); Chip_RTC_ClearIntPending(LPC_RTC, RTC_INT_ALARM); } else Chip_RTC_ClearIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE); }
/** * @brief Event router interrupt handler * @return Nothing */ void EVRT_IRQHandler(void) { if (Chip_EVRT_IsSourceInterrupting(EVRT_SRC_WAKEUP0)) { Chip_EVRT_ClrPendIntSrc(EVRT_SRC_WAKEUP0); NVIC_DisableIRQ(EVENTROUTER_IRQn); } if (Chip_EVRT_IsSourceInterrupting(EVRT_SRC_RTC)) { if (Chip_RTC_GetIntPending(LPC_RTC, RTC_INT_ALARM)) { Chip_RTC_ClearIntPending(LPC_RTC, RTC_INT_ALARM); Chip_EVRT_ClrPendIntSrc(EVRT_SRC_RTC); Chip_RTC_Enable(LPC_RTC, DISABLE); NVIC_DisableIRQ(EVENTROUTER_IRQn); } } }