Преглед изворни кода

Add priority levels to EventResponder

main
PaulStoffregen пре 7 година
родитељ
комит
c34cbcf074
1 измењених фајлова са 2 додато и 2 уклоњено
  1. +2
    -2
      teensy3/EventResponder.h

+ 2
- 2
teensy3/EventResponder.h Прегледај датотеку

// Attach a function to be called from yield(). This should be the // Attach a function to be called from yield(). This should be the
// default way to use EventResponder. Calls from yield() allow use // default way to use EventResponder. Calls from yield() allow use
// of Arduino libraries, String, Serial, etc. // of Arduino libraries, String, Serial, etc.
void attach(EventResponderFunction function) {
void attach(EventResponderFunction function, uint8_t priority=128) {
detach(); detach();
_function = function; _function = function;
_type = EventTypeYield; _type = EventTypeYield;
// this as attachImmediate. On ARM and other platforms with software // this as attachImmediate. On ARM and other platforms with software
// interrupts, this allow fast interrupt-based response, but with less // interrupts, this allow fast interrupt-based response, but with less
// disruption to other libraries requiring their own interrupts. // disruption to other libraries requiring their own interrupts.
void attachInterrupt(EventResponderFunction function) {
void attachInterrupt(EventResponderFunction function, uint8_t priority=128) {
detach(); detach();
_function = function; _function = function;
_type = EventTypeInterrupt; _type = EventTypeInterrupt;

Loading…
Откажи
Сачувај