Espressif ESP32-S2 Programming Manual page 950

Table of Contents

Advertisement

Chapter 2. API Reference
set uxBitsToSet to 0x08. To set bit 3 and bit 0 set uxBitsToSet to 0x09.
• pxHigherPriorityTaskWoken: As mentioned above, calling this function will result in a
message being sent to the timer daemon task. If the priority of the timer daemon task is higher than
the priority of the currently running task (the task the interrupt interrupted) then *pxHigherPrior-
ityTaskWoken will be set to pdTRUE by xEventGroupSetBitsFromISR(), indicating that a context
switch should be requested before the interrupt exits. For that reason *pxHigherPriorityTaskWoken
must be initialised to pdFALSE. See the example code below.
xEventGroupGetBits(xEventGroup)
Returns the current value of the bits in an event group. This function cannot be used from an interrupt.
Return The event group bits at the time xEventGroupGetBits() was called.
Parameters
• xEventGroup: The event group being queried.
Type Definitions
typedef struct EventGroupDef_t *EventGroupHandle_t
typedef TickType_t EventBits_t
Stream Buffer API
Header File
components/freertos/include/freertos/stream_buffer.h
Functions
size_t
xStreamBufferSend(StreamBufferHandle_t
Sends bytes to a stream buffer. The bytes are copied into the stream buffer.
***NOTE***: Uniquely among FreeRTOS objects, the stream buffer implementation (so also the message
buffer implementation, as message buffers are built on top of stream buffers) assumes there is only one task
or interrupt that will write to the buffer (the writer), and only one task or interrupt that will read from the
buffer (the reader). It is safe for the writer and reader to be different tasks or interrupts, but, unlike other
FreeRTOS objects, it is not safe to have multiple different writers or multiple different readers. If there are to
be multiple different writers then the application writer must place each call to a writing API function (such
as xStreamBufferSend()) inside a critical section and set the send block time to 0. Likewise, if there are to be
multiple different readers then the application writer must place each call to a reading API function (such as
xStreamBufferReceive()) inside a critical section and set the receive block time to 0.
Use xStreamBufferSend() to write to a stream buffer from a task. Use xStreamBufferSendFromISR() to write
to a stream buffer from an interrupt service routine (ISR).
Example use:
void vAFunction( StreamBufferHandle_t xStreamBuffer )
{
size_t xBytesSent;
uint8_t ucArrayToSend[]
char *pcStringToSend
const TickType_t x100ms
//
Send an array to the stream buffer, blocking
//
wait
for
enough space to be available
xBytesSent
=
xStreamBufferSend( xStreamBuffer, ( void
sizeof( ucArrayToSend ), x100ms );
if( xBytesSent
{
//
The call to xStreamBufferSend() times out before there was enough
Espressif Systems
xDataLengthBytes, TickType_t xTicksToWait)
=
{ 0, 1, 2,
=
"String to
send";
=
pdMS_TO_TICKS(
!=
sizeof( ucArrayToSend ) )
Submit Document Feedback
xStreamBuffer, const void *pvTxData, size_t
3
};
100
);
for
a maximum of 100ms to
in
the stream
939
buffer.
*
)
ucArrayToSend,␣
(continues on next page)
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

Table of Contents

Save PDF