diff --git a/example/blink/platformio.ini b/example/blink/platformio.ini index b0aba42..f1dfa79 100644 --- a/example/blink/platformio.ini +++ b/example/blink/platformio.ini @@ -30,6 +30,6 @@ platform = https://github.com/tsandmann/platform-teensy.git board = teensy41 framework = arduino lib_deps = https://github.com/tsandmann/freertos-teensy.git -build_flags = -Wformat=1 -DUSB_SERIAL -DTEENSY_OPT_FASTER_LTO +build_flags = -Wformat=1 upload_flags = -v upload_protocol = teensy-cli diff --git a/src/arduino_freertos.h b/src/arduino_freertos.h index ed28533..18b1f9d 100644 --- a/src/arduino_freertos.h +++ b/src/arduino_freertos.h @@ -33,23 +33,14 @@ #include "FreeRTOS.h" #include "task.h" +#include "HardwareSerial.h" #include "Arduino.h" #include "Print.h" #if defined(__has_include) && __has_include("Wire.h") #include "Wire.h" -#else -class TwoWire; -class Wire; -class Wire1; -class Wire2; -class Wire3; #endif #if defined(__has_include) && __has_include("SPI.h") #include "SPI.h" -#else -class SPI; -class SPI1; -class SPI2; #endif #if defined(__has_include) && __has_include("FS.h") #include "FS.h" @@ -132,8 +123,9 @@ using ::micros; using ::millis; using ::yield; -using ::HardwareSerial; using ::Serial; +#if !defined DISABLE_ARDUINO_HWSERIAL +using ::HardwareSerial; using ::Serial1; using ::Serial2; using ::Serial3; @@ -146,12 +138,14 @@ using ::Serial7; #ifdef ARDUINO_TEENSY41 using ::Serial8; #endif -#if defined(__has_include) && __has_include("SPI.h") +#endif // !DISABLE_ARDUINO_HWSERIAL +#if defined(__has_include) && __has_include("SPI.h") && !defined DISABLE_ARDUINO_SPI using ::SPI; using ::SPI1; using ::SPI2; #endif // SPI.h using ::Stream; +#if defined(__has_include) && __has_include("Wire.h") && !defined DISABLE_ARDUINO_WIRE using ::TwoWire; using ::Wire; using ::Wire1; @@ -159,6 +153,7 @@ using ::Wire2; #ifdef WIRE_IMPLEMENT_WIRE3 using ::Wire3; #endif +#endif // Wire.h using ::String; diff --git a/src/portable/teensy_3.cpp b/src/portable/teensy_3.cpp index 7f2339c..a721a8d 100644 --- a/src/portable/teensy_3.cpp +++ b/src/portable/teensy_3.cpp @@ -115,9 +115,13 @@ void yield() { } } #endif // USB_TRIPLE_SERIAL + +#if !defined DISABLE_ARDUINO_HWSERIAL if (yield_active_check_flags & YIELD_CHECK_HARDWARE_SERIAL) { HardwareSerial::processSerialEventsList(); } +#endif // !DISABLE_ARDUINO_HWSERIAL + running = 0; if (yield_active_check_flags & YIELD_CHECK_EVENT_RESPONDER) { EventResponder::runFromYield(); diff --git a/src/portable/teensy_4.cpp b/src/portable/teensy_4.cpp index 9840e0d..f3719bc 100644 --- a/src/portable/teensy_4.cpp +++ b/src/portable/teensy_4.cpp @@ -131,10 +131,12 @@ FLASHMEM void yield() { } #endif // USB_TRIPLE_SERIAL +#if !defined DISABLE_ARDUINO_HWSERIAL // Current workaround until integrate with EventResponder. if (yield_active_check_flags & YIELD_CHECK_HARDWARE_SERIAL) { HardwareSerial::processSerialEventsList(); } +#endif // !DISABLE_ARDUINO_HWSERIAL running = 0; if (yield_active_check_flags & YIELD_CHECK_EVENT_RESPONDER) { @@ -177,10 +179,12 @@ FLASHMEM void yield() { } #endif // USB_TRIPLE_SERIAL +#if !defined DISABLE_ARDUINO_HWSERIAL // Current workaround until integrate with EventResponder. if (check_flags & YIELD_CHECK_HARDWARE_SERIAL) { HardwareSerial::processSerialEventsList(); } +#endif // !DISABLE_ARDUINO_HWSERIAL running = 0; if (check_flags & YIELD_CHECK_EVENT_RESPONDER) {