|
idfxx 1.0.0
Modern C++23 components for ESP-IDF
|
Type-safe inter-task event group for bit-level synchronization. More...
Classes | |
| struct | isr_set_result |
| Result of setting event bits from ISR context. More... | |
Public Member Functions | |
| event_group () | |
| Creates an event group. | |
| ~event_group () | |
| Destroys the event group and releases all resources. | |
| event_group (const event_group &)=delete | |
| event_group & | operator= (const event_group &)=delete |
| event_group (event_group &&)=delete | |
| event_group & | operator= (event_group &&)=delete |
| flags< E > | set (flags< E > bits) noexcept |
| Sets event bits in the event group. | |
| flags< E > | clear (flags< E > bits) noexcept |
| Clears event bits in the event group. | |
| flags< E > | get () const noexcept |
| Returns the current event bits. | |
| flags< E > | wait (flags< E > bits, wait_mode mode, bool clear_on_exit=true) |
| Waits for event bits to be set, blocking indefinitely. | |
| template<typename Rep , typename Period > | |
| flags< E > | wait (flags< E > bits, wait_mode mode, const std::chrono::duration< Rep, Period > &timeout, bool clear_on_exit=true) |
| Waits for event bits to be set, with a timeout. | |
| template<typename Clock , typename Duration > | |
| flags< E > | wait_until (flags< E > bits, wait_mode mode, const std::chrono::time_point< Clock, Duration > &deadline, bool clear_on_exit=true) |
| Waits for event bits to be set, with a deadline. | |
| result< flags< E > > | try_wait (flags< E > bits, wait_mode mode, bool clear_on_exit=true) |
| Waits for event bits to be set, blocking indefinitely. | |
| template<typename Rep , typename Period > | |
| result< flags< E > > | try_wait (flags< E > bits, wait_mode mode, const std::chrono::duration< Rep, Period > &timeout, bool clear_on_exit=true) |
| Waits for event bits to be set, with a timeout. | |
| template<typename Clock , typename Duration > | |
| result< flags< E > > | try_wait_until (flags< E > bits, wait_mode mode, const std::chrono::time_point< Clock, Duration > &deadline, bool clear_on_exit=true) |
| Waits for event bits to be set, with a deadline. | |
| flags< E > | sync (flags< E > set_bits, flags< E > wait_bits) |
| Atomically sets bits and waits for other bits, blocking indefinitely. | |
| template<typename Rep , typename Period > | |
| flags< E > | sync (flags< E > set_bits, flags< E > wait_bits, const std::chrono::duration< Rep, Period > &timeout) |
| Atomically sets bits and waits for other bits, with a timeout. | |
| template<typename Clock , typename Duration > | |
| flags< E > | sync_until (flags< E > set_bits, flags< E > wait_bits, const std::chrono::time_point< Clock, Duration > &deadline) |
| Atomically sets bits and waits for other bits, with a deadline. | |
| result< flags< E > > | try_sync (flags< E > set_bits, flags< E > wait_bits) |
| Atomically sets bits and waits for other bits, blocking indefinitely. | |
| template<typename Rep , typename Period > | |
| result< flags< E > > | try_sync (flags< E > set_bits, flags< E > wait_bits, const std::chrono::duration< Rep, Period > &timeout) |
| Atomically sets bits and waits for other bits, with a timeout. | |
| template<typename Clock , typename Duration > | |
| result< flags< E > > | try_sync_until (flags< E > set_bits, flags< E > wait_bits, const std::chrono::time_point< Clock, Duration > &deadline) |
| Atomically sets bits and waits for other bits, with a deadline. | |
| isr_set_result IRAM_ATTR | set_from_isr (flags< E > bits) noexcept |
| Sets event bits from ISR context. | |
| flags< E > IRAM_ATTR | clear_from_isr (flags< E > bits) noexcept |
| Clears event bits from ISR context. | |
| flags< E > IRAM_ATTR | get_from_isr () const noexcept |
| Returns the current event bits from ISR context. | |
| EventGroupHandle_t | idf_handle () const noexcept |
| Returns the underlying FreeRTOS event group handle. | |
Static Public Member Functions | |
| static result< std::unique_ptr< event_group > > | make () |
| Creates an event group. | |
Type-safe inter-task event group for bit-level synchronization.
A fixed set of event bits that can be set, cleared, and waited upon across tasks and ISRs. Event bits are represented as a flags<E> value, providing full type safety.
Event groups are non-copyable and non-movable. Use the factory method make() for result-based construction or the throwing constructor when exceptions are enabled.
| E | The flag enum type (must satisfy flag_enum concept). The underlying type must fit within EventBits_t. |
Definition at line 80 of file event_group.hpp.
|
inline |
Creates an event group.
| std::system_error | with idfxx::errc::no_mem if memory allocation fails. |
Definition at line 89 of file event_group.hpp.
References idfxx::no_mem.
|
inline |
Destroys the event group and releases all resources.
Any tasks blocked waiting on this event group are unblocked and receive a return value of zero.
Definition at line 117 of file event_group.hpp.
|
delete |
|
delete |
|
inlinenoexcept |
Clears event bits in the event group.
Clears the specified bits. This operation always succeeds and never blocks.
| bits | The bits to clear. |
Definition at line 161 of file event_group.hpp.
References idfxx::flags< E >::from_raw().
|
inlinenoexcept |
Clears event bits from ISR context.
Clearing bits from an ISR is deferred via xEventGroupClearBitsFromISR. The returned value is the bits before the deferred clear takes effect.
| bits | The bits to clear. |
Definition at line 496 of file event_group.hpp.
References idfxx::flags< E >::from_raw().
|
inlinenoexcept |
Returns the current event bits.
Definition at line 174 of file event_group.hpp.
References idfxx::flags< E >::from_raw().
|
inlinenoexcept |
Returns the current event bits from ISR context.
Definition at line 507 of file event_group.hpp.
References idfxx::flags< E >::from_raw().
|
inlinenoexcept |
Returns the underlying FreeRTOS event group handle.
Provides access to the raw handle for interoperability with ESP-IDF APIs that require an EventGroupHandle_t.
Definition at line 523 of file event_group.hpp.
|
inlinestatic |
Creates an event group.
| no_mem | Memory allocation failed. |
Definition at line 103 of file event_group.hpp.
References idfxx::error(), and idfxx::no_mem.
|
delete |
|
delete |
|
inlinenoexcept |
Sets event bits in the event group.
Sets the specified bits. Any tasks waiting for these bits are unblocked if their wait condition is now satisfied.
This operation always succeeds and never blocks.
| bits | The bits to set. |
Definition at line 145 of file event_group.hpp.
References idfxx::flags< E >::from_raw().
|
inlinenoexcept |
Sets event bits from ISR context.
Setting bits from an ISR is deferred to the timer daemon task via xEventGroupSetBitsFromISR. The operation may fail if the timer command queue is full.
| bits | The bits to set. |
Definition at line 478 of file event_group.hpp.
|
inline |
Atomically sets bits and waits for other bits, blocking indefinitely.
Sets the specified bits and then waits for all of the wait bits to be set. This is used for task rendezvous — multiple tasks each set their own bit and wait for all bits to be set.
The bits set by this call and the bits waited for are automatically cleared before the function returns.
| set_bits | The bits to set before waiting. |
| wait_bits | The bits to wait for (all must be set). |
| std::system_error | with idfxx::errc::timeout if the wait condition is not satisfied. |
Definition at line 338 of file event_group.hpp.
References idfxx::unwrap().
|
inline |
Atomically sets bits and waits for other bits, with a timeout.
Sets the specified bits and then waits for all of the wait bits to be set.
| Rep | The representation type of the duration. |
| Period | The period type of the duration. |
| set_bits | The bits to set before waiting. |
| wait_bits | The bits to wait for (all must be set). |
| timeout | Maximum time to wait. |
| std::system_error | with idfxx::errc::timeout if the wait condition is not satisfied within the timeout. |
Definition at line 357 of file event_group.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Atomically sets bits and waits for other bits, with a deadline.
Sets the specified bits and then waits for all of the wait bits to be set.
| Clock | The clock type. |
| Duration | The duration type of the time point. |
| set_bits | The bits to set before waiting. |
| wait_bits | The bits to wait for (all must be set). |
| deadline | The time point at which to stop waiting. |
| std::system_error | with idfxx::errc::timeout if the wait condition is not satisfied before the deadline. |
Definition at line 378 of file event_group.hpp.
References idfxx::unwrap().
|
inline |
Atomically sets bits and waits for other bits, blocking indefinitely.
Sets the specified bits and then waits for all of the wait bits to be set. This is used for task rendezvous — multiple tasks each set their own bit and wait for all bits to be set.
The bits set by this call and the bits waited for are automatically cleared before the function returns.
| set_bits | The bits to set before waiting. |
| wait_bits | The bits to wait for (all must be set). |
| timeout | The wait condition was not satisfied. |
Definition at line 398 of file event_group.hpp.
|
inline |
Atomically sets bits and waits for other bits, with a timeout.
Sets the specified bits and then waits for all of the wait bits to be set.
| Rep | The representation type of the duration. |
| Period | The period type of the duration. |
| set_bits | The bits to set before waiting. |
| wait_bits | The bits to wait for (all must be set). |
| timeout | Maximum time to wait. |
| timeout | The wait condition was not satisfied within the timeout. |
Definition at line 417 of file event_group.hpp.
References idfxx::chrono::ticks(), and idfxx::timeout.
|
inline |
Atomically sets bits and waits for other bits, with a deadline.
Sets the specified bits and then waits for all of the wait bits to be set.
| Clock | The clock type. |
| Duration | The duration type of the time point. |
| set_bits | The bits to set before waiting. |
| wait_bits | The bits to wait for (all must be set). |
| deadline | The time point at which to stop waiting. |
| timeout | The wait condition was not satisfied before the deadline. |
Definition at line 436 of file event_group.hpp.
References idfxx::chrono::ticks().
|
inline |
Waits for event bits to be set, blocking indefinitely.
Blocks until the wait condition is satisfied.
| bits | The bits to wait for. |
| mode | Whether to wait for any or all of the specified bits. |
| clear_on_exit | If true, the waited-for bits are cleared before returning. |
| timeout | The wait condition was not satisfied. |
Definition at line 260 of file event_group.hpp.
|
inline |
Waits for event bits to be set, with a timeout.
Blocks until the wait condition is satisfied or the timeout expires.
| Rep | The representation type of the duration. |
| Period | The period type of the duration. |
| bits | The bits to wait for. |
| mode | Whether to wait for any or all of the specified bits. |
| timeout | Maximum time to wait. |
| clear_on_exit | If true, the waited-for bits are cleared before returning. |
| timeout | The wait condition was not satisfied within the timeout. |
Definition at line 279 of file event_group.hpp.
References idfxx::chrono::ticks(), and idfxx::timeout.
|
inline |
Waits for event bits to be set, with a deadline.
Blocks until the wait condition is satisfied or the deadline is reached.
| Clock | The clock type. |
| Duration | The duration type of the time point. |
| bits | The bits to wait for. |
| mode | Whether to wait for any or all of the specified bits. |
| deadline | The time point at which to stop waiting. |
| clear_on_exit | If true, the waited-for bits are cleared before returning. |
| timeout | The wait condition was not satisfied before the deadline. |
Definition at line 303 of file event_group.hpp.
References idfxx::chrono::ticks().
|
inline |
Waits for event bits to be set, blocking indefinitely.
Blocks until the wait condition is satisfied.
| bits | The bits to wait for. |
| mode | Whether to wait for any or all of the specified bits. |
| clear_on_exit | If true, the waited-for bits are cleared before returning. |
| std::system_error | with idfxx::errc::timeout if the wait condition is not satisfied. |
Definition at line 196 of file event_group.hpp.
References idfxx::unwrap().
|
inline |
Waits for event bits to be set, with a timeout.
Blocks until the wait condition is satisfied or the timeout expires.
| Rep | The representation type of the duration. |
| Period | The period type of the duration. |
| bits | The bits to wait for. |
| mode | Whether to wait for any or all of the specified bits. |
| timeout | Maximum time to wait. |
| clear_on_exit | If true, the waited-for bits are cleared before returning. |
| std::system_error | with idfxx::errc::timeout if the wait condition is not satisfied within the timeout. |
Definition at line 218 of file event_group.hpp.
References idfxx::timeout, and idfxx::unwrap().
|
inline |
Waits for event bits to be set, with a deadline.
Blocks until the wait condition is satisfied or the deadline is reached.
| Clock | The clock type. |
| Duration | The duration type of the time point. |
| bits | The bits to wait for. |
| mode | Whether to wait for any or all of the specified bits. |
| deadline | The time point at which to stop waiting. |
| clear_on_exit | If true, the waited-for bits are cleared before returning. |
| std::system_error | with idfxx::errc::timeout if the wait condition is not satisfied before the deadline. |
Definition at line 239 of file event_group.hpp.
References idfxx::unwrap().