EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #964 background imageLoading...
Page #964 background image
Chapter 2. API Reference
sets the maximum length of the message that can be received. If xBufferLengthBytes is too small
to hold the next message then the message will be left in the message buffer and 0 will be returned.
• pxHigherPriorityTaskWoken: It is possible that a message buffer will have a task blocked
on it waiting for space to become available. Calling xMessageBufferReceiveFromISR() can make
space available, and so cause a task that is waiting for space to leave the Blocked state. If call-
ing xMessageBufferReceiveFromISR() causes a task to leave the Blocked state, and the unblocked
task has a priority higher than the currently executing task (the task that was interrupted), then,
internally, xMessageBufferReceiveFromISR() will set *pxHigherPriorityTaskWoken to pdTRUE.
If xMessageBufferReceiveFromISR() sets this value to pdTRUE, then normally a context switch
should be performed before the interrupt is exited. That will ensure the interrupt returns directly
to the highest priority Ready state task. *pxHigherPriorityTaskWoken should be set to pdFALSE
before it is passed into the function. See the code example below for an example.
vMessageBufferDelete(xMessageBuffer)
Deletes a message buffer that was previously created using a call to xMessageBufferCreate() or xMessage-
BufferCreateStatic(). If the message buffer was created using dynamic memory (that is, by xMessageBuffer-
Create()), then the allocated memory is freed.
A message buffer handle must not be used after the message buffer has been deleted.
Parameters
• xMessageBuffer: The handle of the message buffer to be deleted.
xMessageBufferIsFull(xMessageBuffer)
Tests to see if a message buffer is full. A message buffer is full if it cannot accept any more messages, of any
size, until space is made available by a message being removed from the message buffer.
Return If the message buffer referenced by xMessageBuffer is full then pdTRUE is returned. Otherwise
pdFALSE is returned.
Parameters
• xMessageBuffer: The handle of the message buffer being queried.
xMessageBufferIsEmpty(xMessageBuffer)
Tests to see if a message buffer is empty (does not contain any messages).
Return If the message buffer referenced by xMessageBuffer is empty then pdTRUE is returned. Otherwise
pdFALSE is returned.
Parameters
• xMessageBuffer: The handle of the message buffer being queried.
xMessageBufferReset(xMessageBuffer)
Resets a message buffer to its initial empty state, discarding any message it contained.
A message buffer can only be reset if there are no tasks blocked on it.
Return If the message buffer was reset then pdPASS is returned. If the message buffer could not be reset
because either there was a task blocked on the message queue to wait for space to become available, or
to wait for a a message to be available, then pdFAIL is returned.
Parameters
• xMessageBuffer: The handle of the message buffer being reset.
xMessageBufferSpaceAvailable(xMessageBuffer)
Returns the number of bytes of free space in the message buffer.
Return The number of bytes that can be written to the message buffer before the message buffer would be
full. 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 if xMes-
sageBufferSpacesAvailable() returns 10, then the size of the largest message that can be written to the
message buffer is 6 bytes.
Parameters
• xMessageBuffer: The handle of the message buffer being queried.
xMessageBufferSpacesAvailable(xMessageBuffer)
Espressif Systems 953
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish