|
ReactESP 3.3.1
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 Types | |
| using | TimedEventSet = std::set<TimedEvent*, TriggerTimeCompare> |
Protected Member Functions | |
| void | tickTimed () |
| void | tickUntimed () |
Protected Attributes | |
| TimedEventSet | timed_events_ |
| 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 15 of file event_loop.h.
|
protected |
Definition at line 139 of file event_loop.h.
|
inline |
Construct a new EventLoop object.
Definition at line 26 of file event_loop.h.
|
delete |
|
delete |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 57 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 94 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 69 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 75 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 100 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 81 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 87 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 107 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 134 of file event_loop.cpp.
| void reactesp::EventLoop::remove | ( | ISREvent * | event | ) |
| void reactesp::EventLoop::remove | ( | TimedEvent * | event | ) |
Definition at line 113 of file event_loop.cpp.
| void reactesp::EventLoop::remove | ( | UntimedEvent * | event | ) |
| void reactesp::EventLoop::tick | ( | ) |
|
protected |
Definition at line 7 of file event_loop.cpp.
|
protected |
Definition at line 54 of file event_loop.cpp.
|
friend |
Definition at line 16 of file event_loop.h.
|
friend |
Definition at line 20 of file event_loop.h.
|
friend |
Definition at line 18 of file event_loop.h.
|
friend |
Definition at line 17 of file event_loop.h.
|
friend |
Definition at line 19 of file event_loop.h.
|
protected |
Definition at line 147 of file event_loop.h.
|
protected |
Definition at line 152 of file event_loop.h.
|
protected |
Definition at line 156 of file event_loop.h.
|
protected |
Definition at line 154 of file event_loop.h.
|
protected |
Definition at line 140 of file event_loop.h.
|
protected |
Definition at line 150 of file event_loop.h.
|
protected |
Definition at line 155 of file event_loop.h.
|
protected |
Definition at line 144 of file event_loop.h.
|
protected |
Definition at line 151 of file event_loop.h.