|
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 &&other) noexcept | |
| Move constructor. | |
| event_group & | operator= (event_group &&other) noexcept |
| Move assignment. | |
| 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. | |
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.
This type is non-copyable and move-only. Result-returning methods on a moved-from object return errc::invalid_state. Simple accessors return default/null values.
| 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::bad_alloc | if memory allocation fails. |
Definition at line 87 of file event_group.hpp.
|
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 100 of file event_group.hpp.
|
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 159 of file event_group.hpp.
References idfxx::to_underlying().
|
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 503 of file event_group.hpp.
References idfxx::to_underlying().
|
inlinenoexcept |
Returns the current event bits.
Definition at line 175 of file event_group.hpp.
|
inlinenoexcept |
Returns the current event bits from ISR context.
Definition at line 515 of file event_group.hpp.
|
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 534 of file event_group.hpp.
|
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 140 of file event_group.hpp.
References idfxx::to_underlying().
|
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 482 of file event_group.hpp.
References idfxx::to_underlying().
|
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 342 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 361 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 382 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 402 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 421 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 440 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 264 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 283 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 307 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 200 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 222 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 243 of file event_group.hpp.
References idfxx::unwrap().