How to identify which timer channel triggered the "HAL_TIM_PeriodElapsedCallback" interrupt?
I am using STM32F302R8, and have setup channels 1 to 5 of TIMER1 in various output modes. In the callback function, I would like to identify which channel generated the interrupt.
I am using HAL, and can figure out which timer generated the interrupt, like so:
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef* htim)
{
if (htim->Instance == htim1.Instance) {
go_do_stuff_for_timer1();
}
else if (htim->Instance == htim2.Instance) {
go_do_stuff_for_timer2();
}
}
But, how to tell which channel of htim1 generated the interrupt?
