xEventGroupSetBitsFromISR return value

embeddedavenger wrote on Wednesday, October 22, 2014:

I am confused by the page for the xEventGroupSetBitsFromISR function.

The return value is described with “If the callback request was registered successfully then pdPASS is returned, otherwise pdFALSE is returned. pdFALSE will be returned if the timer service queue was full.” The page makes no other mention of a callback function. Though the page says that INCLUDE_xTimerPendFunctionCall must be set to 1, it makes no other mention of timers. Finally, the example code tests the return value against pdFAIL.

Is the return value pdTRUE/pdFALSE or pdPASS/pdFAIL? (Which ignores the question of why you have two pairs of values that are equivalent.) Is there a callback function I should be setting up before making this call?

rtel wrote on Wednesday, October 22, 2014:

For mutual exclusion reasons, xEventGroupSetBitsFromISR() does not access the bits in the event groups directly, but instead requests that the bits be set/cleared by the RTOS when the interrupt exits. It does this using the same mechanism described on this page:
http://www.freertos.org/xTimerPendFunctionCallFromISR.html - but that is more detail than you need to know to use the function.

More simply, calling the function sends a message to the RTOS on a queue. The message is the function to execute (what is referred to as the callback on the page you referenced) A task created/controlled by the RTOS then reads the message and performs the processing. If the message can be sent, then pdTRUE/pdPASS is returned. If the message cannot be sent (because the queue is full) then pdFALSE/pdFAIL is returned. The mechanism is automatic, you do not need to do anything with a callback yourself, or even know the callback exists.

That is not how function was originally implemented and it looks like the documentation for the function has only been partially updated to explain this, and some information is missing and caused the confusion. I will update the documentation page, and also make the use of pdPASS/pdTRUE and pdFAIL/pdFALSE more consistend. The two definitions in each pair are equivalent.

Regards.