Skip to content

Group xMessageBufferCreateStatic

Modules > xMessageBufferCreateStatic

More...

Detailed Description

message_buffer.h

Creates a new message buffer using statically allocated memory. See xMessageBufferCreate() for a version that uses dynamically allocated memory.

Parameters:

  • xBufferSizeBytes The size, in bytes, of the buffer pointed to by the pucMessageBufferStorageArea parameter. When a message is written to the message buffer an additional sizeof( size_t ) bytes are also written to store the message's length. sizeof( size_t ) is typically 4 bytes on a 32-bit architecture, so on most 32-bit architecture a 10 byte message will take up 14 bytes of message buffer space. The maximum number of bytes that can be stored in the message buffer is actually (xBufferSizeBytes - 1).
  • pucMessageBufferStorageArea Must point to a uint8_t array that is at least xBufferSizeBytes + 1 big. This is the array to which messages are copied when they are written to the message buffer.
  • pxStaticMessageBuffer Must point to a variable of type StaticMessageBuffer_t, which will be used to hold the message buffer's data structure.

Returns:

If the message buffer is created successfully then a handle to the created message buffer is returned. If either pucMessageBufferStorageArea or pxStaticmessageBuffer are NULL then NULL is returned.

Example use: