diff --git a/.bumpversion.cfg b/.bumpversion.cfg index a3a8cec..26632b1 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.0.1-alpha +current_version = 3.0.1 commit = True tag = False parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\-(?P[a-z]+))? diff --git a/Doxyfile b/Doxyfile index f85e06b..0f7d5a4 100644 --- a/Doxyfile +++ b/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = ReactESP # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 3.0.1-alpha +PROJECT_NUMBER = 3.0.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/VERSION b/VERSION index 2f0813a..cb2b00e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.1-alpha +3.0.1 diff --git a/docs/generated/docs/_react_e_s_p_8cpp.html b/docs/generated/docs/_react_e_s_p_8cpp.html index 89b8062..566a7a3 100644 --- a/docs/generated/docs/_react_e_s_p_8cpp.html +++ b/docs/generated/docs/_react_e_s_p_8cpp.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/_react_e_s_p_8cpp_source.html b/docs/generated/docs/_react_e_s_p_8cpp_source.html index d5fd6b4..c297d3b 100644 --- a/docs/generated/docs/_react_e_s_p_8cpp_source.html +++ b/docs/generated/docs/_react_e_s_p_8cpp_source.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -117,260 +117,263 @@
8namespace reactesp {
9
-
10// Event classes define the behaviour of each particular
-
11// Event
-
12
-
-
13bool TimedEvent::operator<(const TimedEvent& other) const {
-
14 return (this->last_trigger_time + this->interval) <
-
15 (other.last_trigger_time + other.interval);
-
16}
+
17#ifdef ESP32
+
18uint64_t ICACHE_RAM_ATTR micros64() { return esp_timer_get_time(); }
+
19#endif
+
20
+
21// Event classes define the behaviour of each particular
+
22// Event
+
23
+
+
24bool TimedEvent::operator<(const TimedEvent& other) const {
+
25 return (this->last_trigger_time + this->interval) <
+
26 (other.last_trigger_time + other.interval);
+
27}
-
17
-
- -
19 event_loop->timed_queue.push(this);
-
20}
-
-
21
-
- -
23 this->enabled = false;
-
24 // the object will be deleted when it's popped out of the
-
25 // timer queue
-
26}
-
-
27
-
-
28DelayEvent::DelayEvent(uint32_t delay, react_callback callback)
-
29 : TimedEvent(delay, callback) {
-
30 this->last_trigger_time = micros();
+
28
+
+ +
30 event_loop->timed_queue.push(this);
31}
32
-
33DelayEvent::DelayEvent(uint64_t delay, react_callback callback)
-
34 : TimedEvent(delay, callback) {
-
35 this->last_trigger_time = micros();
-
36}
+ +
34 this->enabled = false;
+
35 // the object will be deleted when it's popped out of the
+
36 // timer queue
+
37}
-
37
-
- -
39 this->last_trigger_time = micros();
-
40 this->callback();
-
41 delete this;
+
38
+
+
39DelayEvent::DelayEvent(uint32_t delay, react_callback callback)
+
40 : TimedEvent(delay, callback) {
+
41 this->last_trigger_time = micros64();
42}
43
- -
45 auto now = micros();
-
46 this->last_trigger_time = this->last_trigger_time + this->interval;
-
47 if (this->last_trigger_time + this->interval < now) {
-
48 // we're lagging more than one full interval; reset the time
-
49 this->last_trigger_time = now;
-
50 }
+
44DelayEvent::DelayEvent(uint64_t delay, react_callback callback)
+
45 : TimedEvent(delay, callback) {
+
46 this->last_trigger_time = micros64();
+
47}
+
+
48
+
+ +
50 this->last_trigger_time = micros64();
51 this->callback();
-
52 event_loop->timed_queue.push(this);
+
52 delete this;
53}
54
- -
56 event_loop->untimed_list.push_front(this);
-
57}
+ +
56 auto now = micros64();
+
57 this->last_trigger_time = this->last_trigger_time + this->interval;
+
58 if (this->last_trigger_time + this->interval < now) {
+
59 // we're lagging more than one full interval; reset the time
+
60 this->last_trigger_time = now;
+
61 }
+
62 this->callback();
+
63 event_loop->timed_queue.push(this);
+
64}
-
58
-
- -
60 event_loop->untimed_list.remove(this);
-
61 delete this;
-
62}
-
-
63
-
- -
65 if (0 != stream.available()) {
-
66 this->callback();
-
67 }
+
65
+
+ +
67 event_loop->untimed_list.push_front(this);
68}
69
- -
71
-
72#ifdef ESP32
-
73bool ISREvent::isr_service_installed = false;
+
+ +
71 event_loop->untimed_list.remove(this);
+
72 delete this;
+
73}
+
74
-
75void ISREvent::isr(void* this_ptr) {
-
76 auto* this_ = static_cast<ISREvent*>(this_ptr);
-
77 this_->callback();
-
78}
-
79#endif
+
+ +
76 if (0 != stream.available()) {
+
77 this->callback();
+
78 }
+
79}
+
80
-
- -
82#ifdef ESP32
-
83 gpio_isr_handler_add((gpio_num_t)pin_number, ISREvent::isr, (void*)this);
-
84#elif defined(ESP8266)
-
85 attachInterrupt(digitalPinToInterrupt(pin_number), callback, mode);
-
86#endif
-
87 event_loop->isr_event_list.push_front(this);
-
88}
+ +
82
+
83#ifdef ESP32
+
84bool ISREvent::isr_service_installed = false;
+
85
+
86void ISREvent::isr(void* this_ptr) {
+
87 auto* this_ = static_cast<ISREvent*>(this_ptr);
+
88 this_->callback();
+
89}
+
90#endif
+
91
+
+ +
93#ifdef ESP32
+
94 gpio_isr_handler_add((gpio_num_t)pin_number, ISREvent::isr, (void*)this);
+
95#elif defined(ESP8266)
+
96 attachInterrupt(digitalPinToInterrupt(pin_number), callback, mode);
+
97#endif
+
98 event_loop->isr_event_list.push_front(this);
+
99}
-
89
-
- -
91 event_loop->isr_event_list.remove(this);
-
92#ifdef ESP32
-
93 gpio_isr_handler_remove((gpio_num_t)pin_number);
-
94#elif defined(ESP8266)
-
95 detachInterrupt(digitalPinToInterrupt(this->pin_number));
-
96#endif
-
97 delete this;
-
98}
+
100
+
+ +
102 event_loop->isr_event_list.remove(this);
+
103#ifdef ESP32
+
104 gpio_isr_handler_remove((gpio_num_t)pin_number);
+
105#elif defined(ESP8266)
+
106 detachInterrupt(digitalPinToInterrupt(this->pin_number));
+
107#endif
+
108 delete this;
+
109}
-
99
-
100void EventLoop::tickTimed() {
-
101 const uint64_t now = micros();
-
102 TimedEvent* top = nullptr;
-
103
-
104 while (true) {
-
105 if (timed_queue.empty()) {
-
106 break;
-
107 }
-
108
-
109 top = timed_queue.top();
-
110 if (!top->isEnabled()) {
-
111 timed_queue.pop();
-
112 delete top;
-
113 continue;
-
114 }
-
115 const uint64_t trigger_t = top->getTriggerTimeMicros();
-
116 if (now >= trigger_t) {
-
117 timed_queue.pop();
-
118 top->tick(this);
-
119 } else {
-
120 break;
-
121 }
-
122 }
-
123}
-
124
-
125void EventLoop::tickUntimed() {
-
126 for (UntimedEvent* re : this->untimed_list) {
-
127 re->tick(this);
-
128 }
-
129}
-
130
-
- -
132 tickUntimed();
-
133 tickTimed();
-
134}
+
110
+
111void EventLoop::tickTimed() {
+
112 const uint64_t now = micros64();
+
113 TimedEvent* top = nullptr;
+
114
+
115 while (true) {
+
116 if (timed_queue.empty()) {
+
117 break;
+
118 }
+
119 top = timed_queue.top();
+
120 if (!top->isEnabled()) {
+
121 timed_queue.pop();
+
122 delete top;
+
123 continue;
+
124 }
+
125 const uint64_t trigger_t = top->getTriggerTimeMicros();
+
126 if (now >= trigger_t) {
+
127 timed_queue.pop();
+
128 top->tick(this);
+
129 } else {
+
130 break;
+
131 }
+
132 }
+
133}
+
134
+
135void EventLoop::tickUntimed() {
+
136 for (UntimedEvent* re : this->untimed_list) {
+
137 re->tick(this);
+
138 }
+
139}
+
140
+
+ +
142 tickUntimed();
+
143 tickTimed();
+
144}
-
135
-
-
136DelayEvent* EventLoop::onDelay(uint32_t delay, react_callback callback) {
-
137 auto* dre = new DelayEvent(delay, callback);
-
138 dre->add(this);
-
139 return dre;
-
140}
+
145
+
+
146DelayEvent* EventLoop::onDelay(uint32_t delay, react_callback callback) {
+
147 auto* dre = new DelayEvent(delay, callback);
+
148 dre->add(this);
+
149 return dre;
+
150}
-
141
-
- -
143 react_callback callback) {
-
144 auto* dre = new DelayEvent(delay, callback);
-
145 dre->add(this);
-
146 return dre;
-
147}
+
151
+
+ +
153 react_callback callback) {
+
154 auto* dre = new DelayEvent(delay, callback);
+
155 dre->add(this);
+
156 return dre;
+
157}
-
148
-
-
149RepeatEvent* EventLoop::onRepeat(uint32_t interval, react_callback callback) {
-
150 auto* rre = new RepeatEvent(interval, callback);
-
151 rre->add(this);
-
152 return rre;
-
153}
+
158
+
+
159RepeatEvent* EventLoop::onRepeat(uint32_t interval, react_callback callback) {
+
160 auto* rre = new RepeatEvent(interval, callback);
+
161 rre->add(this);
+
162 return rre;
+
163}
-
154
-
- -
156 react_callback callback) {
-
157 auto* rre = new RepeatEvent(interval, callback);
-
158 rre->add(this);
-
159 return rre;
-
160}
+
164
+
+ +
166 react_callback callback) {
+
167 auto* rre = new RepeatEvent(interval, callback);
+
168 rre->add(this);
+
169 return rre;
+
170}
-
161
-
- -
163 auto* sre = new StreamEvent(stream, callback);
-
164 sre->add(this);
-
165 return sre;
-
166}
+
171
+
+ +
173 auto* sre = new StreamEvent(stream, callback);
+
174 sre->add(this);
+
175 return sre;
+
176}
-
167
-
-
168ISREvent* EventLoop::onInterrupt(uint8_t pin_number, int mode,
-
169 react_callback callback) {
-
170 auto* isrre = new ISREvent(pin_number, mode, callback);
-
171 isrre->add(this);
-
172 return isrre;
-
173}
+
177
+
+
178ISREvent* EventLoop::onInterrupt(uint8_t pin_number, int mode,
+
179 react_callback callback) {
+
180 auto* isrre = new ISREvent(pin_number, mode, callback);
+
181 isrre->add(this);
+
182 return isrre;
+
183}
-
174
-
- -
176 auto* tre = new TickEvent(callback);
-
177 tre->add(this);
-
178 return tre;
-
179}
+
184
+
+ +
186 auto* tre = new TickEvent(callback);
+
187 tre->add(this);
+
188 return tre;
+
189}
-
180
-
181void EventLoop::remove(Event* event) { event->remove(this); }
-
182
-
183} // namespace reactesp
+
190
+
191void EventLoop::remove(Event* event) { event->remove(this); }
+
192
+
193} // namespace reactesp
-
Event that is triggered after a certain time delay.
Definition ReactESP.h:107
-
DelayEvent(uint32_t delay, react_callback callback)
Construct a new Delay Event object.
Definition ReactESP.cpp:28
-
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:38
-
Events are code to be called when a given condition is fulfilled.
Definition ReactESP.h:36
-
const react_callback callback
Definition ReactESP.h:38
-
Main event loop of a EventLoop program.
Definition ReactESP.h:260
-
friend class UntimedEvent
Definition ReactESP.h:264
-
DelayEvent * onDelayMicros(uint64_t delay, react_callback callback)
Create a new DelayEvent.
Definition ReactESP.cpp:142
-
friend class ISREvent
Definition ReactESP.h:265
- -
StreamEvent * onAvailable(Stream &stream, react_callback callback)
Create a new StreamEvent.
Definition ReactESP.cpp:162
-
TickEvent * onTick(react_callback callback)
Create a new TickEvent.
Definition ReactESP.cpp:175
-
DelayEvent * onDelay(uint32_t delay, react_callback callback)
Create a new DelayEvent.
Definition ReactESP.cpp:136
-
RepeatEvent * onRepeatMicros(uint64_t interval, react_callback callback)
Create a new RepeatEvent.
Definition ReactESP.cpp:155
-
ISREvent * onInterrupt(uint8_t pin_number, int mode, react_callback callback)
Create a new ISREvent (interrupt event)
Definition ReactESP.cpp:168
-
RepeatEvent * onRepeat(uint32_t interval, react_callback callback)
Create a new RepeatEvent.
Definition ReactESP.cpp:149
-
void remove(Event *event)
Remove a event from the list of active events.
Definition ReactESP.cpp:181
-
friend class RepeatEvent
Definition ReactESP.h:263
-
Event that is triggered on an input pin change.
Definition ReactESP.h:202
-
void remove(EventLoop *event_loop) override
Definition ReactESP.cpp:90
-
void add(EventLoop *event_loop) override
Definition ReactESP.cpp:81
-
Event that is triggered repeatedly.
Definition ReactESP.h:130
-
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:44
-
Event that is triggered when there is input available at the given Arduino Stream.
Definition ReactESP.h:167
-
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:64
-
Event that is triggered unconditionally at each execution loop.
Definition ReactESP.h:187
-
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:70
-
TimedEvents are called based on elapsing of time.
Definition ReactESP.h:58
-
const uint64_t interval
Definition ReactESP.h:60
-
uint64_t getTriggerTimeMicros() const
Definition ReactESP.h:94
-
bool isEnabled() const
Definition ReactESP.h:97
-
void add(EventLoop *event_loop) override
Definition ReactESP.cpp:18
-
void remove(EventLoop *event_loop) override
Definition ReactESP.cpp:22
-
bool operator<(const TimedEvent &other) const
Definition ReactESP.cpp:13
-
uint64_t last_trigger_time
Definition ReactESP.h:61
- -
void add(EventLoop *event_loop) override
Definition ReactESP.cpp:55
-
void remove(EventLoop *event_loop) override
Definition ReactESP.cpp:59
+
Event that is triggered after a certain time delay.
Definition ReactESP.h:112
+
DelayEvent(uint32_t delay, react_callback callback)
Construct a new Delay Event object.
Definition ReactESP.cpp:39
+
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:49
+
Events are code to be called when a given condition is fulfilled.
Definition ReactESP.h:41
+
const react_callback callback
Definition ReactESP.h:43
+
Main event loop of a EventLoop program.
Definition ReactESP.h:265
+
friend class UntimedEvent
Definition ReactESP.h:269
+
DelayEvent * onDelayMicros(uint64_t delay, react_callback callback)
Create a new DelayEvent.
Definition ReactESP.cpp:152
+
friend class ISREvent
Definition ReactESP.h:270
+ +
StreamEvent * onAvailable(Stream &stream, react_callback callback)
Create a new StreamEvent.
Definition ReactESP.cpp:172
+
TickEvent * onTick(react_callback callback)
Create a new TickEvent.
Definition ReactESP.cpp:185
+
DelayEvent * onDelay(uint32_t delay, react_callback callback)
Create a new DelayEvent.
Definition ReactESP.cpp:146
+
RepeatEvent * onRepeatMicros(uint64_t interval, react_callback callback)
Create a new RepeatEvent.
Definition ReactESP.cpp:165
+
ISREvent * onInterrupt(uint8_t pin_number, int mode, react_callback callback)
Create a new ISREvent (interrupt event)
Definition ReactESP.cpp:178
+
RepeatEvent * onRepeat(uint32_t interval, react_callback callback)
Create a new RepeatEvent.
Definition ReactESP.cpp:159
+
void remove(Event *event)
Remove a event from the list of active events.
Definition ReactESP.cpp:191
+
friend class RepeatEvent
Definition ReactESP.h:268
+
Event that is triggered on an input pin change.
Definition ReactESP.h:207
+
void remove(EventLoop *event_loop) override
Definition ReactESP.cpp:101
+
void add(EventLoop *event_loop) override
Definition ReactESP.cpp:92
+
Event that is triggered repeatedly.
Definition ReactESP.h:135
+
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:55
+
Event that is triggered when there is input available at the given Arduino Stream.
Definition ReactESP.h:172
+
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:75
+
Event that is triggered unconditionally at each execution loop.
Definition ReactESP.h:192
+
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:81
+
TimedEvents are called based on elapsing of time.
Definition ReactESP.h:63
+
const uint64_t interval
Definition ReactESP.h:65
+
uint64_t getTriggerTimeMicros() const
Definition ReactESP.h:99
+
bool isEnabled() const
Definition ReactESP.h:102
+
void add(EventLoop *event_loop) override
Definition ReactESP.cpp:29
+
void remove(EventLoop *event_loop) override
Definition ReactESP.cpp:33
+
bool operator<(const TimedEvent &other) const
Return the current time since the device restart in microseconds.
Definition ReactESP.cpp:24
+
uint64_t last_trigger_time
Definition ReactESP.h:66
+ +
void add(EventLoop *event_loop) override
Definition ReactESP.cpp:66
+
void remove(EventLoop *event_loop) override
Definition ReactESP.cpp:70
EventLoop event_loop
Definition main.cpp:19
std::function< void()> react_callback
Definition ReactESP.h:12
diff --git a/docs/generated/docs/_react_e_s_p_8h.html b/docs/generated/docs/_react_e_s_p_8h.html index 48675ce..ca3b23e 100644 --- a/docs/generated/docs/_react_e_s_p_8h.html +++ b/docs/generated/docs/_react_e_s_p_8h.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/_react_e_s_p_8h_source.html b/docs/generated/docs/_react_e_s_p_8h_source.html index 45e0eaf..4598fe9 100644 --- a/docs/generated/docs/_react_e_s_p_8h_source.html +++ b/docs/generated/docs/_react_e_s_p_8h_source.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -125,319 +125,324 @@
16
17class EventLoop;
18
-
- -
26 virtual ~EventInterface() = default;
-
27
-
28 virtual void add(EventLoop* event_loop) = 0;
-
29 virtual void remove(EventLoop* event_loop) = 0;
-
30 virtual void tick(EventLoop* event_loop) = 0;
-
31};
-
+
19// ESP32 doesn't have the micros64 function defined
+
20#ifdef ESP32
+
21uint64_t ICACHE_RAM_ATTR micros64();
+
22#endif
+
23
+
+ +
31 virtual ~EventInterface() = default;
32
-
-
36class Event : public EventInterface {
-
37 protected:
- -
39
-
40 public:
- -
47
-
48 // Disabling copy and move semantics
-
49 Event(const Event&) = delete;
-
50 Event(Event&&) = delete;
-
51 Event& operator=(const Event&) = delete;
-
52 Event& operator=(Event&&) = delete;
-
53};
+
33 virtual void add(EventLoop* event_loop) = 0;
+
34 virtual void remove(EventLoop* event_loop) = 0;
+
35 virtual void tick(EventLoop* event_loop) = 0;
+
36};
-
54
-
-
58class TimedEvent : public Event {
-
59 protected:
-
60 const uint64_t interval;
- -
62 bool enabled;
-
63
-
64 public:
-
- -
72 : Event(callback),
-
73 interval((uint64_t)1000 * (uint64_t)interval),
-
74 last_trigger_time(micros()),
-
75 enabled(true) {}
+
37
+
+
41class Event : public EventInterface {
+
42 protected:
+ +
44
+
45 public:
+ +
52
+
53 // Disabling copy and move semantics
+
54 Event(const Event&) = delete;
+
55 Event(Event&&) = delete;
+
56 Event& operator=(const Event&) = delete;
+
57 Event& operator=(Event&&) = delete;
+
58};
-
- -
83 : Event(callback),
- -
85 last_trigger_time(micros()),
-
86 enabled(true) {}
+
59
+
+
63class TimedEvent : public Event {
+
64 protected:
+
65 const uint64_t interval;
+ +
67 bool enabled;
+
68
+
69 public:
+
+ +
77 : Event(callback),
+
78 interval((uint64_t)1000 * (uint64_t)interval),
+
79 last_trigger_time(micros64()),
+
80 enabled(true) {}
-
87
-
88 bool operator<(const TimedEvent& other) const;
-
89 void add(EventLoop* event_loop) override;
-
90 void remove(EventLoop* event_loop) override;
-
-
91 uint32_t getTriggerTime() const {
-
92 return (last_trigger_time + interval) / 1000;
-
93 }
+
+ +
88 : Event(callback),
+ +
90 last_trigger_time(micros64()),
+
91 enabled(true) {}
-
-
94 uint64_t getTriggerTimeMicros() const {
-
95 return (last_trigger_time + interval);
-
96 }
+
92
+
93 bool operator<(const TimedEvent& other) const;
+
94 void add(EventLoop* event_loop) override;
+
95 void remove(EventLoop* event_loop) override;
+
+
96 uint32_t getTriggerTime() const {
+
97 return (last_trigger_time + interval) / 1000;
+
98 }
-
97 bool isEnabled() const { return enabled; }
-
98};
+
+
99 uint64_t getTriggerTimeMicros() const {
+
100 return (last_trigger_time + interval);
+
101 }
-
99
-
- -
101 bool operator()(TimedEvent* a, TimedEvent* b) { return *b < *a; }
-
102};
+
102 bool isEnabled() const { return enabled; }
+
103};
-
103
-
-
107class DelayEvent : public TimedEvent {
-
108 public:
-
115 DelayEvent(uint32_t delay, react_callback callback);
-
122 DelayEvent(uint64_t delay, react_callback callback);
-
123
-
124 void tick(EventLoop* event_loop) override;
-
125};
+
104
+
+ +
106 bool operator()(TimedEvent* a, TimedEvent* b) { return *b < *a; }
+
107};
-
126
-
-
130class RepeatEvent : public TimedEvent {
-
131 public:
-
- - +
108
+
+
112class DelayEvent : public TimedEvent {
+
113 public:
+
120 DelayEvent(uint32_t delay, react_callback callback);
+
127 DelayEvent(uint64_t delay, react_callback callback);
+
128
+
129 void tick(EventLoop* event_loop) override;
+
130};
-
- - +
131
+
+
135class RepeatEvent : public TimedEvent {
+
136 public:
+ -
148
-
149 void tick(EventLoop* event_loop) override;
-
150};
+ -
151
-
-
155class UntimedEvent : public Event {
-
156 public:
- -
158
-
159 void add(EventLoop* event_loop) override;
-
160 void remove(EventLoop* event_loop) override;
-
161};
+
153
+
154 void tick(EventLoop* event_loop) override;
+
155};
-
162
-
-
167class StreamEvent : public UntimedEvent {
-
168 private:
-
169 Stream& stream;
-
170
-
171 public:
-
- -
179 : UntimedEvent(callback), stream(stream) {}
+
156
+
+
160class UntimedEvent : public Event {
+
161 public:
+ +
163
+
164 void add(EventLoop* event_loop) override;
+
165 void remove(EventLoop* event_loop) override;
+
166};
-
180
-
181 void tick(EventLoop* event_loop) override;
-
182};
+
167
+
+
172class StreamEvent : public UntimedEvent {
+
173 private:
+
174 Stream& stream;
+
175
+
176 public:
+
+ +
184 : UntimedEvent(callback), stream(stream) {}
-
183
-
-
187class TickEvent : public UntimedEvent {
-
188 public:
- -
195
-
196 void tick(EventLoop* event_loop) override;
-
197};
+
185
+
186 void tick(EventLoop* event_loop) override;
+
187};
-
198
-
-
202class ISREvent : public Event {
-
203 private:
-
204 const uint8_t pin_number;
-
205 const int mode;
-
206#ifdef ESP32
-
207 // set to true once gpio_install_isr_service is called
-
208 static bool isr_service_installed;
-
209 static void isr(void* this_ptr);
-
210#endif
-
211
-
212 public:
-
-
221 ISREvent(uint8_t pin_number, int mode, react_callback callback)
-
222 : Event(callback), pin_number(pin_number), mode(mode) {
-
223#ifdef ESP32
-
224 gpio_int_type_t intr_type;
-
225 switch (mode) {
-
226 case RISING:
-
227 intr_type = GPIO_INTR_POSEDGE;
-
228 break;
-
229 case FALLING:
-
230 intr_type = GPIO_INTR_NEGEDGE;
-
231 break;
-
232 case CHANGE:
-
233 intr_type = GPIO_INTR_ANYEDGE;
-
234 break;
-
235 default:
-
236 intr_type = GPIO_INTR_DISABLE;
-
237 break;
-
238 }
-
239 // configure the IO pin
-
240 gpio_set_intr_type((gpio_num_t)pin_number, intr_type);
-
241
-
242 if (!isr_service_installed) {
-
243 isr_service_installed = true;
-
244 gpio_install_isr_service(ESP_INTR_FLAG_LOWMED);
-
245 }
-
246#endif
-
247 }
+
188
+
+
192class TickEvent : public UntimedEvent {
+
193 public:
+ +
200
+
201 void tick(EventLoop* event_loop) override;
+
202};
-
248
-
249 void add(EventLoop* event_loop) override;
-
250 void remove(EventLoop* event_loop) override;
-
251 void tick(EventLoop* event_loop) override {}
-
252};
+
203
+
+
207class ISREvent : public Event {
+
208 private:
+
209 const uint8_t pin_number;
+
210 const int mode;
+
211#ifdef ESP32
+
212 // set to true once gpio_install_isr_service is called
+
213 static bool isr_service_installed;
+
214 static void isr(void* this_ptr);
+
215#endif
+
216
+
217 public:
+
+
226 ISREvent(uint8_t pin_number, int mode, react_callback callback)
+
227 : Event(callback), pin_number(pin_number), mode(mode) {
+
228#ifdef ESP32
+
229 gpio_int_type_t intr_type;
+
230 switch (mode) {
+
231 case RISING:
+
232 intr_type = GPIO_INTR_POSEDGE;
+
233 break;
+
234 case FALLING:
+
235 intr_type = GPIO_INTR_NEGEDGE;
+
236 break;
+
237 case CHANGE:
+
238 intr_type = GPIO_INTR_ANYEDGE;
+
239 break;
+
240 default:
+
241 intr_type = GPIO_INTR_DISABLE;
+
242 break;
+
243 }
+
244 // configure the IO pin
+
245 gpio_set_intr_type((gpio_num_t)pin_number, intr_type);
+
246
+
247 if (!isr_service_installed) {
+
248 isr_service_installed = true;
+
249 gpio_install_isr_service(ESP_INTR_FLAG_LOWMED);
+
250 }
+
251#endif
+
252 }
253
-
255// EventLoop main event loop implementation
-
256
-
- -
261 friend class Event;
-
262 friend class TimedEvent;
-
263 friend class RepeatEvent;
-
264 friend class UntimedEvent;
-
265 friend class ISREvent;
-
266
-
267 public:
-
- -
272 : timed_queue(), untimed_list(), isr_event_list(), isr_pending_list() {
-
273 }
+
254 void add(EventLoop* event_loop) override;
+
255 void remove(EventLoop* event_loop) override;
+
256 void tick(EventLoop* event_loop) override {}
+
257};
+
+
258
+
260// EventLoop main event loop implementation
+
261
+
+ +
266 friend class Event;
+
267 friend class TimedEvent;
+
268 friend class RepeatEvent;
+
269 friend class UntimedEvent;
+
270 friend class ISREvent;
+
271
+
272 public:
+
+ +
277 : timed_queue(), untimed_list(), isr_event_list(), isr_pending_list() {
+
278 }
-
274
-
275 // Disabling copy and move semantics
-
276 EventLoop(const EventLoop&) = delete;
-
277 EventLoop(EventLoop&&) = delete;
-
278 EventLoop& operator=(const EventLoop&) = delete;
- -
280
-
281 void tick();
-
282
-
290 DelayEvent* onDelay(uint32_t delay, react_callback callback);
-
298 DelayEvent* onDelayMicros(uint64_t delay, react_callback callback);
-
306 RepeatEvent* onRepeat(uint32_t interval, react_callback callback);
-
314 RepeatEvent* onRepeatMicros(uint64_t interval, react_callback callback);
-
322 StreamEvent* onAvailable(Stream& stream, react_callback callback);
-
333 ISREvent* onInterrupt(uint8_t pin_number, int mode,
-
334 react_callback callback);
- -
342
-
348 void remove(Event* event);
-
349
-
350 private:
-
351 std::priority_queue<TimedEvent*, std::vector<TimedEvent*>,
- -
353 timed_queue;
-
354 std::forward_list<UntimedEvent*> untimed_list;
-
355 std::forward_list<ISREvent*> isr_event_list;
-
356 std::forward_list<ISREvent*> isr_pending_list;
-
357
-
358 void tickTimed();
-
359 void tickUntimed();
-
360 void tickISR();
-
361 void add(Event* re);
-
362};
+
279
+
280 // Disabling copy and move semantics
+
281 EventLoop(const EventLoop&) = delete;
+
282 EventLoop(EventLoop&&) = delete;
+
283 EventLoop& operator=(const EventLoop&) = delete;
+ +
285
+
286 void tick();
+
287
+
295 DelayEvent* onDelay(uint32_t delay, react_callback callback);
+
303 DelayEvent* onDelayMicros(uint64_t delay, react_callback callback);
+
311 RepeatEvent* onRepeat(uint32_t interval, react_callback callback);
+
319 RepeatEvent* onRepeatMicros(uint64_t interval, react_callback callback);
+
327 StreamEvent* onAvailable(Stream& stream, react_callback callback);
+
338 ISREvent* onInterrupt(uint8_t pin_number, int mode,
+
339 react_callback callback);
+ +
347
+
353 void remove(Event* event);
+
354
+
355 private:
+
356 std::priority_queue<TimedEvent*, std::vector<TimedEvent*>,
+ +
358 timed_queue;
+
359 std::forward_list<UntimedEvent*> untimed_list;
+
360 std::forward_list<ISREvent*> isr_event_list;
+
361 std::forward_list<ISREvent*> isr_pending_list;
+
362
+
363 void tickTimed();
+
364 void tickUntimed();
+
365 void tickISR();
+
366 void add(Event* re);
+
367};
-
363
-
364// Provide compatibility aliases for the old naming scheme
-
365
- - - - - - - - -
374
-
375
-
376} // namespace reactesp
-
377
-
378#endif
-
Event that is triggered after a certain time delay.
Definition ReactESP.h:107
-
DelayEvent(uint32_t delay, react_callback callback)
Construct a new Delay Event object.
Definition ReactESP.cpp:28
-
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:38
-
Events are code to be called when a given condition is fulfilled.
Definition ReactESP.h:36
-
const react_callback callback
Definition ReactESP.h:38
+
368
+
369// Provide compatibility aliases for the old naming scheme
+
370
+ + + + + + + + +
379
+
380
+
381} // namespace reactesp
+
382
+
383#endif
+
Event that is triggered after a certain time delay.
Definition ReactESP.h:112
+
DelayEvent(uint32_t delay, react_callback callback)
Construct a new Delay Event object.
Definition ReactESP.cpp:39
+
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:49
+
Events are code to be called when a given condition is fulfilled.
Definition ReactESP.h:41
+
const react_callback callback
Definition ReactESP.h:43
Event & operator=(Event &&)=delete
Event & operator=(const Event &)=delete
-
Event(react_callback callback)
Construct a new Event object.
Definition ReactESP.h:46
+
Event(react_callback callback)
Construct a new Event object.
Definition ReactESP.h:51
Event(Event &&)=delete
Event(const Event &)=delete
-
Main event loop of a EventLoop program.
Definition ReactESP.h:260
-
DelayEvent * onDelayMicros(uint64_t delay, react_callback callback)
Create a new DelayEvent.
Definition ReactESP.cpp:142
- +
Main event loop of a EventLoop program.
Definition ReactESP.h:265
+
DelayEvent * onDelayMicros(uint64_t delay, react_callback callback)
Create a new DelayEvent.
Definition ReactESP.cpp:152
+
EventLoop(EventLoop &&)=delete
-
EventLoop()
Construct a new EventLoop object.
Definition ReactESP.h:271
-
StreamEvent * onAvailable(Stream &stream, react_callback callback)
Create a new StreamEvent.
Definition ReactESP.cpp:162
-
TickEvent * onTick(react_callback callback)
Create a new TickEvent.
Definition ReactESP.cpp:175
-
DelayEvent * onDelay(uint32_t delay, react_callback callback)
Create a new DelayEvent.
Definition ReactESP.cpp:136
-
RepeatEvent * onRepeatMicros(uint64_t interval, react_callback callback)
Create a new RepeatEvent.
Definition ReactESP.cpp:155
+
EventLoop()
Construct a new EventLoop object.
Definition ReactESP.h:276
+
StreamEvent * onAvailable(Stream &stream, react_callback callback)
Create a new StreamEvent.
Definition ReactESP.cpp:172
+
TickEvent * onTick(react_callback callback)
Create a new TickEvent.
Definition ReactESP.cpp:185
+
DelayEvent * onDelay(uint32_t delay, react_callback callback)
Create a new DelayEvent.
Definition ReactESP.cpp:146
+
RepeatEvent * onRepeatMicros(uint64_t interval, react_callback callback)
Create a new RepeatEvent.
Definition ReactESP.cpp:165
EventLoop & operator=(const EventLoop &)=delete
EventLoop & operator=(EventLoop &&)=delete
-
ISREvent * onInterrupt(uint8_t pin_number, int mode, react_callback callback)
Create a new ISREvent (interrupt event)
Definition ReactESP.cpp:168
-
RepeatEvent * onRepeat(uint32_t interval, react_callback callback)
Create a new RepeatEvent.
Definition ReactESP.cpp:149
-
void remove(Event *event)
Remove a event from the list of active events.
Definition ReactESP.cpp:181
+
ISREvent * onInterrupt(uint8_t pin_number, int mode, react_callback callback)
Create a new ISREvent (interrupt event)
Definition ReactESP.cpp:178
+
RepeatEvent * onRepeat(uint32_t interval, react_callback callback)
Create a new RepeatEvent.
Definition ReactESP.cpp:159
+
void remove(Event *event)
Remove a event from the list of active events.
Definition ReactESP.cpp:191
EventLoop(const EventLoop &)=delete
-
Event that is triggered on an input pin change.
Definition ReactESP.h:202
-
void remove(EventLoop *event_loop) override
Definition ReactESP.cpp:90
-
void tick(EventLoop *event_loop) override
Definition ReactESP.h:251
-
ISREvent(uint8_t pin_number, int mode, react_callback callback)
Construct a new ISREvent object.
Definition ReactESP.h:221
-
void add(EventLoop *event_loop) override
Definition ReactESP.cpp:81
-
Event that is triggered repeatedly.
Definition ReactESP.h:130
-
RepeatEvent(uint32_t interval, react_callback callback)
Construct a new Repeat Event object.
Definition ReactESP.h:138
-
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:44
-
RepeatEvent(uint64_t interval, react_callback callback)
Construct a new Repeat Event object.
Definition ReactESP.h:146
-
Event that is triggered when there is input available at the given Arduino Stream.
Definition ReactESP.h:167
-
StreamEvent(Stream &stream, react_callback callback)
Construct a new Stream Event object.
Definition ReactESP.h:178
-
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:64
-
Event that is triggered unconditionally at each execution loop.
Definition ReactESP.h:187
-
TickEvent(react_callback callback)
Construct a new Tick Event object.
Definition ReactESP.h:194
-
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:70
-
TimedEvents are called based on elapsing of time.
Definition ReactESP.h:58
-
const uint64_t interval
Definition ReactESP.h:60
-
uint64_t getTriggerTimeMicros() const
Definition ReactESP.h:94
-
TimedEvent(uint64_t interval, react_callback callback)
Construct a new Timed Event object.
Definition ReactESP.h:82
-
bool isEnabled() const
Definition ReactESP.h:97
-
void add(EventLoop *event_loop) override
Definition ReactESP.cpp:18
-
void remove(EventLoop *event_loop) override
Definition ReactESP.cpp:22
-
bool operator<(const TimedEvent &other) const
Definition ReactESP.cpp:13
-
uint64_t last_trigger_time
Definition ReactESP.h:61
-
uint32_t getTriggerTime() const
Definition ReactESP.h:91
-
TimedEvent(uint32_t interval, react_callback callback)
Construct a new Timed Event object.
Definition ReactESP.h:71
- -
Events that are triggered based on something else than time.
Definition ReactESP.h:155
-
UntimedEvent(react_callback callback)
Definition ReactESP.h:157
-
void add(EventLoop *event_loop) override
Definition ReactESP.cpp:55
-
void remove(EventLoop *event_loop) override
Definition ReactESP.cpp:59
+
Event that is triggered on an input pin change.
Definition ReactESP.h:207
+
void remove(EventLoop *event_loop) override
Definition ReactESP.cpp:101
+
void tick(EventLoop *event_loop) override
Definition ReactESP.h:256
+
ISREvent(uint8_t pin_number, int mode, react_callback callback)
Construct a new ISREvent object.
Definition ReactESP.h:226
+
void add(EventLoop *event_loop) override
Definition ReactESP.cpp:92
+
Event that is triggered repeatedly.
Definition ReactESP.h:135
+
RepeatEvent(uint32_t interval, react_callback callback)
Construct a new Repeat Event object.
Definition ReactESP.h:143
+
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:55
+
RepeatEvent(uint64_t interval, react_callback callback)
Construct a new Repeat Event object.
Definition ReactESP.h:151
+
Event that is triggered when there is input available at the given Arduino Stream.
Definition ReactESP.h:172
+
StreamEvent(Stream &stream, react_callback callback)
Construct a new Stream Event object.
Definition ReactESP.h:183
+
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:75
+
Event that is triggered unconditionally at each execution loop.
Definition ReactESP.h:192
+
TickEvent(react_callback callback)
Construct a new Tick Event object.
Definition ReactESP.h:199
+
void tick(EventLoop *event_loop) override
Definition ReactESP.cpp:81
+
TimedEvents are called based on elapsing of time.
Definition ReactESP.h:63
+
const uint64_t interval
Definition ReactESP.h:65
+
uint64_t getTriggerTimeMicros() const
Definition ReactESP.h:99
+
TimedEvent(uint64_t interval, react_callback callback)
Construct a new Timed Event object.
Definition ReactESP.h:87
+
bool isEnabled() const
Definition ReactESP.h:102
+
void add(EventLoop *event_loop) override
Definition ReactESP.cpp:29
+
void remove(EventLoop *event_loop) override
Definition ReactESP.cpp:33
+
bool operator<(const TimedEvent &other) const
Return the current time since the device restart in microseconds.
Definition ReactESP.cpp:24
+
uint64_t last_trigger_time
Definition ReactESP.h:66
+
uint32_t getTriggerTime() const
Definition ReactESP.h:96
+
TimedEvent(uint32_t interval, react_callback callback)
Construct a new Timed Event object.
Definition ReactESP.h:76
+ +
Events that are triggered based on something else than time.
Definition ReactESP.h:160
+
UntimedEvent(react_callback callback)
Definition ReactESP.h:162
+
void add(EventLoop *event_loop) override
Definition ReactESP.cpp:66
+
void remove(EventLoop *event_loop) override
Definition ReactESP.cpp:70
EventLoop event_loop
Definition main.cpp:19
std::function< void()> react_callback
Definition ReactESP.h:12
void(*)(void *) isr_react_callback
Definition ReactESP.h:13
-
EventInterface defines the interface for all events.
Definition ReactESP.h:22
+
EventInterface defines the interface for all events.
Definition ReactESP.h:27
virtual ~EventInterface()=default
Default virtual destructor.
virtual void add(EventLoop *event_loop)=0
virtual void tick(EventLoop *event_loop)=0
virtual void remove(EventLoop *event_loop)=0
- -
bool operator()(TimedEvent *a, TimedEvent *b)
Definition ReactESP.h:101
+ +
bool operator()(TimedEvent *a, TimedEvent *b)
Definition ReactESP.h:106
diff --git a/docs/generated/docs/annotated.html b/docs/generated/docs/annotated.html index d1587bc..a8c0a2f 100644 --- a/docs/generated/docs/annotated.html +++ b/docs/generated/docs/annotated.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/classes.html b/docs/generated/docs/classes.html index 9bd559f..b0fc3f5 100644 --- a/docs/generated/docs/classes.html +++ b/docs/generated/docs/classes.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/classreactesp_1_1_delay_event-members.html b/docs/generated/docs/classreactesp_1_1_delay_event-members.html index a248eae..fb6ef2f 100644 --- a/docs/generated/docs/classreactesp_1_1_delay_event-members.html +++ b/docs/generated/docs/classreactesp_1_1_delay_event-members.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/classreactesp_1_1_delay_event.html b/docs/generated/docs/classreactesp_1_1_delay_event.html index b4f8ac0..185b81d 100644 --- a/docs/generated/docs/classreactesp_1_1_delay_event.html +++ b/docs/generated/docs/classreactesp_1_1_delay_event.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -144,6 +144,7 @@  Construct a new Timed Event object.
  bool operator< (const TimedEvent &other) const + Return the current time since the device restart in microseconds.
  void add (EventLoop *event_loop) override   @@ -188,7 +189,7 @@

