oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ove::EventGroup Class Reference

RAII wrapper around an oveRTOS event-group (bit-field synchronisation object). More...

#include <eventgroup.hpp>

Public Member Functions

 EventGroup ()
 Constructs and initialises the event group with all bits cleared.
 
 ~EventGroup ()
 Destroys the event group, releasing the underlying kernel resource.
 
 EventGroup (const EventGroup &)=delete
 
EventGroupoperator= (const EventGroup &)=delete
 
 EventGroup (EventGroup &&other) noexcept
 Move constructor — transfers ownership of the kernel handle.
 
EventGroupoperator= (EventGroup &&other) noexcept
 Move-assignment operator — transfers ownership of the kernel handle.
 
ove_eventbits_t set_bits (ove_eventbits_t bits)
 Sets one or more event bits atomically.
 
ove_eventbits_t clear_bits (ove_eventbits_t bits)
 Clears one or more event bits atomically.
 
int wait_bits (ove_eventbits_t bits, uint32_t flags, uint32_t timeout_ms, ove_eventbits_t *result)
 Waits until the specified event bits are set, or until the timeout expires.
 
ove_eventbits_t set_bits_from_isr (ove_eventbits_t bits)
 Sets one or more event bits from an ISR context.
 
ove_eventbits_t get_bits () const
 Returns the current value of all event bits without blocking.
 
bool valid () const
 Returns true if the underlying kernel handle is non-null.
 
ove_eventgroup_t handle () const
 Returns the raw oveRTOS event-group handle.
 

Detailed Description

RAII wrapper around an oveRTOS event-group (bit-field synchronisation object).

An event group holds a set of event bits that tasks and ISRs can set, clear, and wait on. Multiple bits can be waited on simultaneously with optional all-bits-set or any-bit-set semantics, controlled by the flags parameter of wait_bits().

Note
Not copyable. Move-only when heap allocation is enabled.
set_bits_from_isr() is safe to call from interrupt context.

Constructor & Destructor Documentation

◆ EventGroup() [1/2]

ove::EventGroup::EventGroup ( )
inline

Constructs and initialises the event group with all bits cleared.

Asserts at startup if initialisation fails.

◆ EventGroup() [2/2]

ove::EventGroup::EventGroup ( EventGroup &&  other)
inlinenoexcept

Move constructor — transfers ownership of the kernel handle.

Parameters
otherThe source; its handle is set to null after the move.

Member Function Documentation

◆ operator=()

EventGroup & ove::EventGroup::operator= ( EventGroup &&  other)
inlinenoexcept

Move-assignment operator — transfers ownership of the kernel handle.

Parameters
otherThe source; its handle is set to null after the move.
Returns
Reference to this object.

◆ set_bits()

ove_eventbits_t ove::EventGroup::set_bits ( ove_eventbits_t  bits)
inline

Sets one or more event bits atomically.

Parameters
[in]bitsBitmask of bits to set.
Returns
The value of the event group after the bits were set.

◆ clear_bits()

ove_eventbits_t ove::EventGroup::clear_bits ( ove_eventbits_t  bits)
inline

Clears one or more event bits atomically.

Parameters
[in]bitsBitmask of bits to clear.
Returns
The value of the event group before the bits were cleared.

◆ wait_bits()

int ove::EventGroup::wait_bits ( ove_eventbits_t  bits,
uint32_t  flags,
uint32_t  timeout_ms,
ove_eventbits_t *  result 
)
inline

Waits until the specified event bits are set, or until the timeout expires.

Parameters
[in]bitsBitmask of bits to wait for.
[in]flagsWait flags (e.g., wait-for-all vs. wait-for-any).
[in]timeout_msMaximum time to wait in milliseconds.
[out]resultReceives the event-group value at the moment the wait condition was satisfied (or on timeout).
Returns
OVE_OK on success, or a negative error code on timeout/failure.

◆ set_bits_from_isr()

ove_eventbits_t ove::EventGroup::set_bits_from_isr ( ove_eventbits_t  bits)
inline

Sets one or more event bits from an ISR context.

Parameters
[in]bitsBitmask of bits to set.
Returns
The value of the event group after the bits were set.

◆ get_bits()

ove_eventbits_t ove::EventGroup::get_bits ( ) const
inline

Returns the current value of all event bits without blocking.

Returns
The current event-group bitmask.

◆ valid()

bool ove::EventGroup::valid ( ) const
inline

Returns true if the underlying kernel handle is non-null.

Returns
true when the event group was successfully initialised.

◆ handle()

ove_eventgroup_t ove::EventGroup::handle ( ) const
inline

Returns the raw oveRTOS event-group handle.

Returns
The opaque ove_eventgroup_t handle.

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