event_groups.h
EventBits_t xEventGroupSetBits(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet) PRIVILEGED_FUNCTION
TickType_t EventBits_t
Definition event_groups.h:113
struct EventGroupDef_t * EventGroupHandle_t
Definition event_groups.h:103
Set bits within an event group. This function cannot be called from an interrupt. xEventGroupSetBitsFromISR() is a version that can be called from an interrupt.
Setting bits in an event group will automatically unblock tasks that are blocked waiting for the bits.
The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupSetBits() to be available.
- 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. |
- Returns
- 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()). Second, 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 xEventGroupSetBits() returns.
Example usage:
#define BIT_0 ( 1 << 0 )
#define BIT_4 ( 1 << 4 )
{
xEventGroup,
BIT_0 | BIT_4 );
if( ( uxBits & ( BIT_0 | BIT_4 ) ) == ( BIT_0 | BIT_4 ) )
{
}
else if( ( uxBits & BIT_0 ) != 0 )
{
}
else if( ( uxBits & BIT_4 ) != 0 )
{
}
else
{
}
}