Detailed Description

Event that is triggered after a certain time delay.

-

Definition at line 107 of file ReactESP.h.

+

Definition at line 112 of file ReactESP.h.

Constructor & Destructor Documentation

◆ DelayEvent() [1/2]

@@ -218,7 +219,7 @@

Definition at line 28 of file ReactESP.cpp.

+

Definition at line 39 of file ReactESP.cpp.

@@ -250,7 +251,7 @@

Definition at line 33 of file ReactESP.cpp.

+

Definition at line 44 of file ReactESP.cpp.

@@ -280,7 +281,7 @@

reactesp::EventInterface.

-

Definition at line 38 of file ReactESP.cpp.

+

Definition at line 49 of file ReactESP.cpp.

diff --git a/docs/generated/docs/classreactesp_1_1_event-members.html b/docs/generated/docs/classreactesp_1_1_event-members.html index 8d571eb..eac8ab4 100644 --- a/docs/generated/docs/classreactesp_1_1_event-members.html +++ b/docs/generated/docs/classreactesp_1_1_event-members.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/classreactesp_1_1_event.html b/docs/generated/docs/classreactesp_1_1_event.html index 65e70b1..edc9b2f 100644 --- a/docs/generated/docs/classreactesp_1_1_event.html +++ b/docs/generated/docs/classreactesp_1_1_event.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -159,7 +159,7 @@

