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

} else { } else {
_next = nullptr; _next = nullptr;
_prev = lastYield; _prev = lastYield;
_prev->_next = this;
lastYield = this; lastYield = this;
} }
} else if (_type == EventTypeInterrupt) { } else if (_type == EventTypeInterrupt) {
} else { } else {
_next = nullptr; _next = nullptr;
_prev = lastInterrupt; _prev = lastInterrupt;
_prev->_next = this;
lastInterrupt = this; lastInterrupt = this;
} }
// TODO set interrupt pending // TODO set interrupt pending

+ 6
- 2
teensy3/EventResponder.h View File

* programs you write now using EventResponder may need to be * programs you write now using EventResponder may need to be
* updated as EventResponder develops. * 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 * https://forum.pjrc.com/threads/44723-Arduino-Events
*/ */


if (first && !runningFromYield) { if (first && !runningFromYield) {
runningFromYield = true; runningFromYield = true;
firstYield = first->_next; firstYield = first->_next;
if (firstYield) firstYield->_prev = nullptr;
if (firstYield) {
firstYield->_prev = nullptr;
} else {
lastYield = nullptr;
}
first->_pending = false; first->_pending = false;
(*(first->_function))(*first); (*(first->_function))(*first);
runningFromYield = false; runningFromYield = false;

Loading…
Cancel
Save