summaryrefslogtreecommitdiff
path: root/quantum/visualizer/visualizer.mk
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/visualizer/visualizer.mk')
-rw-r--r--quantum/visualizer/visualizer.mk35
1 files changed, 35 insertions, 0 deletions
diff --git a/quantum/visualizer/visualizer.mk b/quantum/visualizer/visualizer.mk
index 3a0f771bca..102d23b7ef 100644
--- a/quantum/visualizer/visualizer.mk
+++ b/quantum/visualizer/visualizer.mk
@@ -20,6 +20,30 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
+define ADD_DRIVER
+ $(1)_DRIVER:=$(strip $($(1)_DRIVER))
+ $(1)_WIDTH:=$(strip $($(1)_WIDTH))
+ $(1)_HEIGHT:=$(strip $($(1)_HEIGHT))
+ ifeq ($($(1)_DRIVER),)
+ $$(error $(1)_DRIVER is not defined)
+ endif
+ ifeq ($($(1)_WIDTH),)
+ $$(error $(1)_WIDTH is not defined)
+ endif
+ ifeq ($($(1)_HEIGHT),)
+ $$(error $(1)_HEIGHT is not defined)
+ endif
+ OPT_DEFS+=-D$(1)_WIDTH=$($(1)_WIDTH)
+ OPT_DEFS+=-D$(1)_HEIGHT=$($(1)_HEIGHT)
+ GFXDEFS+=-D$(1)_WIDTH=$($(1)_WIDTH)
+ GFXDEFS+=-D$(1)_HEIGHT=$($(1)_HEIGHT)
+ $(1)_DISPLAY_NUMBER:=$$(words $$(GDISP_DRIVER_LIST))
+ OPT_DEFS+=-D$(1)_DISPLAY_NUMBER=$$($(1)_DISPLAY_NUMBER)
+ include $(TOP_DIR)/drivers/ugfx/gdisp/$($(1)_DRIVER)/driver.mk
+endef
+
+GDISP_DRIVER_LIST:=
+
SRC += $(VISUALIZER_DIR)/visualizer.c \
$(VISUALIZER_DIR)/visualizer_keyframes.c
EXTRAINCDIRS += $(GFXINC) $(VISUALIZER_DIR)
@@ -40,10 +64,12 @@ SRC += $(VISUALIZER_DIR)/lcd_backlight_keyframes.c
# Note, that the linker will strip out any resources that are not actually in use
SRC += $(VISUALIZER_DIR)/resources/lcd_logo.c
OPT_DEFS += -DLCD_BACKLIGHT_ENABLE
+$(eval $(call ADD_DRIVER,LCD))
endif
ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
SRC += $(VISUALIZER_DIR)/led_backlight_keyframes.c
+$(eval $(call ADD_DRIVER,LED))
endif
SRC += $(VISUALIZER_DIR)/default_animations.c
@@ -55,6 +81,15 @@ GFXINC += quantum/visualizer
GFXSRC := $(patsubst $(TOP_DIR)/%,%,$(GFXSRC))
GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS)))
+GDISP_LIST_COMMA=,
+GDISP_LIST_EMPTY=
+GDISP_LIST_SPACE=$(GDISP_LIST_EMPTY) $(GDISP_LIST_EMPTY)
+
+GDISP_DRIVER_LIST := $(strip $(GDISP_DRIVER_LIST))
+GDISP_DRIVER_LIST := $(subst $(GDISP_LIST_SPACE),$(GDISP_LIST_COMMA),$(GDISP_DRIVER_LIST))
+
+GFXDEFS +=-DGDISP_DRIVER_LIST="$(GDISP_DRIVER_LIST)"
+
ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","")
SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c
else