Detailed Description

Events are code to be called when a given condition is fulfilled.

-

Definition at line 36 of file ReactESP.h.

+

Definition at line 41 of file ReactESP.h.

Constructor & Destructor Documentation

◆ Event() [1/3]

@@ -192,7 +192,7 @@

Definition at line 46 of file ReactESP.h.

+

Definition at line 51 of file ReactESP.h.

@@ -318,7 +318,7 @@

-

Definition at line 38 of file ReactESP.h.

+

Definition at line 43 of file ReactESP.h.

diff --git a/docs/generated/docs/classreactesp_1_1_event_loop-members.html b/docs/generated/docs/classreactesp_1_1_event_loop-members.html index e29f17d..9ba8a8a 100644 --- a/docs/generated/docs/classreactesp_1_1_event_loop-members.html +++ b/docs/generated/docs/classreactesp_1_1_event_loop-members.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/classreactesp_1_1_event_loop.html b/docs/generated/docs/classreactesp_1_1_event_loop.html index f6a66dc..b3c8ca8 100644 --- a/docs/generated/docs/classreactesp_1_1_event_loop.html +++ b/docs/generated/docs/classreactesp_1_1_event_loop.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -173,7 +173,7 @@

Detailed Description

Main event loop of a EventLoop program.

-

Definition at line 260 of file ReactESP.h.

