23#include <idfxx/chrono>
29#include <freertos/FreeRTOS.h>
30#include <freertos/event_groups.h>
79 requires(
sizeof(std::underlying_type_t<E>) <=
sizeof(
EventBits_t))
89 if (_handle ==
nullptr) {
101 if (_handle !=
nullptr) {
111 : _handle(std::exchange(other._handle,
nullptr)) {}
115 if (
this != &other) {
116 if (_handle !=
nullptr) {
119 _handle = std::exchange(other._handle,
nullptr);
141 if (_handle ==
nullptr) {
160 if (_handle ==
nullptr) {
176 if (_handle ==
nullptr) {
186#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
220 template<
typename Rep,
typename Period>
242 template<
typename Clock,
typename Duration>
246 const std::chrono::time_point<Clock, Duration>&
deadline,
282 template<
typename Rep,
typename Period>
286 const std::chrono::duration<Rep, Period>&
timeout,
306 template<
typename Clock,
typename Duration>
310 const std::chrono::time_point<Clock, Duration>&
deadline,
324#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
359 template<
typename Rep,
typename Period>
380 template<
typename Clock,
typename Duration>
419 template<
typename Rep,
typename Period>
438 template<
typename Clock,
typename Duration>
483 if (_handle ==
nullptr) {
484 return {
false,
false};
504 if (_handle ==
nullptr) {
516 if (_handle ==
nullptr) {
538 return flags<E>(
static_cast<std::underlying_type_t<E>
>(
bits));
542 if (_handle ==
nullptr) {
561 if (_handle ==
nullptr) {
Type-safe inter-task event group for bit-level synchronization.
flags< E > get() const noexcept
Returns the current event bits.
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.
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.
flags< E > clear(flags< E > bits) noexcept
Clears event bits in the event group.
flags< E > IRAM_ATTR clear_from_isr(flags< E > bits) noexcept
Clears event bits from ISR context.
result< flags< E > > try_sync(flags< E > set_bits, flags< E > wait_bits)
Atomically sets bits and waits for other bits, blocking indefinitely.
flags< E > sync(flags< E > set_bits, flags< E > wait_bits)
Atomically sets bits and waits for other bits, blocking indefinitely.
EventGroupHandle_t idf_handle() const noexcept
Returns the underlying FreeRTOS event group handle.
flags< E > IRAM_ATTR get_from_isr() const noexcept
Returns the current event bits from ISR context.
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_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.
~event_group()
Destroys the event group and releases all resources.
event_group(const event_group &)=delete
flags< E > set(flags< E > bits) noexcept
Sets event bits in the event group.
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.
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.
event_group & operator=(event_group &&other) noexcept
Move assignment.
event_group()
Creates an event group.
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.
event_group & operator=(const event_group &)=delete
event_group(event_group &&other) noexcept
Move constructor.
isr_set_result IRAM_ATTR set_from_isr(flags< E > bits) noexcept
Sets event bits from ISR context.
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.
flags< E > wait(flags< E > bits, wait_mode mode, bool clear_on_exit=true)
Waits for event bits to be set, blocking indefinitely.
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.
constexpr TickType_t ticks(const std::chrono::duration< Rep, Period > &d)
Converts a std::chrono duration to TickType_t ticks.
wait_mode
Specifies whether to wait for any or all of the requested bits.
@ any
Wait for any of the specified bits to be set.
@ all
Wait for all of the specified bits to be set.
constexpr std::unexpected< std::error_code > error(E e) noexcept
Creates an unexpected error from an error code enum.
T unwrap(result< T > result)
Throws a std::system_error if the result is an error.
@ invalid_state
Invalid state.
@ timeout
Operation timed out.
std::expected< T, std::error_code > result
result type wrapping a value or error code.
constexpr auto to_underlying(flags< E > f) noexcept
Returns the underlying integral value of a flags object.
Result of setting event bits from ISR context.
bool yield
true if a context switch should be requested.
bool success
true if the set was posted to the timer daemon task successfully.