Tick Hook & semaphores

jdurand wrote on Thursday, November 15, 2012:

I often use Tick Hook to operate some low-jitter simple items and items where it’s critical I don’t miss a tick.  Nothing that really would require its own task and priority level.

Anyway, no trouble so far on several projects but I just came up with a need to send a semaphore. 

I assume I use xSemaphoreGiveFromISR() but do I need to use portEND_SWITCHING_ISR(xHigherPriorityTaskWoken) since I’m already in the FreeRTOS interrupt?

Will this even work?

edwards3 wrote on Thursday, November 15, 2012:

Yes you need to use the FromISR() version, and no you don’t need to worry about the xHigherPriorityTaskWoken variable because a context switch will happen anyway after the tick hook finishes.

In older FreeRTOS versions you would still have to supply the xHigherPriorityTaskWoken parameter, just don’t use it afterwards. In newer FreeRTOS versions you can just pass NULL in place of xHigherPriorityTaskWoken.

jdurand wrote on Thursday, November 15, 2012:

I’m still running 7.2.0, will update after this project is closed out, but will assume that’s good enough to use null.