+

Definition at line 265 of file ReactESP.h.

Constructor & Destructor Documentation

◆ EventLoop() [1/3]

@@ -200,7 +200,7 @@

EventLoop object.

-

Definition at line 271 of file ReactESP.h.

+

Definition at line 276 of file ReactESP.h.

@@ -284,7 +284,7 @@

Returns
StreamEvent*
-

Definition at line 162 of file ReactESP.cpp.

+

Definition at line 172 of file ReactESP.cpp.

Here is the caller graph for this function:
@@ -322,7 +322,7 @@

Returns
DelayEvent*
-

Definition at line 136 of file ReactESP.cpp.

+

Definition at line 146 of file ReactESP.cpp.

Here is the caller graph for this function:
@@ -360,7 +360,7 @@

Returns
DelayEvent*
-

Definition at line 142 of file ReactESP.cpp.

+

Definition at line 152 of file ReactESP.cpp.

@@ -399,7 +399,7 @@

Returns
ISREvent*
-

Definition at line 168 of file ReactESP.cpp.

+

Definition at line 178 of file ReactESP.cpp.

Here is the caller graph for this function:
@@ -437,7 +437,7 @@

Returns
RepeatEvent*
-

Definition at line 149 of file ReactESP.cpp.

+

Definition at line 159 of file ReactESP.cpp.

