Espressif ESP32-S2 Programming Manual page 943

Table of Contents

Advertisement

Chapter 2. API Reference
else
{
// The event group was created.
}
Return If the event group was created then a handle to the event group is returned. If there was insufficient
FreeRTOS heap available to create the event group then NULL is returned. See
org/a00111.html
EventGroupHandle_t
xEventGroupCreateStatic(StaticEventGroup_t *pxEventGroupBuffer)
Create a new event group.
Internally, within the FreeRTOS implementation, event groups use a [small] block of memory, in which
the event group's structure is stored. If an event groups is created using xEventGroupCreate() then the
required memory is automatically dynamically allocated inside the xEventGroupCreate() function. (see
https://www.FreeRTOS.org/a00111.html). If an event group is created using xEventGroupCreateStatic() then
the application writer must instead provide the memory that will get used by the event group. xEventGroupCre-
ateStatic() therefore allows an event group to be created without using any dynamic memory allocation.
Although event groups are not related to ticks, for internal implementation reasons the number of bits avail-
able for use in an event group is dependent on the configUSE_16_BIT_TICKS setting in FreeRTOSConfig.h.
If configUSE_16_BIT_TICKS is 1 then each event group contains 8 usable bits (bit 0 to bit 7). If confi-
gUSE_16_BIT_TICKS is set to 0 then each event group has 24 usable bits (bit 0 to bit 23). The EventBits_t
type is used to store event bits within an event group.
Example usage:
//
StaticEventGroup_t
//
size
and
alignment requirements
//
provided
as
//
group (which
//
settings) without breaking the strict data hiding policy by exposing the
//
real event group
//
into the xSemaphoreCreateEventGroupStatic() function
//
the event
group's data structures
StaticEventGroup_t xEventGroupBuffer;
//
Create the event group without dynamically allocating
xEventGroup
=
xEventGroupCreateStatic( &xEventGroupBuffer );
Return If the event group was created then a handle to the event group is returned. If pxEventGroupBuffer
was NULL then NULL is returned.
Parameters
• pxEventGroupBuffer: pxEventGroupBuffer must point to a variable of type StaticEvent-
Group_t, which will be then be used to hold the event group's data structures, removing the need
for the memory to be allocated dynamically.
EventBits_t xEventGroupWaitBits(EventGroupHandle_t
[Potentially] block to wait for one or more bits to be set within a previously created event group.
This function cannot be called from an interrupt.
Example usage:
#define BIT_0 ( 1 << 0 )
#define BIT_4 ( 1 << 4 )
void aFunction( EventGroupHandle_t xEventGroup )
{
EventBits_t uxBits;
Espressif Systems
is
a publicly accessible structure that has the same
a mechanism
for
applications to know the size of the event
is
dependent on the architecture
internals.
This StaticEventGroup_t variable
sToWaitFor, const BaseType_t xClearOnExit, const Base-
Type_t xWaitForAllBits, TickType_t xTicksToWait)
Submit Document Feedback
as
the real event group
and
configuration file
xEventGroup, const
932
(continued from previous page)
https://www.FreeRTOS.
structure.
It
is
is
passed
and is
used to store
any
memory.
EventBits_t
uxBit-
(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