Skip to content

Commit 0ed8921

Browse files
authored
Merge pull request #662 from fdlamotte/lib_build_display_support
lib_build: Support display and example build
2 parents 08b49c3 + df18dfb commit 0ed8921

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

build_as_lib.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
src_filter = [
77
'+<*.cpp>',
88
'+<helpers/*.cpp>',
9-
'+<helpers/sensors>'
9+
'+<helpers/sensors>',
1010
'+<helpers/radiolib/*.cpp>',
1111
'+<helpers/ui/MomentaryButton.cpp>',
12+
'+<helpers/ui/buzzer.cpp>',
1213
]
1314

1415
# add build and include dirs according to CPPDEFINES
@@ -38,11 +39,29 @@
3839
menv.Append(BUILD_FLAGS=["-I src/helpers/rp2040"])
3940
src_filter.append("+<helpers/rp2040/*>")
4041

42+
# DISPLAY HANDLING
43+
elif isinstance(item, tuple) and item[0] == "DISPLAY_CLASS":
44+
display_class = item[1]
45+
src_filter.append(f"+<helpers/ui/{display_class}.cpp>")
46+
if (display_class == "ST7789Display") :
47+
src_filter.append(f"+<helpers/ui/OLEDDisplay.cpp>")
48+
src_filter.append(f"+<helpers/ui/OLEDDisplayFonts.cpp>")
49+
4150
# VARIANTS HANDLING
4251
elif isinstance(item, tuple) and item[0] == "MC_VARIANT":
4352
variant_name = item[1]
4453
menv.Append(BUILD_FLAGS=[f"-I variants/{variant_name}"])
4554
src_filter.append(f"+<../variants/{variant_name}>")
55+
56+
# INCLUDE EXAMPLE CODE IN BUILD (to provide your own support files without touching the tree)
57+
elif isinstance(item, tuple) and item[0] == "BUILD_EXAMPLE":
58+
example_name = item[1]
59+
src_filter.append(f"+<../examples/{example_name}>")
60+
61+
# EXCLUDE A SOURCE FILE FROM AN EXAMPLE (must be placed after example name or boom)
62+
elif isinstance(item, tuple) and item[0] == "EXCLUDE_FROM_EXAMPLE":
63+
exclude_name = item[1]
64+
src_filter.append(f"-<../examples/{example_name}/{exclude_name}>")
4665

4766
menv.Replace(SRC_FILTER=src_filter)
4867

src/helpers/ui/ST7789Display.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <Wire.h>
55
#include <SPI.h>
66
#include <Adafruit_GFX.h>
7-
#include <ST7789Spi.h>
7+
#include "ST7789Spi.h"
88

99
class ST7789Display : public DisplayDriver {
1010
ST7789Spi display;

0 commit comments

Comments
 (0)