Here is the caller graph for this function:
@@ -475,7 +475,7 @@

Returns
RepeatEvent*
-

Definition at line 155 of file ReactESP.cpp.

+

Definition at line 165 of file ReactESP.cpp.

@@ -503,7 +503,7 @@

Returns
TickEvent*
-

Definition at line 175 of file ReactESP.cpp.

+

Definition at line 185 of file ReactESP.cpp.

Here is the caller graph for this function:
@@ -585,7 +585,7 @@

Definition at line 181 of file ReactESP.cpp.

+

Definition at line 191 of file ReactESP.cpp.

@@ -604,7 +604,7 @@

-

Definition at line 131 of file ReactESP.cpp.

+

Definition at line 141 of file ReactESP.cpp.

Here is the caller graph for this function:
@@ -634,7 +634,7 @@

-

Definition at line 261 of file ReactESP.h.

+

Definition at line 266 of file ReactESP.h.

@@ -658,7 +658,7 @@

-

Definition at line 265 of file ReactESP.h.

+

Definition at line 270 of file ReactESP.h.

@@ -682,7 +682,7 @@

-

Definition at line 263 of file ReactESP.h.

+

Definition at line 268 of file ReactESP.h.

@@ -706,7 +706,7 @@

-

Definition at line 262 of file ReactESP.h.

+

Definition at line 267 of file ReactESP.h.

@@ -730,7 +730,7 @@

-

Definition at line 264 of file ReactESP.h.

+

Definition at line 269 of file ReactESP.h.

diff --git a/docs/generated/docs/classreactesp_1_1_i_s_r_event-members.html b/docs/generated/docs/classreactesp_1_1_i_s_r_event-members.html index 0dd2337..80b5ab8 100644 --- a/docs/generated/docs/classreactesp_1_1_i_s_r_event-members.html +++ b/docs/generated/docs/classreactesp_1_1_i_s_r_event-members.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/classreactesp_1_1_i_s_r_event.html b/docs/generated/docs/classreactesp_1_1_i_s_r_event.html index 85262db..a824fec 100644 --- a/docs/generated/docs/classreactesp_1_1_i_s_r_event.html +++ b/docs/generated/docs/classreactesp_1_1_i_s_r_event.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -163,7 +163,7 @@

Detailed Description

Event that is triggered on an input pin change.

-

Definition at line 202 of file ReactESP.h.

+

Definition at line 207 of file ReactESP.h.

Constructor & Destructor Documentation

◆ ISREvent()

@@ -207,7 +207,7 @@

Definition at line 221 of file ReactESP.h.

