diff --git a/platformio/builder/scripts/frameworks/arduino.py b/platformio/builder/scripts/frameworks/arduino.py index 16164d8d..558852a8 100644 --- a/platformio/builder/scripts/frameworks/arduino.py +++ b/platformio/builder/scripts/frameworks/arduino.py @@ -198,6 +198,20 @@ if env.get("PLATFORM") == "teensy": "ARDUINO=10600", "TEENSYDUINO=%d" % ARDUINO_VERSION ] + + USB_FLAGS = ( + "USB_HID", + "USB_SERIAL_HID", + "USB_DISK", + "USB_DISK_SDFLASH", + "USB_MIDI", + "USB_RAWHID", + "USB_FLIGHTSIM", + "USB_DISABLED" + ) + + if not any(f in env.get("BUILD_FLAGS", []) for f in USB_FLAGS): + env.Append(CPPDEFINES=["USB_SERIAL"]) else: ARDUINO_USBDEFINES += ["ARDUINO=%d" % ARDUINO_VERSION] @@ -310,6 +324,8 @@ if BOARD_BUILDOPTS.get("core", None) == "teensy": with open(file_path, "w") as fp: fp.write(content) + env.Append(CPPPATH=[join("$PLATFORMFW_DIR", "cores")]) + # # Target: Build Core Library # diff --git a/platformio/builder/scripts/teensy.py b/platformio/builder/scripts/teensy.py index 43e293f3..c01c67e8 100644 --- a/platformio/builder/scripts/teensy.py +++ b/platformio/builder/scripts/teensy.py @@ -40,7 +40,6 @@ elif env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") == "teensy3": env.Append( CPPDEFINES=[ - "USB_SERIAL", "LAYOUT_US_ENGLISH" ],