STM32 PWM : avoid glitch after duty cycle change

pull/13222/head
jeromecoutant 2020-07-02 14:54:09 +02:00
parent ffeb926a67
commit e10a233c80
1 changed files with 2 additions and 0 deletions

View File

@ -276,7 +276,9 @@ void pwmout_write(pwmout_t *obj, float value)
} else {
// If channel already enabled, only update compare value to avoid glitch
__HAL_TIM_SET_COMPARE(&TimHandle, channel, sConfig.Pulse);
return;
}
#if !defined(PWMOUT_INVERTED_NOT_SUPPORTED)
if (obj->inverted) {
HAL_TIMEx_PWMN_Start(&TimHandle, channel);