Merge pull request #2953 from wuhanstudio/pwm-clock-enable

[stm32][driver] pwm enable clock
This commit is contained in:
Bernard Xiong 2019-08-19 16:47:19 +08:00 committed by GitHub
commit ccf80cc2f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -322,6 +322,14 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device)
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4)
tim->Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
#endif
if (HAL_TIM_PWM_Init(tim) != HAL_OK)
{
LOG_E("%s pwm init failed", device->name);
result = -RT_ERROR;
goto __exit;
}
if (HAL_TIM_Base_Init(tim) != HAL_OK)
{
LOG_E("%s time base init failed", device->name);
@ -337,13 +345,6 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device)
goto __exit;
}
if (HAL_TIM_PWM_Init(tim) != HAL_OK)
{
LOG_E("%s pwm init failed", device->name);
result = -RT_ERROR;
goto __exit;
}
master_config.MasterOutputTrigger = TIM_TRGO_RESET;
master_config.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
if (HAL_TIMEx_MasterConfigSynchronization(tim, &master_config) != HAL_OK)