/******************************************************************************* * Function Name : TIM_GetFlagStatus * Description : Checks whether the specified TIM flag is set or not. * Input : - TIMx: where x can be 1 to 8 to select the TIM peripheral. * - TIM_FLAG: specifies the flag to check. * This parameter can be one of the following values: * - TIM_FLAG_Update: TIM update Flag * - TIM_FLAG_CC1: TIM Capture Compare 1 Flag * - TIM_FLAG_CC2: TIM Capture Compare 2 Flag * - TIM_FLAG_CC3: TIM Capture Compare 3 Flag * - TIM_FLAG_CC4: TIM Capture Compare 4 Flag * - TIM_FLAG_COM: TIM Commutation Flag * - TIM_FLAG_Trigger: TIM Trigger Flag * - TIM_FLAG_Break: TIM Break Flag * - TIM_FLAG_CC1OF: TIM Capture Compare 1 overcapture Flag * - TIM_FLAG_CC2OF: TIM Capture Compare 2 overcapture Flag * - TIM_FLAG_CC3OF: TIM Capture Compare 3 overcapture Flag * - TIM_FLAG_CC4OF: TIM Capture Compare 4 overcapture Flag * Output : None * Return : The new state of TIM_FLAG (SET or RESET). *******************************************************************************/ FlagStatus TIM_GetFlagStatus(TIM_TypeDef* TIMx, u16 TIM_FLAG) { ITStatus bitstatus = RESET;
/* Check the parameters */ assert_param(IS_TIM_ALL_PERIPH(TIMx)); assert_param(IS_TIM_GET_FLAG(TIM_FLAG)); assert_param(IS_TIM_PERIPH_FLAG(TIMx, TIM_FLAG)); if ((TIMx->SR & TIM_FLAG) != (u16)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; } |