I need to provide a way to an external library to stop timers.
The problems is that it call it from interruptions or not.
In my stopTimer function, that I need to provide, if I’m calling xTimerStopFromISR or xTimerStop in the wrong context, I’m going into an error.
Would you have a solution for this?
Maybe I’m not seeing another way of doing it…
What if following the FreeRTOS convention and provide
Thanks for your answer.
Sadly, I can’t modify the library that is calling stopTimer
Ahh … you’ve to provide a callback with a fixed API…
To the rescue some ports as Cortex-M3/4 provide
portmacro.h which can be used to detect ISR context. AFAIK some other 3rd party libs use this mechanism to provide generic APIs, too.
Thank you, that should do the job! I am using an STM32L746 so it should be Cortex M4 but I can’t find it in my portmacro.h. I will dig into this! Thank you for your help!
Here it is - FreeRTOS-Kernel/portmacro.h at main · FreeRTOS/FreeRTOS-Kernel · GitHub
Thank you for your help, I have included it inside my portmacro.h and it works perfectly!
The identical function could be made available for the M0, if anyone wanted it enough