I am trying to pass the pointer to a function via a message queue. The send/receive mechanism is working, i.e. the task waits on a message being received and unblocks when something is in the queue. However, I struggle to then execute the function that the queue contents points to.
Here is my send statement:
xQueueSend( xMsgQueue, ( void * ) &MsgFunction, 0 );
Here is my receive statement (inside the FreeRTOS task):
xQueueReceive( xMsgQueue, &(MsgWaiting), portMAX_DELAY );
And here is the dereferencing of the function pointer to actually call the function:
MsgWaiting is declared as:
void (*MsgWaiting) (void);
MsgFunction is declared as:
void MsgFunction (void);
However, the function never gets called. I’m sure it has something to do with the usage of pointers, or rather incorrect usage of pointers. Anyone mind to point out my mistake?