xEventGroupClearBitsFromISR
EventGroup
Collaboration diagram for xEventGroupClearBitsFromISR:

event_groups.h

       BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );

A version of xEventGroupClearBits() that can be called from an interrupt.

Setting bits in an event group is not a deterministic operation because there are an unknown number of tasks that may be waiting for the bit or bits being set. FreeRTOS does not allow nondeterministic operations to be performed while interrupts are disabled, so protects event groups that are accessed from tasks by suspending the scheduler rather than disabling interrupts. As a result event groups cannot be accessed directly from an interrupt service routine. Therefore xEventGroupClearBitsFromISR() sends a message to the timer task to have the clear operation performed in the context of the timer task.

Parameters

  xEventGroup | The event group in which the bits are to be cleared.
  uxBitsToClear | A bitwise value that indicates the bit or bits to clear. For example, to clear bit 3 only, set uxBitsToClear to 0x08. To clear bit 3 and bit 0 set uxBitsToClear to 0x09.

Returns
  If the request to execute the function was posted successfully then pdPASS is returned, otherwise pdFALSE is returned. pdFALSE will be returned if the timer service queue was full.

Example usage:

      #define BIT_0 ( 1 << 0 )
      #define BIT_4 ( 1 << 4 )

      // An event group which it is assumed has already been created by a call to
      // xEventGroupCreate().
      EventGroupHandle_t xEventGroup;

      void anInterruptHandler( void )
      {
        // Clear bit 0 and bit 4 in xEventGroup.
        xResult = xEventGroupClearBitsFromISR(
                            xEventGroup,     // The event group being updated.
                            BIT_0 | BIT_4 ); // The bits being set.

        if( xResult == pdPASS )
        {
            // The message was posted successfully.
        }
     }