Skip to content

Commit e10a233

Browse files
committed
STM32 PWM : avoid glitch after duty cycle change
1 parent ffeb926 commit e10a233

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

targets/TARGET_STM/pwmout_api.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,9 @@ void pwmout_write(pwmout_t *obj, float value)
276276
} else {
277277
// If channel already enabled, only update compare value to avoid glitch
278278
__HAL_TIM_SET_COMPARE(&TimHandle, channel, sConfig.Pulse);
279+
return;
279280
}
281+
280282
#if !defined(PWMOUT_INVERTED_NOT_SUPPORTED)
281283
if (obj->inverted) {
282284
HAL_TIMEx_PWMN_Start(&TimHandle, channel);

0 commit comments

Comments
 (0)