Skip to content

Commit 8deb47f

Browse files
authored
1 parent 0109348 commit 8deb47f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tools/platformio-build.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright 2021-present Maximilian Gerhardt <[email protected]>
2+
# TinyUSB ignore snippet from https://github.com/episource/
23
#
34
# Licensed under the Apache License, Version 2.0 (the "License");
45
# you may not use this file except in compliance with the License.
@@ -168,6 +169,18 @@ def configure_usb_flags(cpp_defines):
168169
#
169170
cpp_defines = env.Flatten(env.get("CPPDEFINES", []))
170171

172+
# Ignore TinyUSB automatically if not active without requiring ldf_mode = chain+
173+
if not "USE_TINYUSB" in cpp_defines:
174+
env_section = "env:" + env["PIOENV"]
175+
ignored_libs = platform.config.get(
176+
env_section, "lib_ignore", []
177+
)
178+
if not "Adafruit TinyUSB Library" in ignored_libs:
179+
ignored_libs.append("Adafruit TinyUSB Library")
180+
platform.config.set(
181+
env_section, "lib_ignore", ignored_libs
182+
)
183+
# configure USB stuff
171184
configure_usb_flags(cpp_defines)
172185

173186
# info about the filesystem is already parsed by the platform's main.py

0 commit comments

Comments
 (0)