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.
Ahh … you’ve to provide a callback with a fixed API…
To the rescue some ports as Cortex-M3/4 provide xPortIsInsideInterrupt() in portmacro.h which can be used to detect ISR context. AFAIK some other 3rd party libs use this mechanism to provide generic APIs, too.
Exactly…
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!