void TIMER_ISR(void) { if (TIM_GetITStatus(TIMER_TIM, TIM_IT_CC1) != RESET) { TIMER_TIM->SR = (uint16_t)~TIM_IT_CC1; // Disable the Interrupt TIMER_TIM->DIER &= (uint16_t)~TIM_IT_CC1; timerData.alarm1Callback(timerData.alarm1Parameter); } else if (TIM_GetITStatus(TIMER_TIM, TIM_IT_CC2) != RESET) { TIMER_TIM->SR = (uint16_t)~TIM_IT_CC2; // Disable the Interrupt TIMER_TIM->DIER &= (uint16_t)~TIM_IT_CC2; timerData.alarm2Callback(timerData.alarm2Parameter); } else if (TIM_GetITStatus(TIMER_TIM, TIM_IT_CC3) != RESET) { TIMER_TIM->SR = (uint16_t)~TIM_IT_CC3; // Disable the Interrupt TIMER_TIM->DIER &= (uint16_t)~TIM_IT_CC3; timerData.alarm3Callback(timerData.alarm3Parameter); } // CC4 is used for RTC calibration at startup else if (TIM_GetITStatus(TIMER_TIM, TIM_IT_CC4) != RESET) { // Get the Input Capture value rtcData.captureLSI[rtcData.captureNumber++] = TIM_GetCapture4(TIM5); // Clear CC4 Interrupt pending bit TIM_ClearITPendingBit(TIM5, TIM_IT_CC4); } }
void TIMER_ISR(void) { uint16_t itEnable = TIMER_TIM->DIER; uint16_t itStatus = TIMER_TIM->SR; if ((itEnable & TIM_IT_CC1) != RESET && (itStatus & TIM_IT_CC1) != RESET) { TIMER_TIM->SR = (uint16_t)~TIM_IT_CC1; // Disable the Interrupt TIMER_TIM->DIER &= (uint16_t)~TIM_IT_CC1; timerData.alarm1Callback(timerData.alarm1Parameter); } else if ((itEnable & TIM_IT_CC2) != RESET && (itStatus & TIM_IT_CC2) != RESET) { TIMER_TIM->SR = (uint16_t)~TIM_IT_CC2; // Disable the Interrupt TIMER_TIM->DIER &= (uint16_t)~TIM_IT_CC2; timerData.alarm2Callback(timerData.alarm2Parameter); } else if ((itEnable & TIM_IT_CC3) != RESET && (itStatus & TIM_IT_CC3) != RESET) { TIMER_TIM->SR = (uint16_t)~TIM_IT_CC3; // Disable the Interrupt TIMER_TIM->DIER &= (uint16_t)~TIM_IT_CC3; timerData.alarm3Callback(timerData.alarm3Parameter); } // CC4 is used for RTC calibration at startup else if ((itEnable & TIM_IT_CC4) != RESET && (itStatus & TIM_IT_CC4) != RESET) { TIMER_TIM->SR = (uint16_t)~TIM_IT_CC4; if (timerData.alarm4Callback) { // Disable the Interrupt TIMER_TIM->DIER &= (uint16_t)~TIM_IT_CC4; timerData.alarm4Callback(timerData.alarm4Parameter); } else { // Get the Input Capture value rtcData.captureLSI[rtcData.captureNumber++] = TIM_GetCapture4(TIMER_TIM); } } }