ReactESP 3.2.0
Asynchronous programming for the ESP microcontrollers
|
Asynchronous event loop supporting timed (repeating and non-repeating), interrupt and stream events. More...
#include <event_loop.h>
Public Member Functions | |
EventLoop () | |
Construct a new EventLoop object. | |
EventLoop (const EventLoop &)=delete | |
EventLoop (EventLoop &&)=delete | |
int | getTimedEventQueueSize () |
int | getUntimedEventQueueSize () |
int | getISREventQueueSize () |
int | getEventQueueSize () |
uint64_t | getTimedEventCount () |
uint64_t | getUntimedEventCount () |
uint64_t | getEventCount () |
uint64_t | getTickCount () |
void | tick () |
DelayEvent * | onDelay (uint32_t delay, react_callback callback) |
Create a new DelayEvent. | |
DelayEvent * | onDelayMicros (uint64_t delay, react_callback callback) |
Create a new DelayEvent. | |
RepeatEvent * | onRepeat (uint32_t interval, react_callback callback) |
Create a new RepeatEvent. | |
RepeatEvent * | onRepeatMicros (uint64_t interval, react_callback callback) |
Create a new RepeatEvent. | |
StreamEvent * | onAvailable (Stream &stream, react_callback callback) |
Create a new StreamEvent. | |
ISREvent * | onInterrupt (uint8_t pin_number, int mode, react_callback callback) |
Create a new ISREvent (interrupt event) | |
TickEvent * | onTick (react_callback callback) |
Create a new TickEvent. | |
void | remove (TimedEvent *event) |
void | remove (UntimedEvent *event) |
void | remove (ISREvent *event) |
void | remove (Event *event) |
Remove an event from the list of active events. | |
Protected Member Functions | |
void | tickTimed () |
void | tickUntimed () |
Protected Attributes | |
std::priority_queue< TimedEvent *, std::vector< TimedEvent * >, TriggerTimeCompare > | timed_queue |
std::vector< UntimedEvent * > | untimed_list |
std::vector< ISREvent * > | isr_event_list |
SemaphoreHandle_t | timed_queue_mutex_ |
SemaphoreHandle_t | untimed_list_mutex_ |
SemaphoreHandle_t | isr_event_list_mutex_ |
uint64_t | timed_event_counter = 0 |
uint64_t | untimed_event_counter = 0 |
uint64_t | tick_counter = 0 |
Friends | |
class | Event |
class | TimedEvent |
class | RepeatEvent |
class | UntimedEvent |
class | ISREvent |
Asynchronous event loop supporting timed (repeating and non-repeating), interrupt and stream events.
Definition at line 14 of file event_loop.h.
|
inline |
Construct a new EventLoop object.
Definition at line 25 of file event_loop.h.
|
delete |
|
delete |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 56 of file event_loop.h.
|
inline |
|
inline |
|
inline |
|
inline |
StreamEvent * reactesp::EventLoop::onAvailable | ( | Stream & | stream, |
react_callback | callback ) |
Create a new StreamEvent.
stream | Arduino Stream object to monitor |
callback | Callback function |
Definition at line 74 of file event_loop.cpp.
DelayEvent * reactesp::EventLoop::onDelay | ( | uint32_t | delay, |
react_callback | callback ) |
Create a new DelayEvent.
delay | Delay, in milliseconds |
callback | Callback function |
Definition at line 49 of file event_loop.cpp.
DelayEvent * reactesp::EventLoop::onDelayMicros | ( | uint64_t | delay, |
react_callback | callback ) |
Create a new DelayEvent.
delay | Delay, in microseconds |
callback | Callback function |
Definition at line 55 of file event_loop.cpp.
ISREvent * reactesp::EventLoop::onInterrupt | ( | uint8_t | pin_number, |
int | mode, | ||
react_callback | callback ) |
Create a new ISREvent (interrupt event)
pin_number | GPIO pin number |
mode | One of CHANGE, RISING, FALLING |
callback | Interrupt handler to call. This should be a very simple function, ideally setting a flag variable or incrementing a counter. The function should be defined with ICACHE_RAM_ATTR. |
Definition at line 80 of file event_loop.cpp.
RepeatEvent * reactesp::EventLoop::onRepeat | ( | uint32_t | interval, |
react_callback | callback ) |
Create a new RepeatEvent.
delay | Interval, in milliseconds |
callback | Callback function |
Definition at line 61 of file event_loop.cpp.
RepeatEvent * reactesp::EventLoop::onRepeatMicros | ( | uint64_t | interval, |
react_callback | callback ) |
Create a new RepeatEvent.
delay | Interval, in microseconds |
callback | Callback function |
Definition at line 67 of file event_loop.cpp.
TickEvent * reactesp::EventLoop::onTick | ( | react_callback | callback | ) |
Create a new TickEvent.
callback | Callback function to be called at every loop execution |
Definition at line 87 of file event_loop.cpp.
void reactesp::EventLoop::remove | ( | Event * | event | ) |
Remove an event from the list of active events.
event | Event to remove |
Definition at line 114 of file event_loop.cpp.
void reactesp::EventLoop::remove | ( | ISREvent * | event | ) |
Definition at line 104 of file event_loop.cpp.
void reactesp::EventLoop::remove | ( | TimedEvent * | event | ) |
Definition at line 93 of file event_loop.cpp.
void reactesp::EventLoop::remove | ( | UntimedEvent * | event | ) |
Definition at line 95 of file event_loop.cpp.
void reactesp::EventLoop::tick | ( | ) |
Definition at line 43 of file event_loop.cpp.
|
protected |
Definition at line 7 of file event_loop.cpp.
|
protected |
|
friend |
Definition at line 15 of file event_loop.h.
|
friend |
Definition at line 19 of file event_loop.h.
|
friend |
Definition at line 17 of file event_loop.h.
|
friend |
Definition at line 16 of file event_loop.h.
|
friend |
Definition at line 18 of file event_loop.h.
|
protected |
Definition at line 142 of file event_loop.h.
|
protected |
Definition at line 147 of file event_loop.h.
|
protected |
Definition at line 151 of file event_loop.h.
|
protected |
Definition at line 149 of file event_loop.h.
|
protected |
Definition at line 135 of file event_loop.h.
|
protected |
Definition at line 145 of file event_loop.h.
|
protected |
Definition at line 150 of file event_loop.h.
|
protected |
Definition at line 139 of file event_loop.h.
|
protected |
Definition at line 146 of file event_loop.h.