+

Definition at line 226 of file ReactESP.h.

@@ -237,7 +237,7 @@

reactesp::EventInterface.

-

Definition at line 81 of file ReactESP.cpp.

+

Definition at line 92 of file ReactESP.cpp.

@@ -266,7 +266,7 @@

reactesp::EventInterface.

-

Definition at line 90 of file ReactESP.cpp.

+

Definition at line 101 of file ReactESP.cpp.

Here is the caller graph for this function:
@@ -300,7 +300,7 @@

reactesp::EventInterface.

-

Definition at line 251 of file ReactESP.h.

+

Definition at line 256 of file ReactESP.h.

diff --git a/docs/generated/docs/classreactesp_1_1_repeat_event-members.html b/docs/generated/docs/classreactesp_1_1_repeat_event-members.html index 611102d..bd77019 100644 --- a/docs/generated/docs/classreactesp_1_1_repeat_event-members.html +++ b/docs/generated/docs/classreactesp_1_1_repeat_event-members.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/classreactesp_1_1_repeat_event.html b/docs/generated/docs/classreactesp_1_1_repeat_event.html index 253a5bb..a5d75db 100644 --- a/docs/generated/docs/classreactesp_1_1_repeat_event.html +++ b/docs/generated/docs/classreactesp_1_1_repeat_event.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -144,6 +144,7 @@  Construct a new Timed Event object.
  bool operator< (const TimedEvent &other) const + Return the current time since the device restart in microseconds.
  void add (EventLoop *event_loop) override   @@ -188,7 +189,7 @@

Detailed Description

Event that is triggered repeatedly.

-

Definition at line 130 of file ReactESP.h.

+

Definition at line 135 of file ReactESP.h.

Constructor & Destructor Documentation

◆ RepeatEvent() [1/2]

@@ -226,7 +227,7 @@

Definition at line 138 of file ReactESP.h.

+

Definition at line 143 of file ReactESP.h.

@@ -266,7 +267,7 @@

Definition at line 146 of file ReactESP.h.

+

Definition at line 151 of file ReactESP.h.

@@ -296,7 +297,7 @@

reactesp::EventInterface.

-

Definition at line 44 of file ReactESP.cpp.

+

Definition at line 55 of file ReactESP.cpp.

diff --git a/docs/generated/docs/classreactesp_1_1_stream_event-members.html b/docs/generated/docs/classreactesp_1_1_stream_event-members.html index 59a6d15..5d67ce9 100644 --- a/docs/generated/docs/classreactesp_1_1_stream_event-members.html +++ b/docs/generated/docs/classreactesp_1_1_stream_event-members.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/classreactesp_1_1_stream_event.html b/docs/generated/docs/classreactesp_1_1_stream_event.html index 5042455..046739d 100644 --- a/docs/generated/docs/classreactesp_1_1_stream_event.html +++ b/docs/generated/docs/classreactesp_1_1_stream_event.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -166,7 +166,7 @@

Detailed Description

Event that is triggered when there is input available at the given Arduino Stream.

-

Definition at line 167 of file ReactESP.h.

+

Definition at line 172 of file ReactESP.h.

Constructor & Destructor Documentation

◆ StreamEvent()

@@ -204,7 +204,7 @@

Definition at line 178 of file ReactESP.h.

+

Definition at line 183 of file ReactESP.h.

@@ -234,7 +234,7 @@

reactesp::EventInterface.

-

Definition at line 64 of file ReactESP.cpp.

+

Definition at line 75 of file ReactESP.cpp.

diff --git a/docs/generated/docs/classreactesp_1_1_tick_event-members.html b/docs/generated/docs/classreactesp_1_1_tick_event-members.html index bb40438..be9326b 100644 --- a/docs/generated/docs/classreactesp_1_1_tick_event-members.html +++ b/docs/generated/docs/classreactesp_1_1_tick_event-members.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/classreactesp_1_1_tick_event.html b/docs/generated/docs/classreactesp_1_1_tick_event.html index 52e518d..70a792d 100644 --- a/docs/generated/docs/classreactesp_1_1_tick_event.html +++ b/docs/generated/docs/classreactesp_1_1_tick_event.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -166,7 +166,7 @@

Detailed Description

Event that is triggered unconditionally at each execution loop.

-

Definition at line 187 of file ReactESP.h.

+

Definition at line 192 of file ReactESP.h.

Constructor & Destructor Documentation

◆ TickEvent()

@@ -199,7 +199,7 @@

Definition at line 194 of file ReactESP.h.

+

Definition at line 199 of file ReactESP.h.

@@ -229,7 +229,7 @@

reactesp::EventInterface.

-

Definition at line 70 of file ReactESP.cpp.

+

Definition at line 81 of file ReactESP.cpp.

diff --git a/docs/generated/docs/classreactesp_1_1_timed_event-members.html b/docs/generated/docs/classreactesp_1_1_timed_event-members.html index 924ffb0..8bf6e87 100644 --- a/docs/generated/docs/classreactesp_1_1_timed_event-members.html +++ b/docs/generated/docs/classreactesp_1_1_timed_event-members.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/classreactesp_1_1_timed_event.html b/docs/generated/docs/classreactesp_1_1_timed_event.html index 1fe5342..f214db0 100644 --- a/docs/generated/docs/classreactesp_1_1_timed_event.html +++ b/docs/generated/docs/classreactesp_1_1_timed_event.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -136,6 +136,7 @@  Construct a new Timed Event object.
  bool operator< (const TimedEvent &other) const + Return the current time since the device restart in microseconds.
  void add (EventLoop *event_loop) override   @@ -181,7 +182,7 @@

Detailed Description

TimedEvents are called based on elapsing of time.

-

Definition at line 58 of file ReactESP.h.

+

Definition at line 63 of file ReactESP.h.

Constructor & Destructor Documentation

◆ TimedEvent() [1/2]

@@ -219,7 +220,7 @@

Definition at line 71 of file ReactESP.h.

+

Definition at line 76 of file ReactESP.h.

@@ -259,7 +260,7 @@

Definition at line 82 of file ReactESP.h.

+

Definition at line 87 of file ReactESP.h.

@@ -289,7 +290,7 @@

reactesp::EventInterface.

-

Definition at line 18 of file ReactESP.cpp.

+

Definition at line 29 of file ReactESP.cpp.

@@ -316,7 +317,7 @@

-

Definition at line 91 of file ReactESP.h.

+

Definition at line 96 of file ReactESP.h.

@@ -343,7 +344,7 @@

-

Definition at line 94 of file ReactESP.h.

+

Definition at line 99 of file ReactESP.h.

@@ -370,7 +371,7 @@

-

Definition at line 97 of file ReactESP.h.

+

Definition at line 102 of file ReactESP.h.

@@ -389,7 +390,10 @@

-

Definition at line 13 of file ReactESP.cpp.

+

Return the current time since the device restart in microseconds.

+

Returns the time since the device restart. Even though the time is in microseconds, a 64-bit integer is all but guaranteed not to rewrap, ever.

+ +

Definition at line 24 of file ReactESP.cpp.

@@ -418,7 +422,7 @@

reactesp::EventInterface.

-

Definition at line 22 of file ReactESP.cpp.

+

Definition at line 33 of file ReactESP.cpp.

@@ -443,7 +447,7 @@

-

Definition at line 62 of file ReactESP.h.

+

Definition at line 67 of file ReactESP.h.

@@ -467,7 +471,7 @@

-

Definition at line 60 of file ReactESP.h.

+

Definition at line 65 of file ReactESP.h.

@@ -491,7 +495,7 @@

-

Definition at line 61 of file ReactESP.h.

+

Definition at line 66 of file ReactESP.h.

diff --git a/docs/generated/docs/classreactesp_1_1_untimed_event-members.html b/docs/generated/docs/classreactesp_1_1_untimed_event-members.html index 76b2749..317878f 100644 --- a/docs/generated/docs/classreactesp_1_1_untimed_event-members.html +++ b/docs/generated/docs/classreactesp_1_1_untimed_event-members.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/classreactesp_1_1_untimed_event.html b/docs/generated/docs/classreactesp_1_1_untimed_event.html index d58a16d..642ea5e 100644 --- a/docs/generated/docs/classreactesp_1_1_untimed_event.html +++ b/docs/generated/docs/classreactesp_1_1_untimed_event.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -162,7 +162,7 @@

Detailed Description

Events that are triggered based on something else than time.

-

Definition at line 155 of file ReactESP.h.

+

Definition at line 160 of file ReactESP.h.

Constructor & Destructor Documentation

◆ UntimedEvent()

@@ -187,7 +187,7 @@

-

Definition at line 157 of file ReactESP.h.

+

Definition at line 162 of file ReactESP.h.

@@ -217,7 +217,7 @@

reactesp::EventInterface.

-

Definition at line 55 of file ReactESP.cpp.

+

Definition at line 66 of file ReactESP.cpp.

@@ -246,7 +246,7 @@

reactesp::EventInterface.

-

Definition at line 59 of file ReactESP.cpp.

+

Definition at line 70 of file ReactESP.cpp.

