[fix][stm32]修复输出高电平异常的问题

This commit is contained in:
wdfk-prog 2022-12-01 16:49:28 +08:00 committed by Man, Jianting (Meco)
parent dea34be06c
commit aaf1abf25f
1 changed files with 3 additions and 2 deletions

View File

@ -278,9 +278,10 @@ static rt_err_t drv_pwm_set(TIM_HandleTypeDef *htim, struct rt_pwm_configuration
{
pulse = MIN_PULSE;
}
else if (pulse > period)
/*To determine user input, output high level is required*/
else if (pulse >= period)
{
pulse = period;
pulse = period + 1;
}
__HAL_TIM_SET_COMPARE(htim, channel, pulse - 1);