timer interrupt callback stm32f769 cubemx
Hi,
I'm using stm32f769 with cube MX and Atollic for my latest project. So far I managed some stuff like IAP Bootloader via µSD /or USB, PWM Generation, Encoder readout... So far I would guess I understood how CubeMX and HAL Library work together and how to use HAL and LL Lib.
I want to use a timer Interrupt (TIM10) and on every update and PWM pulse. I see that the Interrupt handler gets called
void
TIM1_UP_TIM10_IRQHandler(
void)
{
HAL_TIM_IRQHandler(&htim10);
and checks for the reason. Then a specific callback function is called like:
HAL_TIM_PWM_PulseFinishedCallback(htim);
or
HAL_TIM_PeriodElapsedCallback(htim)
it is marked __weak so I can use my own ...
BUT here is my issue:
As far as I read the code the Information which timer calls the callback function is lost as every Timer will call same callback function.
So in case I use more than one timer I have to check inside my callback function which timer caused it? I have to read the htim struct and get the info back, then have some switch case that leads to the code I want to have executed???
Or is there a better way to do it. Icouldn't find any example about this...
And second question, but not so important: Why is it actually called 'callback function'? In my understanding a callback function is a function I call by a 'pointer to function' Parameter as Parameter of an other function ... I can not see anything like this here, so some explanation would be nice.
Thanks in advance
Stefan
