From 79a4a943dc79cbfde4d576077c0525972c94de5a Mon Sep 17 00:00:00 2001 From: Valeriy Koval Date: Mon, 18 Jul 2016 14:52:25 +0300 Subject: [PATCH] Fix USB flags processing for teensy platform // Issue #722 --- platformio/builder/scripts/frameworks/arduino.py | 16 ++++++++++++++++ platformio/builder/scripts/teensy.py | 1 - 2 files changed, 16 insertions(+), 1 deletion(-) 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" ],