Chapter 2. API Reference
if( ( uxBits
{
//
Both bit
}
else
if( ( uxBits
{
//
Bit
// cleared.
//
task that was waiting
// state.
}
else
if( ( uxBits
{
//
Bit
// cleared.
//
task that was waiting
// state.
}
else
{
//
Neither bit
//
was waiting
//
cleared
}
}
Return The value of the event group at the time the call to xEventGroupSetBits() returns. There are two
reasons why the returned value might have the bits specified by the uxBitsToSet parameter cleared. First,
if setting a bit results in a task that was waiting for the bit leaving the blocked state then it is possible the
bit will be cleared automatically (see the xClearBitOnExit parameter of xEventGroupWaitBits()). Sec-
ond, any unblocked (or otherwise Ready state) task that has a priority above that of the task that called
xEventGroupSetBits() will execute and may change the event group value before the call to xEvent-
GroupSetBits() returns.
Parameters
• xEventGroup: The event group in which the bits are to be set.
• uxBitsToSet: A bitwise value that indicates the bit or bits to set. For example, to set bit 3 only,
set uxBitsToSet to 0x08. To set bit 3 and bit 0 set uxBitsToSet to 0x09.
EventBits_t xEventGroupSync(EventGroupHandle_t
Atomically set bits within an event group, then wait for a combination of bits to be set within the same event
group. This functionality is typically used to synchronise multiple tasks, where each task has to wait for the
other tasks to reach a synchronisation point before proceeding.
This function cannot be used from an interrupt.
The function will return before its block time expires if the bits specified by the uxBitsToWait parameter are
set, or become set within that time. In this case all the bits specified by uxBitsToWait will be automatically
cleared before the function returns.
Example usage:
//
Bits used by the three
#define TASK_0_BIT
#define TASK_1_BIT
#define TASK_2_BIT
#define ALL_SYNC_BITS ( TASK_0_BIT | TASK_1_BIT | TASK_2_BIT )
//
Use an event group to synchronise three
Espressif Systems
&
( BIT_0
|
BIT_4 ) )
0
and
bit
4
remained
&
BIT_0 )
!=
0
remained
set
when the function returned, but bit
It might be that bit
for
&
BIT_4 )
!=
4
remained
set
when the function returned, but bit
It might be that bit
for
0
nor bit
4
for
both of the bits to be set,
as
the task left the Blocked
const
EventBits_t
tasks.
( 1 << 0 )
( 1 << 1 )
( 1 << 2 )
Submit Document Feedback
==
( BIT_0
|
BIT_4 ) )
set
when the function
0
)
4
was cleared automatically
bit
4
was removed
0
)
0
was cleared automatically
bit
0
was removed
remained
set.
It might be that a task
state.
xEventGroup, const
uxBitsToWaitFor, TickType_t xTicksToWait)
tasks.
It
is
935
(continued from previous page)
returned.
4
was
as
a
from
the
Blocked
0
was
as
a
from
the
Blocked
and
the bits were
EventBits_t
uxBitsToSet,
assumed this event
(continues on next page)
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?