Skip to content

Commit a17fc44

Browse files
committed
fix(hardwaretimer): resume if not running
not only if previous mode is different. Signed-off-by: Frederic Pillon <[email protected]>
1 parent 32b6654 commit a17fc44

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: libraries/SrcWrapper/src/HardwareTimer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ void HardwareTimer::setPWM(uint32_t channel, PinName pin, uint32_t frequency, ui
937937
if (CompareCallback) {
938938
attachInterrupt(channel, CompareCallback);
939939
}
940-
if (previousMode != TIMER_OUTPUT_COMPARE_PWM1) {
940+
if (!isRunning() || !isRunningChannel(channel) || (previousMode != TIMER_OUTPUT_COMPARE_PWM1)) {
941941
resume();
942942
}
943943
}

0 commit comments

Comments
 (0)