File tree 1 file changed +10
-7
lines changed
1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -217,20 +217,23 @@ void HardwareTimer::pauseChannel(uint32_t channel)
217
217
*/
218
218
void HardwareTimer::resume (void )
219
219
{
220
+ bool baseStart = true ;
221
+ for (uint8_t i = 1 ; i <= TIMER_CHANNELS; i++) {
222
+ if (_ChannelMode[i - 1 ] != TIMER_OUTPUT_DISABLED) {
223
+ resumeChannel (i);
224
+ baseStart = false ;
225
+ }
226
+ }
220
227
// Clear flag and enable IT
221
228
if (callbacks[0 ]) {
222
229
__HAL_TIM_CLEAR_FLAG (&(_timerObj.handle ), TIM_FLAG_UPDATE);
223
230
__HAL_TIM_ENABLE_IT (&(_timerObj.handle ), TIM_IT_UPDATE);
231
+ }
224
232
225
- // Start timer in Time base mode. Required when there is no channel used but only update interrupt.
233
+ // Start timer in Time base mode. Required when there is no channel used but only update interrupt.
234
+ if (baseStart && (!LL_TIM_IsEnabledCounter (_timerObj.handle .Instance ))) {
226
235
HAL_TIM_Base_Start (&(_timerObj.handle ));
227
236
}
228
-
229
- // Resume all channels
230
- resumeChannel (1 );
231
- resumeChannel (2 );
232
- resumeChannel (3 );
233
- resumeChannel (4 );
234
237
}
235
238
236
239
/* *
You can’t perform that action at this time.
0 commit comments