I'm trying to understand the message sizing in lightweight messages. I understand that it is in multiples of 32 bits. Let's say I'm trying to pass a structure as a message:
unsigned char byte1;
unsigned char *ptr1;
unsigned char byte2;
unsigned char *ptr2;
The sizeof() for this structure returns 16 bytes. So, if i create a message queue like this:
uint32_t msgQ[sizeof(LWMSGQ_STRUCT)/sizeof(uint32_t) + sizeof(messageStruct)/sizeof(uint32_t)]
I end up with an array of 20 uint32_t, or 80 bytes, which is what I would expect.
I then initialize the queue with:
_lwmsq_init(msgQ, 1, 4);
However, when I send this structure, with the LWMSGQ_SEND_BLOCK_ON_FULL, it doesn't block because apparently it's not full. As an experiment, I tried send a single uint32_t integer, but left the message size the same. Again, it did not block. Once I changed the message size to 1, it blocked. Although it only allows 1 message, apparently it's not "full" unless the size of the message is exact. How does one send a structure like this and have it block on full?
On a somewhat related note, if I send a message with the LWMSQ_SEND_BLOCK_ON_SEND flag, it does indeed block, but what unblocks the task? I was able to block one task, receive the structure message by the receiving task, but I could not send a structure back and unblock the requesting task.