4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-02-28 01:17:07 +08:00

添加判断当前使用定时器是否可配置为主从定时器模式

This commit is contained in:
wdfk-prog 2022-11-26 17:56:16 +08:00 committed by Man, Jianting (Meco)
parent f54f2c2c91
commit db3e261bc4

View File

@ -402,6 +402,8 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device)
goto __exit;
}
if(IS_TIM_MASTER_INSTANCE(tim->Instance))
{
master_config.MasterOutputTrigger = TIM_TRGO_RESET;
master_config.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
if (HAL_TIMEx_MasterConfigSynchronization(tim, &master_config) != HAL_OK)
@ -410,6 +412,7 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device)
result = -RT_ERROR;
goto __exit;
}
}
oc_config.OCMode = TIM_OCMODE_PWM1;
oc_config.Pulse = 0;