xEventGroupCreate
EventGroup
Collaboration diagram for xEventGroupCreate:

event_groups.h

    EventGroupHandle_t xEventGroupCreate( void );

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 xEventGropuCreate() then the required memory is automatically dynamically allocated inside the xEventGroupCreate() function. (see http://www.freertos.org/a00111.html). If an event group is created using xEventGropuCreateStatic() then the application writer must instead provide the memory that will get used by the event group. xEventGroupCreateStatic() 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 available 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 configUSE_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.

Returns
  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 http://www.freertos.org/a00111.html

Example usage:

       // Declare a variable to hold the created event group.
       EventGroupHandle_t xCreatedEventGroup;

       // Attempt to create the event group.
       xCreatedEventGroup = xEventGroupCreate();

       // Was the event group created successfully?
       if( xCreatedEventGroup == NULL )
       {
        // The event group was not created because there was insufficient
        // FreeRTOS heap available.
       }
       else
       {
        // The event group was created.
       }