-
-
- #include <Arduino.h>
- #include "EventResponder.h"
-
- #ifdef USB_TRIPLE_SERIAL
- uint8_t yield_active_check_flags = YIELD_CHECK_USB_SERIAL | YIELD_CHECK_USB_SERIALUSB1 | YIELD_CHECK_USB_SERIALUSB2;
- extern const uint8_t _serialEventUSB2_default;
- extern const uint8_t _serialEventUSB1_default;
-
- #elif defined(USB_DUAL_SERIAL)
- uint8_t yield_active_check_flags = YIELD_CHECK_USB_SERIAL | YIELD_CHECK_USB_SERIALUSB1;
- extern const uint8_t _serialEventUSB1_default;
-
- #else
- uint8_t yield_active_check_flags = YIELD_CHECK_USB_SERIAL;
- #endif
-
- extern const uint8_t _serialEvent_default;
-
- void yield(void) __attribute__ ((weak));
- void yield(void)
- {
- static uint8_t running=0;
- if (!yield_active_check_flags) return;
- if (running) return;
- running = 1;
-
-
-
- if (yield_active_check_flags & YIELD_CHECK_USB_SERIAL) {
- if (Serial.available()) serialEvent();
- if (_serialEvent_default) yield_active_check_flags &= ~YIELD_CHECK_USB_SERIAL;
- }
-
- #if defined(USB_DUAL_SERIAL) || defined(USB_TRIPLE_SERIAL)
- if (yield_active_check_flags & YIELD_CHECK_USB_SERIALUSB1) {
- if (SerialUSB1.available()) serialEventUSB1();
- if (_serialEventUSB1_default) yield_active_check_flags &= ~YIELD_CHECK_USB_SERIALUSB1;
- }
- #endif
- #ifdef USB_TRIPLE_SERIAL
- if (yield_active_check_flags & YIELD_CHECK_USB_SERIALUSB2) {
- if (SerialUSB2.available()) serialEventUSB2();
- if (_serialEventUSB2_default) yield_active_check_flags &= ~YIELD_CHECK_USB_SERIALUSB2;
- }
- #endif
-
-
- if (yield_active_check_flags & YIELD_CHECK_HARDWARE_SERIAL) HardwareSerial::processSerialEventsList();
-
- running = 0;
- if (yield_active_check_flags & YIELD_CHECK_EVENT_RESPONDER) EventResponder::runFromYield();
-
- };
|