/*********************************************************************//** * @brief Clear Interrupt pending * @param[in] TIMx Timer selection, should be LPC_TMR16B0, * LPC_TMR16B1, LPC_TMR32B0, LPC_TMR32B1 * @param[in] IntFlag should be in TIM_INT_TYPE enum * @return None **********************************************************************/ void TIM_ClearIntPending(TMR_TypeDef *TIMx, uint8_t IntFlag) { CHECK_PARAM(PARAM_TIMx(TIMx)); CHECK_PARAM(PARAM_TIM_INT_TYPE(IntFlag)); TIMx->IR = TIM_IR_CLR(IntFlag) ; }
/*********************************************************************//** * @brief Get Interrupt Status * @param[in] TIMx Timer selection, should be: * - LPC_TIM0: TIMER0 peripheral * - LPC_TIM1: TIMER1 peripheral * - LPC_TIM2: TIMER2 peripheral * - LPC_TIM3: TIMER3 peripheral * @param[in] IntFlag Interrupt type, should be: * - TIM_MR0_INT: Interrupt for Match channel 0 * - TIM_MR1_INT: Interrupt for Match channel 1 * - TIM_MR2_INT: Interrupt for Match channel 2 * - TIM_MR3_INT: Interrupt for Match channel 3 * - TIM_CR0_INT: Interrupt for Capture channel 0 * - TIM_CR1_INT: Interrupt for Capture channel 1 * @return Flag Status for required interrupt * - SET : interrupt * - RESET : no interrupt **********************************************************************/ FlagStatus TIM_GetIntStatus(LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag) { uint8_t temp; temp = (TIMx->IR) & TIM_IR_CLR(IntFlag); if (temp) return SET; return RESET; }
/*********************************************************************//** * @brief Get Interrupt Status * @param[in] TIMx Timer selection, should be TIM0, TIM1, TIM2, TIM3 * @param[in] IntFlag * @return FlagStatus * - SET : interrupt * - RESET : no interrupt **********************************************************************/ FlagStatus TIM_GetIntStatus(LPC_TIM_TypeDef *TIMx, uint8_t IntFlag) { CHECK_PARAM(PARAM_TIMx(TIMx)); CHECK_PARAM(PARAM_TIM_INT_TYPE(IntFlag)); uint8_t temp = (TIMx->IR)& TIM_IR_CLR(IntFlag); if (temp) return SET; return RESET; }
/*********************************************************************//** * @brief Get Interrupt Status * @param[in] TIMx Timer selection, should be LPC_TMR16B0, * LPC_TMR16B1, LPC_TMR32B0, LPC_TMR32B1 * @param[in] IntFlag * @return FlagStatus * - SET : interrupt * - RESET : no interrupt **********************************************************************/ FlagStatus TIM_GetIntStatus(TMR_TypeDef *TIMx, uint8_t IntFlag) { CHECK_PARAM(PARAM_TIMx(TIMx)); CHECK_PARAM(PARAM_TIM_INT_TYPE(IntFlag)); if ((TIMx->IR)& TIM_IR_CLR(IntFlag)) { return SET; } return RESET; }
/*********************************************************************//** * @brief Get Interrupt Status * @param[in] TIMx Timer selection, should be: * - LPC_TIM0: TIMER0 peripheral * - LPC_TIM1: TIMER1 peripheral * - LPC_TIM2: TIMER2 peripheral * - LPC_TIM3: TIMER3 peripheral * @param[in] IntFlag: interrupt type, should be: * - TIM_MR0_INT: Interrupt for Match channel 0 * - TIM_MR1_INT: Interrupt for Match channel 1 * - TIM_MR2_INT: Interrupt for Match channel 2 * - TIM_MR3_INT: Interrupt for Match channel 3 * - TIM_CR0_INT: Interrupt for Capture channel 0 * - TIM_CR1_INT: Interrupt for Capture channel 1 * @return FlagStatus * - SET : interrupt * - RESET : no interrupt **********************************************************************/ FlagStatus TIM_GetIntStatus(LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag) { uint8_t temp; CHECK_PARAM(PARAM_TIMx(TIMx)); CHECK_PARAM(PARAM_TIM_INT_TYPE(IntFlag)); temp = (TIMx->IR)& TIM_IR_CLR(IntFlag); if (temp) return (SET); return (RESET); }
/*********************************************************************//** * @brief Clear Interrupt pending * @param[in] TIMx Timer selection, should be: * - LPC_TIM0: TIMER0 peripheral * - LPC_TIM1: TIMER1 peripheral * - LPC_TIM2: TIMER2 peripheral * - LPC_TIM3: TIMER3 peripheral * @param[in] IntFlag: interrupt type, should be: * - TIM_MR0_INT: Interrupt for Match channel 0 * - TIM_MR1_INT: Interrupt for Match channel 1 * - TIM_MR2_INT: Interrupt for Match channel 2 * - TIM_MR3_INT: Interrupt for Match channel 3 * - TIM_CR0_INT: Interrupt for Capture channel 0 * - TIM_CR1_INT: Interrupt for Capture channel 1 * @return None **********************************************************************/ void TIM_ClearIntPending(LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag) { TIMx->IR = TIM_IR_CLR(IntFlag); }
/*********************************************************************//** * @brief Clear Interrupt pending * @param[in] TIMx Timer selection, should be: * - LPC_TIM0: TIMER0 peripheral * - LPC_TIM1: TIMER1 peripheral * - LPC_TIM2: TIMER2 peripheral * - LPC_TIM3: TIMER3 peripheral * @param[in] IntFlag: interrupt type, should be: * - TIM_MR0_INT: Interrupt for Match channel 0 * - TIM_MR1_INT: Interrupt for Match channel 1 * - TIM_MR2_INT: Interrupt for Match channel 2 * - TIM_MR3_INT: Interrupt for Match channel 3 * - TIM_CR0_INT: Interrupt for Capture channel 0 * - TIM_CR1_INT: Interrupt for Capture channel 1 * @return None **********************************************************************/ void TIM_ClearIntPending(LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag) { CHECK_PARAM(PARAM_TIMx(TIMx)); CHECK_PARAM(PARAM_TIM_INT_TYPE(IntFlag)); TIMx->IR |= TIM_IR_CLR(IntFlag); }