EasyManua.ls Logo

Espressif ESP32-S2 - Page 950

Espressif ESP32-S2
1695 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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(StreamBuerHandle_t xStreamBuer, const void *pvTxData, size_t
xDataLengthBytes, TickType_t xTicksToWait)
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[] = { 0, 1, 2, 3 };
char *pcStringToSend = "String to send";
const TickType_t x100ms = pdMS_TO_TICKS( 100 );
// Send an array to the stream buffer, blocking for a maximum of 100ms to
// wait for enough space to be available in the stream buffer.
xBytesSent = xStreamBufferSend( xStreamBuffer, ( void * ) ucArrayToSend,
,sizeof( ucArrayToSend ), x100ms );
if( xBytesSent != sizeof( ucArrayToSend ) )
{
// The call to xStreamBufferSend() times out before there was enough
(continues on next page)
Espressif Systems 939
Submit Document Feedback
Release v4.4

Table of Contents