Skip to content

Commit

Permalink
HardwareTimer: start timer when only update interrupt needed
Browse files Browse the repository at this point in the history
no more need to use setMode() when only update interrupt required.
Simplify timebase interrupt usage: see #841
  • Loading branch information
ABOSTM authored and fpistm committed Jan 2, 2020
1 parent 849a8be commit 757493c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cores/arduino/HardwareTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ void HardwareTimer::resume(void)
if (callbacks[0] != NULL) {
__HAL_TIM_CLEAR_FLAG(&(_timerObj.handle), TIM_FLAG_UPDATE);
__HAL_TIM_ENABLE_IT(&(_timerObj.handle), TIM_IT_UPDATE);

// Start timer in Time base mode. Required when there is no channel used but only update interrupt.
HAL_TIM_Base_Start(&(_timerObj.handle));
}

// Resume all channels
resumeChannel(1);
resumeChannel(2);
Expand Down

0 comments on commit 757493c

Please sign in to comment.