Browse Source

Shortcut dont call HardwareSerial::processevents if nothing active

This cut down some timings in yield.
main
Kurt Eckhardt 5 years ago
parent
commit
e3d940c44d
2 changed files with 4 additions and 2 deletions
  1. +1
    -1
      teensy4/HardwareSerial.h
  2. +3
    -1
      teensy4/yield.cpp

+ 1
- 1
teensy4/HardwareSerial.h View File

void enableSerialEvents(); void enableSerialEvents();
void disableSerialEvents(); void disableSerialEvents();
static void processSerialEvents(); static void processSerialEvents();
static uint8_t serial_event_handlers_active;


using Print::write; using Print::write;
// Only overwrite some of the virtualWrite functions if we are going to optimize them over Print version // Only overwrite some of the virtualWrite functions if we are going to optimize them over Print version
#else #else
static SerialEventCheckingFunctionPointer serial_event_handler_checks[7]; static SerialEventCheckingFunctionPointer serial_event_handler_checks[7];
#endif #endif
static uint8_t serial_event_handlers_active;







+ 3
- 1
teensy4/yield.cpp View File

if (running) return; // TODO: does this need to be atomic? if (running) return; // TODO: does this need to be atomic?
running = 1; running = 1;



// USB Serail - Add hack to minimize impact... // USB Serail - Add hack to minimize impact...
if (usb_enable_serial_event_processing && Serial.available()) serialEvent(); if (usb_enable_serial_event_processing && Serial.available()) serialEvent();


// Current workaround until integrate with EventResponder. // Current workaround until integrate with EventResponder.
HardwareSerial::processSerialEvents();
if (HardwareSerial::serial_event_handlers_active) HardwareSerial::processSerialEvents();


running = 0; running = 0;
EventResponder::runFromYield(); EventResponder::runFromYield();
}; };

Loading…
Cancel
Save