I'm using a Nucleo F446Re with lib version 2.1:
There is an issue when just using timer capture/compare interrupts without a overflow interrupt. In this case the used timer will not be started. I see no good reason why this should not be supported as you can use 4 independent interrupts in this case by using just one timer.
Example code to reproduce this ..
Code: Select all
pTimer->setPrescaleFactor(prescaler);
// using TIMER_DISABLED here as suggested in HardwareTimer.h line 39 when only interested in the interrupt
pTimer->setMode(ch, TIMER_DISABLED);
pTimer->setOverflow(UINT16_MAX);
pTimer->attachInterrupt(ch, cc_callback);
pTimer->setCaptureCompare(ch, value);
pTimer->setCount(0);
pTimer->resume();
Code: Select all
void HardwareTimer::resume(void)
{
// Clear flag and ennable IT
if (callbacks[0]) {
__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.
// Never reached if no ov callback has been registered. Timer is not started elsewhere when TIMER_DISABLED has been used not he channels.
//HAL_TIM_Base_Start(&(_timerObj.handle));
}
HAL_TIM_Base_Start(&(_timerObj.handle));
// Resume all channels
resumeChannel(1);
resumeChannel(2);
resumeChannel(3);
resumeChannel(4);
}
Br J.