timers interrupt handler in STM32
1. In the firmware library function, the function used to read the value of the interrupt status register to determine the interrupt type is:
ITStatus TIM_GetITStatus(TIM_TypeDef* TIMx, uint16_t)
Function: Determine whether the interrupt type TIM_IT of the timer TIMx is interrupted.
For example, we want to determine whether an update (overflow) interrupt occurs in timer 3, the method is:
if(TIM_GetITStatus(TIM3, TIM_IT_Update) != RESET)
{ } 2. The function to clear the interrupt flag bit in the firmware library is: void TIM_ClearITPendingBit(TIM_TypeDef * TIMx, uint16_t TIM_IT) function: clear the interrupt TIM_IT flag bit of the timer TIMx. For example, after the overflow interrupt of TIM3 occurs, we need to clear the interrupt flag bit, the method is: TIM_ClearITPendingBit(TIM3, TIM_IT_Update); Note: The firmware library also provides two functions to judge the timer status and clear the timer status flag bit The functions TIM_GetFlagStatus and TIM_ClearFlag have similar functions to the previous two functions. It is only in the TIM_GetITStatus function that it will be judged whether the interrupt is enabled first, and then the interrupt flag will be judged after it is enabled, while TIM_GetFlagStatus is directly used to judge the status flag.