2021-03-10 06:54 AM
I'm trying to make a scheduler and everything seems to be ready, now the final step is add the proper function to the IRQ_Handler. This is where my problem starts. At default this uses a extern tim object from the main.c. I removed it there and put it in a class, as required for my project.
from the _it.c file:
void TIM3_IRQHandler(void)
{
/* USER CODE BEGIN TIM3_IRQn 0 */
/* USER CODE END TIM3_IRQn 0 */
HAL_TIM_IRQHandler(&htim3);
/* USER CODE BEGIN TIM3_IRQn 1 */
/* USER CODE END TIM3_IRQn 1 */
}
Now is my question. How can I use the tim located in my scheduler class in the IRQHandler?
Thanks in advance!
2021-03-10 11:54 AM
IRQ handlers are identified by their names which are defined in g_pfnVectors table of startup code. Hence, TIM3_IRQHandler will only be called on TIM3 events. There is nothing wrong with using htim3 wihin the handler.
hth
KnarfB
2021-03-10 12:08 PM
Instead of TIM handle struct, keep in the class a pointer to it.
The struct itself will stay global.
(No, one can't really hide a timer in a class instance. If this is not obvious, think on it as a homework).
-- pa
2021-03-11 07:51 AM
Fixed the problem, thank you both!