Hello. It is unclear if uxSemaphoreGetCount can be used in a Interrupt ServiceRoutine. Is uxSemaphoreGetCount atomic?
No it can’t - use uxQueueMessagesWaitingFromISR() instead.
Sorry, that is the underlying function. I meant use uxSemaphoreGetCoutFromISR() instead.
Thank you, but uxSemaphoreGetCoutFromISR() doesn’t exist… I searched it on Hands-On-Tutorial and API Reference, there’s no mention of it. I also tried to compile my code using uxSemaphoreGetCoutFromISR, but I got a linker error. FYI, I’m trying to code an IRS receiving 1 to 10 bytes from an UART, just want to communicate them to a main task. My fist and natural way to do this was to use a Queue, problem is that there’s no apparent way to know how many bytes are stored on the buffer specified by xQueueReceive. How is it possible to use xQueueReceive without knowing the exact number of bytes that were stored to the *void pvBuffer parameter?
A Queue will ALWAY just put or get a single ‘item’, so a queue of characters will always get just a single character.
The function to get the count of items in a Queue (or.a counting Semaphore) from an ISR is uxQueueMessagesWaitingFromISR().
Noted, solved!
Thank you.