|
FreeRTOS-Cpp
|
Base class that provides the standard event group interface to FreeRTOS::EventGroup and FreeRTOS::StaticEventGroup. More...

Public Types | |
| using | EventBits = std::bitset< 8 > |
| using | EventBits = std::bitset< 24 > |
| using | EventBits = std::bitset< 56 > |
Public Member Functions | |
| EventGroupBase (const EventGroupBase &)=delete | |
| EventGroupBase & | operator= (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 ) | |
Private Member Functions | |
| EventGroupBase ()=default | |
| Construct a new EventGroupBase object. | |
| ~EventGroupBase () | |
Destroy the EventGroupBase object by calling void vEventGroupDelete( EventGroupHandle_t xEventGroup ) | |
| EventGroupBase (EventGroupBase &&) noexcept=default | |
| EventGroupBase & | operator= (EventGroupBase &&) noexcept=default |
Private Attributes | |
| EventGroupHandle_t | handle = NULL |
| Handle used to refer to the event group when using the FreeRTOS interface. | |
Friends | |
| class | EventGroup |
| class | StaticEventGroup |
Base class that provides the standard event group interface to FreeRTOS::EventGroup and FreeRTOS::StaticEventGroup.
|
privatedefault |
Construct a new EventGroupBase object.
|
inlineprivate |
Destroy the EventGroupBase object by calling void vEventGroupDelete( EventGroupHandle_t xEventGroup )
EventGroup.hpp
Delete an event group.
Tasks that are blocked on the event group being deleted will be unblocked, and report an event group value of 0.
|
inline |
Function that calls EventBits_t xEventGroupClearBits(
EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear )
Clear bits (flags) within an RTOS event group. This function cannot be called from an interrupt. See clearFromISR() for a version that can be called from an interrupt.
| bitsToClear | A bitwise value that indicates the bit or bits to clear in the event group. |
Example Usage
|
inline |
Function that calls BaseType_t xEventGroupClearBitsFromISR(
EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear )
A version of clear() that can be called from an interrupt. The clear operation is deferred to the RTOS daemon task which is also known as the timer service task. The priority of the daemon task is set by the configTIMER_TASK_PRIORITY setting in FreeRTOSConfig.h.
| bitsToClear | A bitwise value that indicates the bit or bits to clear in the event group. |
Example Usage
|
inline |
Function that calls EventBits_t xEventGroupGetBits(
EventGroupHandle_t xEventGroup )
Returns the current value of the event bits (event flags) in an RTOS event group. This function cannot be used from an interrupt. See getFromISR() for a version that can be used in an interrupt.
|
inline |
Function that calls EventBits_t xEventGroupGetBitsFromISR(
EventGroupHandle_t xEventGroup )
A version of get() that can be called from an interrupt.
|
inline |
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.
| true | the handle is not NULL. |
| false | the handle is NULL. |
|
inline |
Function that calls EventBits_t xEventGroupSetBits(
EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet )
Set bits (flags) within an RTOS event group. This function cannot be called from an interrupt. setFromISR() 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.
| bitsToSet | A bitwise value that indicates the bit or bits to set in the event group. |
Example Usage
|
inline |
Function that calls BaseType_t xEventGroupSetBitsFromISR(
EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t
*pxHigherPriorityTaskWoken )
Set bits (flags) within an RTOS event group. A version of set() that can be called from an interrupt service routine (ISR).
Setting bits in an event group will automatically unblock tasks that are blocked waiting for the bits.
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 non-deterministic operations to be performed in interrupts or from critical sections. Therefore xEventGroupSetBitFromISR() sends a message to the RTOS daemon task to have the set operation performed in the context of the daemon task - where a scheduler lock is used in place of a critical section.
| higherPriorityTaskWoken | As mentioned above, calling this function will result in a message being sent to the RTOS daemon task. If the priority of the daemon task is higher than the priority of the currently running task (the task the interrupt interrupted) then higherPriorityTaskWoken will be set to true by setFromISR(), indicating that a context switch should be requested before the interrupt exits. For that reason higherPriorityTaskWoken must be initialised to false. See the example code below. |
| bitsToSet | A bitwise value that indicates the bit or bits to set in the event group. |
| true | If the message was sent to the RTOS daemon task. |
| false | Otherwise or if the timer service queue was full |
Example Usage
|
inline |
Function that calls BaseType_t xEventGroupSetBitsFromISR(
EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t
*pxHigherPriorityTaskWoken )
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Function that calls EventBits_t xEventGroupSync(
EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const
EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait )
Atomically set bits (flags) within an RTOS event group, then wait for a combination of bits to be set within the same event group. This functionality is typically used to synchronize multiple tasks (often called a task rendezvous), where each task has to wait for the other tasks to reach a synchronization point before proceeding.
This function cannot be used from an interrupt.
The function will return before its block time expires if the bits specified by the bitsToWait parameter are set, or become set within that time. In this case all the bits specified by bitsToWait will be automatically cleared before the function returns.
| bitsToSet | The bit or bits to set in the event group before determining if (and possibly waiting for), all the bits specified by the bitsToWait parameter are set. |
| bitsToWaitFor | A bitwise value that indicates the bit or bits to test inside the event group. |
| ticksToWait | The maximum amount of time (specified in 'ticks') to wait for all the bits specified by the uxBitsToWaitFor parameter value to become set. |
Example Usage
|
inline |
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 )
Read bits within an RTOS event group, optionally entering the Blocked state (with a timeout) to wait for a bit or group of bits to become set.
| bitsToWaitFor | A bitwise value that indicates the bit or bits to test inside the event group. bitsToWaitFor must not be set to 0. |
| clearOnExit | If clearOnExit is set to true then any bits set in the value passed as the bitsToWaitFor parameter will be cleared in the event group before wait() returns if wait() returns for any reason other than a timeout. The timeout value is set by the ticksToWait parameter. If clearOnExit is set to false then the bits set in the event group are not altered when the call to wait() returns. |
| waitForAllBits | waitForAllBits is used to create either a logical AND test (where all bits must be set) or a logical OR test (where one or more bits must be set) as follows: If waitForAllBits is set to true then wait() will return when either all the bits set in the value passed as the bitsToWaitFor parameter are set in the event group or the specified block time expires. If waitForAllBits is set to false then wait() will return when any of the bits set in the value passed as the bitsToWaitFor parameter are set in the event group or the specified block time expires. |
| ticksToWait | The maximum amount of time (specified in 'ticks') to wait for one/all (depending on the waitForAllBits value) of the bits specified by bitsToWaitFor to become set. |
Example Usage