diff --git a/docs/generated/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/docs/generated/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html index 078445a..6d84825 100644 --- a/docs/generated/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html +++ b/docs/generated/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/files.html b/docs/generated/docs/files.html index 06461dd..da8a209 100644 --- a/docs/generated/docs/files.html +++ b/docs/generated/docs/files.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/functions.html b/docs/generated/docs/functions.html index 670373e..7862ab1 100644 --- a/docs/generated/docs/functions.html +++ b/docs/generated/docs/functions.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/functions_func.html b/docs/generated/docs/functions_func.html index 65a39ac..d9dd552 100644 --- a/docs/generated/docs/functions_func.html +++ b/docs/generated/docs/functions_func.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/functions_rela.html b/docs/generated/docs/functions_rela.html index 7ce51f7..c08d506 100644 --- a/docs/generated/docs/functions_rela.html +++ b/docs/generated/docs/functions_rela.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/functions_vars.html b/docs/generated/docs/functions_vars.html index 5eca2b1..34296e0 100644 --- a/docs/generated/docs/functions_vars.html +++ b/docs/generated/docs/functions_vars.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/globals.html b/docs/generated/docs/globals.html index 7ea0bc3..1c6d836 100644 --- a/docs/generated/docs/globals.html +++ b/docs/generated/docs/globals.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/globals_defs.html b/docs/generated/docs/globals_defs.html index b30431b..910f22d 100644 --- a/docs/generated/docs/globals_defs.html +++ b/docs/generated/docs/globals_defs.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/globals_func.html b/docs/generated/docs/globals_func.html index f1f62de..ffca0e1 100644 --- a/docs/generated/docs/globals_func.html +++ b/docs/generated/docs/globals_func.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/globals_vars.html b/docs/generated/docs/globals_vars.html index 358ea42..d619516 100644 --- a/docs/generated/docs/globals_vars.html +++ b/docs/generated/docs/globals_vars.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/graph_legend.html b/docs/generated/docs/graph_legend.html index 0060d11..6d1b269 100644 --- a/docs/generated/docs/graph_legend.html +++ b/docs/generated/docs/graph_legend.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/hierarchy.html b/docs/generated/docs/hierarchy.html index 154c45b..d5aa29d 100644 --- a/docs/generated/docs/hierarchy.html +++ b/docs/generated/docs/hierarchy.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/index.html b/docs/generated/docs/index.html index f858e38..e704a1a 100644 --- a/docs/generated/docs/index.html +++ b/docs/generated/docs/index.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/inherits.html b/docs/generated/docs/inherits.html index 3ffde92..c7cf96e 100644 --- a/docs/generated/docs/inherits.html +++ b/docs/generated/docs/inherits.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/main_8cpp.html b/docs/generated/docs/main_8cpp.html index c8e6b88..92fafc2 100644 --- a/docs/generated/docs/main_8cpp.html +++ b/docs/generated/docs/main_8cpp.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -261,7 +261,7 @@

-

Definition at line 108 of file main.cpp.

+

Definition at line 109 of file main.cpp.

Here is the call graph for this function:
@@ -285,7 +285,7 @@

-

Definition at line 145 of file main.cpp.

+

Definition at line 146 of file main.cpp.

Here is the call graph for this function:
@@ -333,7 +333,7 @@

-

Definition at line 123 of file main.cpp.

+

Definition at line 124 of file main.cpp.

Here is the call graph for this function:
@@ -357,7 +357,7 @@

-

Definition at line 50 of file main.cpp.

+

Definition at line 51 of file main.cpp.

Here is the call graph for this function:
@@ -386,7 +386,7 @@

-

Definition at line 81 of file main.cpp.

+

Definition at line 82 of file main.cpp.

Here is the call graph for this function:
@@ -415,7 +415,7 @@

-

Definition at line 101 of file main.cpp.

+

Definition at line 102 of file main.cpp.

Here is the call graph for this function:
@@ -444,7 +444,7 @@

-

Definition at line 34 of file main.cpp.

+

Definition at line 35 of file main.cpp.

Here is the call graph for this function:
diff --git a/docs/generated/docs/main_8cpp_source.html b/docs/generated/docs/main_8cpp_source.html index 8d6aa91..fd70b08 100644 --- a/docs/generated/docs/main_8cpp_source.html +++ b/docs/generated/docs/main_8cpp_source.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -136,169 +136,170 @@
26 }
27 Serial.printf("\n");
28 Serial.printf("Core: %d\n", xPortGetCoreID());
-
29 Serial.printf("Free mem: %d\n", esp_get_free_heap_size());
-
30 Serial.printf("Ticks per second: %d\n", tick_counter);
-
31 tick_counter = 0;
-
32}
+
29 Serial.printf("Uptime: %d\n", millis());
+
30 Serial.printf("Free mem: %d\n", esp_get_free_heap_size());
+
31 Serial.printf("Ticks per second: %d\n", tick_counter);
+
32 tick_counter = 0;
+
33}
-
33
-
- -
35 // create twenty timers
-
36
-
37 for (int i=0; i<NUM_TIMERS; i++) {
-
38 timer_ticks[i] = 0;
-
39 int delay = (i+1)*(i+1);
-
40 event_loop.onRepeat(delay, [i]() {
-
41 timer_ticks[i]++;
-
42 });
-
43 }
-
44
-
45 // create one more timer to report the counted ticks
-
46
- -
48}
+
34
+
+ +
36 // create twenty timers
+
37
+
38 for (int i=0; i<NUM_TIMERS; i++) {
+
39 timer_ticks[i] = 0;
+
40 int delay = (i+1)*(i+1);
+
41 event_loop.onRepeat(delay, [i]() {
+
42 timer_ticks[i]++;
+
43 });
+
44 }
+
45
+
46 // create one more timer to report the counted ticks
+
47
+ +
49}
-
49
-
- -
51 static ISREvent* ire2 = nullptr;
-
52 static int out_pin_state = 0;
-
53
+
50
+
+ +
52 static ISREvent* ire2 = nullptr;
+
53 static int out_pin_state = 0;
54
-
55 // change OUT_PIN state every 900 ms
-
56 pinMode(OUT_PIN, OUTPUT);
-
57 event_loop->onRepeat(900, [] () {
-
58 out_pin_state = !out_pin_state;
-
59 digitalWrite(OUT_PIN, out_pin_state);
-
60 });
-
61
-
62 auto reporter = [] (int pin) {
-
63 Serial.printf("Pin %d changed state.\n", pin);
-
64 };
-
65
-
66 // create an interrupt that always reports if PIN1 is rising
- -
68
-
69 // every 9s, toggle reporting PIN2 falling edge
- -
71 if (ire2==nullptr) {
-
72 ire2 = event_loop->onInterrupt(INPUT_PIN2, FALLING, std::bind(reporter, INPUT_PIN2));
-
73 } else {
-
74 ire2->remove(event_loop);
-
75 ire2 = nullptr;
-
76 }
-
77 });
-
78
-
79}
+
55
+
56 // change OUT_PIN state every 900 ms
+
57 pinMode(OUT_PIN, OUTPUT);
+
58 event_loop->onRepeat(900, [] () {
+
59 out_pin_state = !out_pin_state;
+
60 digitalWrite(OUT_PIN, out_pin_state);
+
61 });
+
62
+
63 auto reporter = [] (int pin) {
+
64 Serial.printf("Pin %d changed state.\n", pin);
+
65 };
+
66
+
67 // create an interrupt that always reports if PIN1 is rising
+ +
69
+
70 // every 9s, toggle reporting PIN2 falling edge
+ +
72 if (ire2==nullptr) {
+
73 ire2 = event_loop->onInterrupt(INPUT_PIN2, FALLING, std::bind(reporter, INPUT_PIN2));
+
74 } else {
+
75 ire2->remove(event_loop);
+
76 ire2 = nullptr;
+
77 }
+
78 });
+
79
+
80}
-
80
-
- -
82 // if something is received on the serial port, turn the led off for one second
-
83 event_loop.onAvailable(Serial, [&event_loop] () {
-
84 static int event_counter = 0;
-
85
-
86 Serial.write(Serial.read());
-
87 digitalWrite(LED_PIN, HIGH);
-
88
-
89 event_counter++;
-
90
-
91 int current = event_counter;
-
92
-
93 event_loop.onDelay(1000, [current] () {
-
94 if (event_counter==current) {
-
95 digitalWrite(LED_PIN, LOW);
-
96 }
-
97 });
-
98 });
-
99}
+
81
+
+ +
83 // if something is received on the serial port, turn the led off for one second
+
84 event_loop.onAvailable(Serial, [&event_loop] () {
+
85 static int event_counter = 0;
+
86
+
87 Serial.write(Serial.read());
+
88 digitalWrite(LED_PIN, HIGH);
+
89
+
90 event_counter++;
+
91
+
92 int current = event_counter;
+
93
+
94 event_loop.onDelay(1000, [current] () {
+
95 if (event_counter==current) {
+
96 digitalWrite(LED_PIN, LOW);
+
97 }
+
98 });
+
99 });
+
100}
-
100
-
- -
102 // increase the tick counter on every tick
-
103 event_loop.onTick([]() {
-
104 tick_counter++;
-
105 });
-
106}
+
101
+
+ +
103 // increase the tick counter on every tick
+
104 event_loop.onTick([]() {
+
105 tick_counter++;
+
106 });
+
107}
-
107
-
-
108void execute_task(void* arg) {
-
109 EventLoop task_app;
-
110
-
111 Serial.println("Defining a repeat event in a task");
-
112 task_app.onRepeat(1000, []() {
-
113 Serial.printf("C%d Task running.\n", xPortGetCoreID());
-
114 });
-
115 Serial.println("Done");
-
116
-
117 while (true) {
-
118 task_app.tick();
-
119 delay(1);
-
120 }
-
121}
+
108
+
+
109void execute_task(void* arg) {
+
110 EventLoop task_app;
+
111
+
112 Serial.println("Defining a repeat event in a task");
+
113 task_app.onRepeat(1000, []() {
+
114 Serial.printf("C%d Task running.\n", xPortGetCoreID());
+
115 });
+
116 Serial.println("Done");
+
117
+
118 while (true) {
+
119 task_app.tick();
+
120 delay(1);
+
121 }
+
122}
-
122
-
-
123void setup() {
-
124 Serial.begin(115200);
-
125 Serial.println("Starting");
-
126 pinMode(LED_PIN, OUTPUT);
-
127
- - - - -
132 //
-
133 //xTaskCreatePinnedToCore(execute_task, "SecondTask", 4096, NULL,
-
134 // 1, NULL, 0);
-
135
-
136 esp_pm_config_esp32_t pm_config;
-
137 pm_config.max_freq_mhz = 240;
-
138 pm_config.min_freq_mhz = 80;
-
139 pm_config.light_sleep_enable = true;
-
140
-
141 esp_pm_configure(&pm_config);
-
142
-
143}
+
123
+
+
124void setup() {
+
125 Serial.begin(115200);
+
126 Serial.println("Starting");
+
127 pinMode(LED_PIN, OUTPUT);
+
128
+ + + + +
133 //
+
134 //xTaskCreatePinnedToCore(execute_task, "SecondTask", 4096, NULL,
+
135 // 1, NULL, 0);
+
136
+
137 esp_pm_config_esp32_t pm_config;
+
138 pm_config.max_freq_mhz = 240;
+
139 pm_config.min_freq_mhz = 80;
+
140 pm_config.light_sleep_enable = true;
+
141
+
142 esp_pm_configure(&pm_config);
+
143
+
144}
-
144
-
-
145void loop() {
- -
147 //digitalWrite(LED_PIN, !digitalRead(LED_PIN));
-
148 //Serial.printf("C%d Main loop running.\n", xPortGetCoreID());
-
149 //delay(1000);
-
150}
+
145
+
+
146void loop() {
+ +
148 //digitalWrite(LED_PIN, !digitalRead(LED_PIN));
+
149 //Serial.printf("C%d Main loop running.\n", xPortGetCoreID());
+
150 //delay(1000);
+
151}
-
Main event loop of a EventLoop program.
Definition ReactESP.h:260
- -
StreamEvent * onAvailable(Stream &stream, react_callback callback)
Create a new StreamEvent.
Definition ReactESP.cpp:162
-
TickEvent * onTick(react_callback callback)
Create a new TickEvent.
Definition ReactESP.cpp:175
-
DelayEvent * onDelay(uint32_t delay, react_callback callback)
Create a new DelayEvent.
Definition ReactESP.cpp:136
-
ISREvent * onInterrupt(uint8_t pin_number, int mode, react_callback callback)
Create a new ISREvent (interrupt event)
Definition ReactESP.cpp:168
-
RepeatEvent * onRepeat(uint32_t interval, react_callback callback)
Create a new RepeatEvent.
Definition ReactESP.cpp:149
-
Event that is triggered on an input pin change.
Definition ReactESP.h:202
-
void remove(EventLoop *event_loop) override
Definition ReactESP.cpp:90
-
void setup_serial(EventLoop &event_loop)
Definition main.cpp:81
+
Main event loop of a EventLoop program.
Definition ReactESP.h:265
+ +
StreamEvent * onAvailable(Stream &stream, react_callback callback)
Create a new StreamEvent.
Definition ReactESP.cpp:172
+
TickEvent * onTick(react_callback callback)
Create a new TickEvent.
Definition ReactESP.cpp:185
+
DelayEvent * onDelay(uint32_t delay, react_callback callback)
Create a new DelayEvent.
Definition ReactESP.cpp:146
+
ISREvent * onInterrupt(uint8_t pin_number, int mode, react_callback callback)
Create a new ISREvent (interrupt event)
Definition ReactESP.cpp:178
+
RepeatEvent * onRepeat(uint32_t interval, react_callback callback)
Create a new RepeatEvent.
Definition ReactESP.cpp:159
+
Event that is triggered on an input pin change.
Definition ReactESP.h:207
+
void remove(EventLoop *event_loop) override
Definition ReactESP.cpp:101
+
void setup_serial(EventLoop &event_loop)
Definition main.cpp:82
#define NUM_TIMERS
Definition main.cpp:14
#define INPUT_PIN2
Definition main.cpp:11
#define OUT_PIN
Definition main.cpp:9
-
void setup_timers(EventLoop &event_loop)
Definition main.cpp:34
-
void setup()
Definition main.cpp:123
+
void setup_timers(EventLoop &event_loop)
Definition main.cpp:35
+
void setup()
Definition main.cpp:124
void reporter()
Definition main.cpp:21
int tick_counter
Definition main.cpp:16
EventLoop event_loop
Definition main.cpp:19
int timer_ticks[NUM_TIMERS]
Definition main.cpp:17
#define LED_PIN
Definition main.cpp:8
-
void execute_task(void *arg)
Definition main.cpp:108
-
void setup_tick(EventLoop &event_loop)
Definition main.cpp:101
-
void setup_io_pins(EventLoop *event_loop)
Definition main.cpp:50
+
void execute_task(void *arg)
Definition main.cpp:109
+
void setup_tick(EventLoop &event_loop)
Definition main.cpp:102
+
void setup_io_pins(EventLoop *event_loop)
Definition main.cpp:51
#define INPUT_PIN1
Definition main.cpp:10
-
void loop()
Definition main.cpp:145
+
void loop()
Definition main.cpp:146
diff --git a/docs/generated/docs/namespacemembers.html b/docs/generated/docs/namespacemembers.html index 0b15aed..d43c940 100644 --- a/docs/generated/docs/namespacemembers.html +++ b/docs/generated/docs/namespacemembers.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/namespacemembers_type.html b/docs/generated/docs/namespacemembers_type.html index 1d6c686..b0e76fc 100644 --- a/docs/generated/docs/namespacemembers_type.html +++ b/docs/generated/docs/namespacemembers_type.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/namespacereactesp.html b/docs/generated/docs/namespacereactesp.html index f747cf7..f2681c5 100644 --- a/docs/generated/docs/namespacereactesp.html +++ b/docs/generated/docs/namespacereactesp.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -182,7 +182,7 @@

