28#ifndef FREERTOS_EVENTGROUPS_HPP
29#define FREERTOS_EVENTGROUPS_HPP
34#include "event_groups.h"
36#if (configUSE_EVENT_GROUPS == 1)
57 static void*
operator new(size_t) =
delete;
58 static void*
operator new[](size_t) =
delete;
60 static void*
operator new(size_t,
void* ptr) {
64 static void*
operator new[](size_t,
void* ptr) {
68#if (configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS)
69 using EventBits = std::bitset<8>;
70#elif (configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS)
71 using EventBits = std::bitset<24>;
72#elif (configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS)
73 using EventBits = std::bitset<56>;
139 inline EventBits
wait(
const EventBits& bitsToWaitFor = 0,
140 const bool clearOnExit =
false,
141 const bool waitForAllBits =
false,
142 const TickType_t ticksToWait = portMAX_DELAY)
const {
143 return EventBits(xEventGroupWaitBits(
144 handle, bitsToWaitFor.to_ulong(), (clearOnExit ? pdTRUE : pdFALSE),
145 (waitForAllBits ? pdTRUE : pdFALSE), ticksToWait));
178 inline EventBits
set(
const EventBits& bitsToSet)
const {
179 return EventBits(xEventGroupSetBits(
handle, bitsToSet.to_ulong()));
232 const EventBits& bitsToSet)
const {
233 BaseType_t taskWoken = pdFALSE;
234 const bool result = (xEventGroupSetBitsFromISR(
handle, bitsToSet.to_ulong(),
235 &taskWoken) == pdPASS);
236 if (taskWoken == pdTRUE) {
237 higherPriorityTaskWoken =
true;
254 return (xEventGroupSetBitsFromISR(
handle, bitsToSet.to_ulong(), NULL) ==
278 inline EventBits
clear(
const EventBits& bitsToClear)
const {
279 return EventBits(xEventGroupClearBits(
handle, bitsToClear.to_ulong()));
305 return (xEventGroupClearBitsFromISR(
handle, bitsToClear.to_ulong()) ==
324 inline EventBits
get()
const {
325 return EventBits(xEventGroupGetBits(
handle));
342 return EventBits(xEventGroupGetBitsFromISR(
handle));
380 inline EventBits
sync(
const EventBits& bitsToSet = 0,
381 const EventBits& bitsToWaitFor = 0,
382 const TickType_t ticksToWait = portMAX_DELAY)
const {
383 return EventBits(xEventGroupSync(
handle, bitsToSet.to_ulong(),
384 bitsToWaitFor.to_ulong(), ticksToWait));
413 vEventGroupDelete(this->
handle);
426#if (configSUPPORT_DYNAMIC_ALLOCATION == 1)
459 this->
handle = xEventGroupCreate();
472#if (configSUPPORT_STATIC_ALLOCATION == 1)
506 this->handle = xEventGroupCreateStatic(&staticEventGroup);
517 StaticEventGroup_t staticEventGroup;
Base class that provides the standard event group interface to FreeRTOS::EventGroup and FreeRTOS::Sta...
Definition EventGroups.hpp:49
bool isValid() const
Function that checks if the underlying event group handle is not NULL. This should be used to ensure ...
Definition EventGroups.hpp:86
bool setFromISR(const EventBits &bitsToSet) const
Function that calls BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup,...
Definition EventGroups.hpp:253
EventBits get() const
Function that calls EventBits_t xEventGroupGetBits( EventGroupHandle_t xEventGroup )
Definition EventGroups.hpp:324
bool setFromISR(bool &higherPriorityTaskWoken, const EventBits &bitsToSet) const
Function that calls BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup,...
Definition EventGroups.hpp:231
EventBits getFromISR() const
Function that calls EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup )
Definition EventGroups.hpp:341
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 ux...
Definition EventGroups.hpp:380
EventBits set(const EventBits &bitsToSet) const
Function that calls EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,...
Definition EventGroups.hpp:178
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,...
Definition EventGroups.hpp:139
bool clearFromISR(const EventBits &bitsToClear) const
Function that calls BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup,...
Definition EventGroups.hpp:304
EventBits clear(const EventBits &bitsToClear) const
Function that calls EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,...
Definition EventGroups.hpp:278
EventGroupHandle_t handle
Handle used to refer to the event group when using the FreeRTOS interface.
Definition EventGroups.hpp:423
~EventGroupBase()
Destroy the EventGroupBase object by calling void vEventGroupDelete( EventGroupHandle_t xEventGroup )
Definition EventGroups.hpp:412
EventGroupBase()=default
Construct a new EventGroupBase object.
Class that encapsulates the functionality of a FreeRTOS event group.
Definition EventGroups.hpp:441
EventGroup()
Construct a new EventGroup object by calling EventGroupHandle_t xEventGroupCreate( void )
Definition EventGroups.hpp:458
Class that encapsulates the functionality of a FreeRTOS event group.
Definition EventGroups.hpp:487
StaticEventGroup()
Construct a new StaticEventGroup object by calling EventGroupHandle_t xEventGroupCreateStatic( Static...
Definition EventGroups.hpp:505