提交 db3e261b 编写于 作者: 哈哈哈可是开电脑's avatar 哈哈哈可是开电脑 提交者: mysterywolf

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

上级 f54f2c2c
...@@ -402,13 +402,16 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device) ...@@ -402,13 +402,16 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device)
goto __exit; goto __exit;
} }
master_config.MasterOutputTrigger = TIM_TRGO_RESET; if(IS_TIM_MASTER_INSTANCE(tim->Instance))
master_config.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
if (HAL_TIMEx_MasterConfigSynchronization(tim, &master_config) != HAL_OK)
{ {
LOG_E("%s master config failed", device->name); master_config.MasterOutputTrigger = TIM_TRGO_RESET;
result = -RT_ERROR; master_config.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
goto __exit; if (HAL_TIMEx_MasterConfigSynchronization(tim, &master_config) != HAL_OK)
{
LOG_E("%s master config failed", device->name);
result = -RT_ERROR;
goto __exit;
}
} }
oc_config.OCMode = TIM_OCMODE_PWM1; oc_config.OCMode = TIM_OCMODE_PWM1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册