3#include <freeRTOS/semphr.h>
23 if (now >= trigger_t) {
82 auto* isrre =
new ISREvent(pin_number, mode, callback);
97 auto it = std::find(this->
untimed_list.begin(), this->untimed_list.end(), event);
106 auto it = std::find(this->
isr_event_list.begin(), this->isr_event_list.end(), event);
Event that is triggered after a certain time delay.
Events are code to be called when a given condition is fulfilled.
void remove(TimedEvent *event)
DelayEvent * onDelayMicros(uint64_t delay, react_callback callback)
Create a new DelayEvent.
SemaphoreHandle_t untimed_list_mutex_
StreamEvent * onAvailable(Stream &stream, react_callback callback)
Create a new StreamEvent.
TickEvent * onTick(react_callback callback)
Create a new TickEvent.
DelayEvent * onDelay(uint32_t delay, react_callback callback)
Create a new DelayEvent.
uint64_t untimed_event_counter
std::vector< UntimedEvent * > untimed_list
RepeatEvent * onRepeatMicros(uint64_t interval, react_callback callback)
Create a new RepeatEvent.
std::priority_queue< TimedEvent *, std::vector< TimedEvent * >, TriggerTimeCompare > timed_queue
SemaphoreHandle_t timed_queue_mutex_
ISREvent * onInterrupt(uint8_t pin_number, int mode, react_callback callback)
Create a new ISREvent (interrupt event)
RepeatEvent * onRepeat(uint32_t interval, react_callback callback)
Create a new RepeatEvent.
SemaphoreHandle_t isr_event_list_mutex_
uint64_t timed_event_counter
std::vector< ISREvent * > isr_event_list
Event that is triggered on an input pin change.
Event that is triggered repeatedly.
Event that is triggered when there is input available at the given Arduino Stream.
Event that is triggered unconditionally at each execution loop.
TimedEvents are called based on elapsing of time.
uint64_t getTriggerTimeMicros() const
Events that are triggered based on something else than time.
std::function< void()> react_callback
uint64_t ICACHE_RAM_ATTR micros64()
Return the current time since the device restart in microseconds.
virtual void tick(EventLoop *event_loop)=0