7 #ifndef ZPP_INCLUDE_ZPP_POLL_EVENT_HPP
8 #define ZPP_INCLUDE_ZPP_POLL_EVENT_HPP
12 #include <zephyr/kernel.h>
13 #include <zephyr/sys/__assert.h>
50 __ASSERT_NO_MSG(m_event !=
nullptr);
58 __ASSERT_NO_MSG(m_event !=
nullptr);
60 m_event->obj =
nullptr;
61 m_event->state = K_POLL_STATE_NOT_READY;
62 m_event->mode = K_POLL_MODE_NOTIFY_ONLY;
63 m_event->type = K_POLL_TYPE_IGNORE;
74 __ASSERT_NO_MSG(m_event !=
nullptr);
75 k_poll_event_init(m_event,
76 K_POLL_TYPE_SEM_AVAILABLE,
77 K_POLL_MODE_NOTIFY_ONLY,
89 __ASSERT_NO_MSG(m_event !=
nullptr);
90 k_poll_event_init(m_event,
91 K_POLL_TYPE_SEM_AVAILABLE,
92 K_POLL_MODE_NOTIFY_ONLY,
102 template<
typename T_FifoItem>
105 __ASSERT_NO_MSG(m_event !=
nullptr);
106 k_poll_event_init(m_event,
107 K_POLL_TYPE_FIFO_DATA_AVAILABLE,
108 K_POLL_MODE_NOTIFY_ONLY,
118 template<
typename T_FifoItem>
121 __ASSERT_NO_MSG(m_event !=
nullptr);
122 k_poll_event_init(m_event,
123 K_POLL_TYPE_FIFO_DATA_AVAILABLE,
124 K_POLL_MODE_NOTIFY_ONLY,
136 __ASSERT_NO_MSG(m_event !=
nullptr);
137 k_poll_event_init(m_event,
139 K_POLL_MODE_NOTIFY_ONLY,
151 __ASSERT_NO_MSG(m_event !=
nullptr);
152 k_poll_event_init(m_event,
154 K_POLL_MODE_NOTIFY_ONLY,
167 __ASSERT_NO_MSG(m_event !=
nullptr);
174 return (m_event->state & K_POLL_STATE_SEM_AVAILABLE);
176 return (m_event->state & K_POLL_STATE_FIFO_DATA_AVAILABLE);
178 return (m_event->state & K_POLL_STATE_SIGNALED);
191 __ASSERT_NO_MSG(m_event !=
nullptr);
193 m_event->state = K_POLL_STATE_NOT_READY;
203 __ASSERT_NO_MSG(m_event !=
nullptr);
206 if (m_event->state & K_POLL_STATE_CANCELLED) {
221 template<
typename T_FifoItemType>
224 __ASSERT_NO_MSG(m_event !=
nullptr);
226 __ASSERT_NO_MSG(m_event->fifo !=
nullptr);
240 __ASSERT_NO_MSG(m_event !=
nullptr);
242 __ASSERT_NO_MSG(m_event->sem !=
nullptr);
256 __ASSERT_NO_MSG(m_event !=
nullptr);
258 __ASSERT_NO_MSG(m_event->signal !=
nullptr);
263 k_poll_event* m_event{
nullptr };
fifo that references a k_fifo object
fifo that manages a k_fifo object
wrapper class around a k_poll_event
void assign(fifo< T_FifoItem > &f) noexcept
assign a fifo to this event
void assign(fifo_ref< T_FifoItem > &f) noexcept
assign a fifo to this event
void assign(poll_signal &s) noexcept
assign a signal to this event
poll_event & operator=(poll_event &&)=delete
auto fifo() noexcept
get access to the fifo of the event
void assign(std::nullptr_t) noexcept
assign a null event (that will be ignored when polling)
auto signal() noexcept
get access to the signal of the event
void assign(sem &s) noexcept
assign a semaphore to this event
type_tag
type of event sources
bool is_ready() noexcept
check if this event is ready
auto sem() noexcept
get access to the sem of the event
void assign(poll_signal_ref &s) noexcept
assign a signal to this event
poll_event(poll_event &&)=delete
poll_event(k_poll_event *event) noexcept
wrap a k_poll_event pointer
bool is_cancelled() noexcept
check if this event is cancelled
poll_event & operator=(const poll_event &)=delete
void reset() noexcept
reset event to non ready state
poll_event(const poll_event &)=delete
void assign(sem_ref &s) noexcept
assign a semaphore to this event
class wrapping a k_poll_signal
class owning a k_poll_signal
A counting semaphore class borrowing the native sem.
A counting semaphore class.