/** * @brief Starts the LPTIM Output pwm. * @param hperh: LPTIM handle * @retval None */ void lptim_pwm_start(lptim_handle_t *hperh) { assert_param(IS_LPTIM(hperh->perh)); assert_param(IS_LPTIM_MODE(hperh->init.mode)); LPTIM_ENABLE(hperh); while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); if (hperh->init.mode == LPTIM_MODE_CONTINUOUS) LPTIM_CNTSTART(hperh); else LPTIM_SNGSTART(hperh); while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); return; }
/** * @brief Starts the LPTIM Output pulse in interrupt mode. * @param hperh: LPTIM handle * @retval None */ void lptim_pulse_start_by_it(lptim_handle_t *hperh) { assert_param(IS_LPTIM(hperh->perh)); assert_param(IS_LPTIM_MODE(hperh->init.mode)); lptim_interrupt_config(hperh, LPTIM_IT_ARRMAT, ENABLE); LPTIM_ENABLE(hperh); while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); if (hperh->init.mode == LPTIM_MODE_CONTINUOUS) LPTIM_CNTSTART(hperh); else LPTIM_SNGSTART(hperh); while (READ_BIT(hperh->perh->SYNCSTAT, LP16T_SYNCSTAT_CON1WBSY_MSK)); return; }
/** * @brief Selects an operating mode. * @param LPTIMx: where x can be 1. * @param LPTIM_Mode: the selected mode. * This parameter can be: * @arg LPTIM_Mode_Continuous : Timer starts in Continuous mode * @arg LPTIM_Mode_Single : Timer will starts in Single mode * @retval None */ void LPTIM_SelectOperatingMode(LPTIM_TypeDef* LPTIMx, uint32_t LPTIM_Mode) { /* Check the parameters */ assert_param(IS_LPTIM_ALL_PERIPH(LPTIMx)); assert_param(IS_LPTIM_MODE(LPTIM_Mode)); if(LPTIM_Mode == LPTIM_Mode_Continuous) { /* Set the CNTSTRT to select the continuous start*/ LPTIMx->CR |= LPTIM_Mode_Continuous; } else if(LPTIM_Mode == LPTIM_Mode_Single) { /* Set the SNGSTRT to select the continuous start*/ LPTIMx->CR |= LPTIM_Mode_Single; } }