Browse Source

Fix EventResponder append to triggered list

teensy4-core
PaulStoffregen 7 years ago
parent
commit
aa5e833b04
2 changed files with 8 additions and 2 deletions
  1. +2
    -0
      teensy3/EventResponder.cpp
  2. +6
    -2
      teensy3/EventResponder.h

+ 2
- 0
teensy3/EventResponder.cpp View File

@@ -57,6 +57,7 @@ void EventResponder::triggerEventNotImmediate()
} else {
_next = nullptr;
_prev = lastYield;
_prev->_next = this;
lastYield = this;
}
} else if (_type == EventTypeInterrupt) {
@@ -69,6 +70,7 @@ void EventResponder::triggerEventNotImmediate()
} else {
_next = nullptr;
_prev = lastInterrupt;
_prev->_next = this;
lastInterrupt = this;
}
// TODO set interrupt pending

+ 6
- 2
teensy3/EventResponder.h View File

@@ -27,7 +27,7 @@
* programs you write now using EventResponder may need to be
* updated as EventResponder develops.
*
* Please post EventResponder post your feedback here:
* Please post your EventResponder feedback here:
* https://forum.pjrc.com/threads/44723-Arduino-Events
*/

@@ -153,7 +153,11 @@ public:
if (first && !runningFromYield) {
runningFromYield = true;
firstYield = first->_next;
if (firstYield) firstYield->_prev = nullptr;
if (firstYield) {
firstYield->_prev = nullptr;
} else {
lastYield = nullptr;
}
first->_pending = false;
(*(first->_function))(*first);
runningFromYield = false;

Loading…
Cancel
Save