From 125aaf7c25d08d71c6b197b172484a7b753356d0 Mon Sep 17 00:00:00 2001 From: Alexandre Bourdiol Date: Wed, 17 Nov 2021 15:49:01 +0100 Subject: [PATCH] HardwareTimer: start timer in case only CC interrupts are used Start timer in case only CaptureCompare interrupts are used, without update interrupt (and without pin used). fixes #1544 Signed-off-by: Alexandre Bourdiol --- cores/arduino/HardwareTimer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cores/arduino/HardwareTimer.cpp b/cores/arduino/HardwareTimer.cpp index 30c3a60531..a390da9166 100644 --- a/cores/arduino/HardwareTimer.cpp +++ b/cores/arduino/HardwareTimer.cpp @@ -439,8 +439,13 @@ void HardwareTimer::resumeChannel(uint32_t channel) HAL_TIM_IC_Start(&(_timerObj.handle), timChannel); } break; - case TIMER_NOT_USED: case TIMER_OUTPUT_COMPARE: + case TIMER_DISABLED: + if (!LL_TIM_IsEnabledCounter(_timerObj.handle.Instance)) { + HAL_TIM_Base_Start(&(_timerObj.handle)); + } + break; + case TIMER_NOT_USED: default : break; }