/** * @brief Check whether the specified LPTIM interrupt has occurred or not. * @param LPTIMx: where x can be 1. * @param LPTIM_IT: specifies the LPTIM interrupt source to check. * @arg LPTIM_IT_DOWN: Counter direction change up to down Interrupt source * @arg LPTIM_IT_UP: Counter direction change down to up Interrupt source * @arg LPTIM_IT_ARROK: Autoreload register update OK Interrupt source * @arg LPTIM_IT_CMPOK: Compare register update OK Interrupt source * @arg LPTIM_IT_EXTTRIG: External trigger edge event Interrupt source * @arg LPTIM_IT_ARRM: Autoreload match Interrupt source * @arg LPTIM_IT_CMPM: Compare match Interrupt source * @retval The new state of LPTIM_IT (SET or RESET). */ ITStatus LPTIM_GetITStatus(LPTIM_TypeDef* LPTIMx, uint32_t LPTIM_IT) { ITStatus bitstatus = RESET; uint32_t itstatus = 0x0, itenable = 0x0; /* Check the parameters */ assert_param(IS_LPTIM_ALL_PERIPH(LPTIMx)); assert_param(IS_LPTIM_IT(LPTIM_IT)); /* Get the Interrupt Status bit value */ itstatus = LPTIMx->ISR & LPTIM_IT; /* Check if the Interrupt is enabled */ itenable = LPTIMx->IER & LPTIM_IT; if((itstatus != RESET) && (itenable != RESET)) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
/** * @brief Checks whether the specified LPTIM interrupt has occurred or not. * @param hperh: Pointer to a lptim_handle_t structure that contains * the configuration information for the specified LPTIM module. * @param it: Specifies the LPTIM interrupt source to check. * This parameter can be one of the @ref lptim_it_t. * @retval Status * - SET * - RESET */ it_status_t lptim_get_it_status(lptim_handle_t *hperh, lptim_it_t it) { assert_param(IS_LPTIM(hperh->perh)); assert_param(IS_LPTIM_IT(it)); if (READ_BIT(hperh->perh->IER, it)) return SET; return RESET; }
/** * @brief Enables or disables the specified LPTIM interrupts. * @param hperh: Pointer to a lptim_handle_t structure that contains * the configuration information for the specified LPTIM module. * @param it: Specifies the SPI interrupt sources to be enabled or disabled. * This parameter can be one of the @ref lptim_it_t. * @param state: New status * - ENABLE * - DISABLE * @retval None */ void lptim_interrupt_config(lptim_handle_t *hperh, lptim_it_t it, type_func_t state) { assert_param(IS_LPTIM(hperh->perh)); assert_param(IS_LPTIM_IT(it)); assert_param(IS_FUNC_STATE(state)); if (state == ENABLE) SET_BIT(hperh->perh->IER, (uint32_t)it); else CLEAR_BIT(hperh->perh->IER, (uint32_t)it); return; }
/** * @brief Enables or disables the specified LPTIM interrupts. * @param LPTIMx: where x can be 1. * @param LPTIM_IT: specifies the TIM interrupts sources to be enabled or disabled. * This parameter can be any combination of the following values: * @arg LPTIM_IT_DOWN: Counter direction change up to down Interrupt source * @arg LPTIM_IT_UP: Counter direction change down to up Interrupt source * @arg LPTIM_IT_ARROK: Autoreload register update OK Interrupt source * @arg LPTIM_IT_CMPOK: Compare register update OK Interrupt source * @arg LPTIM_IT_EXTTRIG: External trigger edge event Interrupt source * @arg LPTIM_IT_ARRM: Autoreload match Interrupt source * @arg LPTIM_IT_CMPM: Compare match Interrupt source * @note LPTIM_IT_DOWN is available only for LPTIM1. * @note LPTIM_IT_UP is available only for LPTIM1. * @param NewState: new state of the TIM interrupts. * This parameter can be: ENABLE or DISABLE. * @retval None * * @note It is mandatory to disable the peripheral to use this function. */ void LPTIM_ITConfig(LPTIM_TypeDef* LPTIMx, uint32_t LPTIM_IT, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_LPTIM_ALL_PERIPH(LPTIMx)); assert_param(IS_LPTIM_IT(LPTIM_IT)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if(NewState != DISABLE) { /* Enable the Interrupt sources */ LPTIMx->IER |= LPTIM_IT; } else { /* Disable the Interrupt sources */ LPTIMx->IER &= ~(LPTIM_IT); } }