FreeRTOS-Cpp
Loading...
Searching...
No Matches
Public Member Functions | List of all members
FreeRTOS::EventGroup Class Reference

Class that encapsulates the functionality of a FreeRTOS event group. More...

#include <FreeRTOS/EventGroups.hpp>

Inheritance diagram for FreeRTOS::EventGroup:
Inheritance graph
[legend]
Collaboration diagram for FreeRTOS::EventGroup:
Collaboration graph
[legend]

Public Member Functions

 EventGroup ()
 Construct a new EventGroup object by calling EventGroupHandle_t xEventGroupCreate( void )
 
 EventGroup (const EventGroup &)=delete
 
EventGroupoperator= (const EventGroup &)=delete
 
 EventGroup (EventGroup &&) noexcept=default
 
EventGroupoperator= (EventGroup &&) noexcept=default
 
- Public Member Functions inherited from FreeRTOS::EventGroupBase
 EventGroupBase (const EventGroupBase &)=delete
 
EventGroupBaseoperator= (const EventGroupBase &)=delete
 
bool isValid () const
 Function that checks if the underlying event group handle is not NULL. This should be used to ensure an event group has been created correctly.
 
EventBits wait (const EventBits &bitsToWaitFor=0, const bool clearOnExit=false, const bool waitForAllBits=false, const TickType_t ticksToWait=portMAX_DELAY) const
 Function that calls EventBits_t xEventGroupWaitBits( const EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait )
 
EventBits set (const EventBits &bitsToSet) const
 Function that calls EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet )
 
bool setFromISR (bool &higherPriorityTaskWoken, const EventBits &bitsToSet) const
 Function that calls BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken )
 
bool setFromISR (const EventBits &bitsToSet) const
 Function that calls BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken )
 
EventBits clear (const EventBits &bitsToClear) const
 Function that calls EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear )
 
bool clearFromISR (const EventBits &bitsToClear) const
 Function that calls BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear )
 
EventBits get () const
 Function that calls EventBits_t xEventGroupGetBits( EventGroupHandle_t xEventGroup )
 
EventBits getFromISR () const
 Function that calls EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup )
 
EventBits sync (const EventBits &bitsToSet=0, const EventBits &bitsToWaitFor=0, const TickType_t ticksToWait=portMAX_DELAY) const
 Function that calls EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait )
 

Additional Inherited Members

- Public Types inherited from FreeRTOS::EventGroupBase
using EventBits = std::bitset< 8 >
 
using EventBits = std::bitset< 24 >
 
using EventBits = std::bitset< 56 >
 
- Static Public Member Functions inherited from FreeRTOS::EventGroupBase
static void * operator new (size_t)=delete
 
static void * operator new[] (size_t)=delete
 
static void * operator new (size_t, void *ptr)
 
static void * operator new[] (size_t, void *ptr)
 

Detailed Description

Class that encapsulates the functionality of a FreeRTOS event group.

Each event group requires a [very] small amount of RAM that is used to hold the event group's state. If an event group is created using this class then the required RAM is automatically allocated from the FreeRTOS heap. If an event group is created using FreeRTOS::StaticEventGroup then the RAM is provided by the application writer, which requires an additional parameter, but allows the RAM to be statically allocated at compile time. See the Static Vs Dynamic allocation page for more information.

Constructor & Destructor Documentation

◆ EventGroup()

FreeRTOS::EventGroup::EventGroup ( )
inline

Construct a new EventGroup object by calling EventGroupHandle_t xEventGroupCreate( void )

EventGroup.hpp

See also
https://www.freertos.org/xEventGroupCreate.html
Warning
The user should call isValid() on this object to verify that the queue was created successfully in case the memory required to create the queue could not be allocated.

Example Usage

#include <FreeRTOS/EventGroups.hpp>
#include <FreeRTOS/Kernel.hpp>
#include <FreeRTOS/Task.hpp>
class MyTask : public FreeRTOS::Task {
public:
void taskFunction() final;
private:
FreeRTOS::EventGroup eventGroup;
};
MyTask myTask;
void MyTask::taskFunction() {
// Was the event group created successfully?
if (eventGroup.isValid()) {
// The event group was created.
} else {
// The event group was not created because there was insufficient FreeRTOS
// heap available.
}
}
Class that encapsulates the functionality of a FreeRTOS event group.
Definition EventGroups.hpp:441
Class that encapsulates the functionality of a FreeRTOS task.
Definition Task.hpp:1427

The documentation for this class was generated from the following file: