Hello,
I have a task that I'm using for some communication scheduling, and I was wondering if it was possible to do a Mailbox_post() and a Mailbox_pend() in the same task for an initialization. I was trying something like the code listed below and I've been getting errors in the data listed in the Mailbox pointer:
typedef struct
{
int id;
char firstname[25];
char lastname[25];
} MY_MAILBOX_STRUCT;
/*---------------------------------------------------------------------------*/
/** @brief A Task for Scheduling Messages
* This task pends on messages being posted into it's mailbox
*//*------------------------------------------------------------------------*/
void someTask(void)
{
void* msgPtr;
MY_MAILBOX_STRUCT *MbxPtr;
MY_MAILBOX_STRUCT mbx =
{
10, "HELLO", "WORLD"
}
Mailbox_post(someMailbox, (void*)&mbx, BIOS_NO_WAIT);
while(true)
{
Mailbox_pend(someMailbox, msgPtr, BIOS_WAIT_FOREVER);
MbxPtr = (MY_MAILBOX_STRUCT*)msgPtr;
//Do whatever work with the newMbxPtr I have
}
}
Thank you for any help!