diff options
author | Fred Sundvik <fsundvik@gmail.com> | 2017-07-09 20:35:33 +0300 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2017-07-10 09:01:59 -0400 |
commit | 9d8279960d8784d5602025f6845b0af92db12848 (patch) | |
tree | a69982fe08b9c2b01cd958aeba645cd649e10c86 /quantum | |
parent | 4da3b19603255115f71812964383ee7b518637be (diff) |
Make it easier to use drivers
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/visualizer/lcd_keyframes.c | 4 | ||||
-rw-r--r-- | quantum/visualizer/led_backlight_keyframes.c | 4 | ||||
-rw-r--r-- | quantum/visualizer/visualizer.mk | 35 |
3 files changed, 39 insertions, 4 deletions
diff --git a/quantum/visualizer/lcd_keyframes.c b/quantum/visualizer/lcd_keyframes.c index 82e4184d2c..75eb457001 100644 --- a/quantum/visualizer/lcd_keyframes.c +++ b/quantum/visualizer/lcd_keyframes.c @@ -166,8 +166,8 @@ bool lcd_keyframe_draw_logo(keyframe_animation_t* animation, visualizer_state_t* // or state structs, here we use the image //gdispGBlitArea is a tricky function to use since it supports blitting part of the image - // if you have full screen image, then just use 128 and 32 for both source and target dimensions - gdispGBlitArea(GDISP, 0, 0, 128, 32, 0, 0, 128, (pixel_t*)resource_lcd_logo); + // if you have full screen image, then just use LCD_WIDTH and LCD_HEIGHT for both source and target dimensions + gdispGBlitArea(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, 0, 0, LCD_WIDTH, (pixel_t*)resource_lcd_logo); return false; } diff --git a/quantum/visualizer/led_backlight_keyframes.c b/quantum/visualizer/led_backlight_keyframes.c index d2921a391a..eb3f5561d8 100644 --- a/quantum/visualizer/led_backlight_keyframes.c +++ b/quantum/visualizer/led_backlight_keyframes.c @@ -41,8 +41,8 @@ static void keyframe_fade_all_leds_from_to(keyframe_animation_t* animation, uint } // TODO: Should be customizable per keyboard -#define NUM_ROWS LED_NUM_ROWS -#define NUM_COLS LED_NUM_COLS +#define NUM_ROWS LED_HEIGHT +#define NUM_COLS LED_WIDTH static uint8_t crossfade_start_frame[NUM_ROWS][NUM_COLS]; static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS]; 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 |