-

Definition at line 369 of file ReactESP.h.

+

Definition at line 374 of file ReactESP.h.

@@ -214,7 +214,7 @@

-

Definition at line 371 of file ReactESP.h.

+

Definition at line 376 of file ReactESP.h.

@@ -246,7 +246,7 @@

-

Definition at line 366 of file ReactESP.h.

+

Definition at line 371 of file ReactESP.h.

@@ -262,7 +262,7 @@

-

Definition at line 370 of file ReactESP.h.

+

Definition at line 375 of file ReactESP.h.

@@ -278,7 +278,7 @@

-

Definition at line 372 of file ReactESP.h.

+

Definition at line 377 of file ReactESP.h.

@@ -294,7 +294,7 @@

-

Definition at line 373 of file ReactESP.h.

+

Definition at line 378 of file ReactESP.h.

@@ -310,7 +310,7 @@

-

Definition at line 367 of file ReactESP.h.

+

Definition at line 372 of file ReactESP.h.

@@ -326,7 +326,7 @@

-

Definition at line 368 of file ReactESP.h.

+

Definition at line 373 of file ReactESP.h.

diff --git a/docs/generated/docs/namespaces.html b/docs/generated/docs/namespaces.html index bf8a4af..f8d4298 100644 --- a/docs/generated/docs/namespaces.html +++ b/docs/generated/docs/namespaces.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/structreactesp_1_1_event_interface-members.html b/docs/generated/docs/structreactesp_1_1_event_interface-members.html index f85f8a0..fd7b279 100644 --- a/docs/generated/docs/structreactesp_1_1_event_interface-members.html +++ b/docs/generated/docs/structreactesp_1_1_event_interface-members.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/structreactesp_1_1_event_interface.html b/docs/generated/docs/structreactesp_1_1_event_interface.html index d61ab4b..66d6889 100644 --- a/docs/generated/docs/structreactesp_1_1_event_interface.html +++ b/docs/generated/docs/structreactesp_1_1_event_interface.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -136,7 +136,7 @@

Detailed Description

EventInterface defines the interface for all events.

-

Definition at line 22 of file ReactESP.h.

+

Definition at line 27 of file ReactESP.h.

Constructor & Destructor Documentation

◆ ~EventInterface()

diff --git a/docs/generated/docs/structreactesp_1_1_trigger_time_compare-members.html b/docs/generated/docs/structreactesp_1_1_trigger_time_compare-members.html index 080ffab..3e84faf 100644 --- a/docs/generated/docs/structreactesp_1_1_trigger_time_compare-members.html +++ b/docs/generated/docs/structreactesp_1_1_trigger_time_compare-members.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
diff --git a/docs/generated/docs/structreactesp_1_1_trigger_time_compare.html b/docs/generated/docs/structreactesp_1_1_trigger_time_compare.html index e016ff6..db4846a 100644 --- a/docs/generated/docs/structreactesp_1_1_trigger_time_compare.html +++ b/docs/generated/docs/structreactesp_1_1_trigger_time_compare.html @@ -34,7 +34,7 @@ -
ReactESP 3.0.0 +
ReactESP 3.0.1
Asynchronous programming for the ESP microcontrollers
@@ -120,7 +120,7 @@

Detailed Description

-

Definition at line 100 of file ReactESP.h.

+

Definition at line 105 of file ReactESP.h.

Member Function Documentation

◆ operator()()

@@ -149,7 +149,7 @@

-

Definition at line 101 of file ReactESP.h.

+

Definition at line 106 of file ReactESP.h.

diff --git a/library.json b/library.json index a7f78f8..96c2266 100644 --- a/library.json +++ b/library.json @@ -23,7 +23,7 @@ } ], "dependencies": [], - "version": "3.0.1-alpha", + "version": "3.0.1", "frameworks": "arduino", "platforms": "*" } diff --git a/library.properties b/library.properties index e041784..0cb393c 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ReactESP -version=3.0.1-alpha +version=3.0.1 author=Matti Airas , Andrew Carter maintainer=Matti Airas sentence=Asynchronous programming library for the ESP32 and other microcontrollers compatible with the Arduino framework.