Kaynağa Gözat

Shortcut dont call HardwareSerial::processevents if nothing active

This cut down some timings in yield.
teensy4-core
Kurt Eckhardt 5 yıl önce
ebeveyn
işleme
e3d940c44d
2 değiştirilmiş dosya ile 4 ekleme ve 2 silme
  1. +1
    -1
      teensy4/HardwareSerial.h
  2. +3
    -1
      teensy4/yield.cpp

+ 1
- 1
teensy4/HardwareSerial.h Dosyayı Görüntüle

@@ -181,6 +181,7 @@ public:
void enableSerialEvents();
void disableSerialEvents();
static void processSerialEvents();
static uint8_t serial_event_handlers_active;

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




+ 3
- 1
teensy4/yield.cpp Dosyayı Görüntüle

@@ -39,12 +39,14 @@ void yield(void)
if (running) return; // TODO: does this need to be atomic?
running = 1;


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

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

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

Yükleniyor…
İptal
Kaydet