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/visualizer | |
| parent | 4da3b19603255115f71812964383ee7b518637be (diff) | |
| download | qmk_firmware-9d8279960d8784d5602025f6845b0af92db12848.tar.gz qmk_firmware-9d8279960d8784d5602025f6845b0af92db12848.zip | |
Make it easier to use drivers
Diffstat (limited to 'quantum/visualizer')
| -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 82e4184d2..75eb45700 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* | |||
| 166 | // or state structs, here we use the image | 166 | // or state structs, here we use the image |
| 167 | 167 | ||
| 168 | //gdispGBlitArea is a tricky function to use since it supports blitting part of the image | 168 | //gdispGBlitArea is a tricky function to use since it supports blitting part of the image |
| 169 | // if you have full screen image, then just use 128 and 32 for both source and target dimensions | 169 | // if you have full screen image, then just use LCD_WIDTH and LCD_HEIGHT for both source and target dimensions |
| 170 | gdispGBlitArea(GDISP, 0, 0, 128, 32, 0, 0, 128, (pixel_t*)resource_lcd_logo); | 170 | gdispGBlitArea(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, 0, 0, LCD_WIDTH, (pixel_t*)resource_lcd_logo); |
| 171 | 171 | ||
| 172 | return false; | 172 | return false; |
| 173 | } | 173 | } |
diff --git a/quantum/visualizer/led_backlight_keyframes.c b/quantum/visualizer/led_backlight_keyframes.c index d2921a391..eb3f5561d 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 | |||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | // TODO: Should be customizable per keyboard | 43 | // TODO: Should be customizable per keyboard |
| 44 | #define NUM_ROWS LED_NUM_ROWS | 44 | #define NUM_ROWS LED_HEIGHT |
| 45 | #define NUM_COLS LED_NUM_COLS | 45 | #define NUM_COLS LED_WIDTH |
| 46 | 46 | ||
| 47 | static uint8_t crossfade_start_frame[NUM_ROWS][NUM_COLS]; | 47 | static uint8_t crossfade_start_frame[NUM_ROWS][NUM_COLS]; |
| 48 | static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS]; | 48 | static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS]; |
diff --git a/quantum/visualizer/visualizer.mk b/quantum/visualizer/visualizer.mk index 3a0f771bc..102d23b7e 100644 --- a/quantum/visualizer/visualizer.mk +++ b/quantum/visualizer/visualizer.mk | |||
| @@ -20,6 +20,30 @@ | |||
| 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 | # SOFTWARE. | 21 | # SOFTWARE. |
| 22 | 22 | ||
| 23 | define ADD_DRIVER | ||
| 24 | $(1)_DRIVER:=$(strip $($(1)_DRIVER)) | ||
| 25 | $(1)_WIDTH:=$(strip $($(1)_WIDTH)) | ||
| 26 | $(1)_HEIGHT:=$(strip $($(1)_HEIGHT)) | ||
| 27 | ifeq ($($(1)_DRIVER),) | ||
| 28 | $$(error $(1)_DRIVER is not defined) | ||
| 29 | endif | ||
| 30 | ifeq ($($(1)_WIDTH),) | ||
| 31 | $$(error $(1)_WIDTH is not defined) | ||
| 32 | endif | ||
| 33 | ifeq ($($(1)_HEIGHT),) | ||
| 34 | $$(error $(1)_HEIGHT is not defined) | ||
| 35 | endif | ||
| 36 | OPT_DEFS+=-D$(1)_WIDTH=$($(1)_WIDTH) | ||
| 37 | OPT_DEFS+=-D$(1)_HEIGHT=$($(1)_HEIGHT) | ||
| 38 | GFXDEFS+=-D$(1)_WIDTH=$($(1)_WIDTH) | ||
| 39 | GFXDEFS+=-D$(1)_HEIGHT=$($(1)_HEIGHT) | ||
| 40 | $(1)_DISPLAY_NUMBER:=$$(words $$(GDISP_DRIVER_LIST)) | ||
| 41 | OPT_DEFS+=-D$(1)_DISPLAY_NUMBER=$$($(1)_DISPLAY_NUMBER) | ||
| 42 | include $(TOP_DIR)/drivers/ugfx/gdisp/$($(1)_DRIVER)/driver.mk | ||
| 43 | endef | ||
| 44 | |||
| 45 | GDISP_DRIVER_LIST:= | ||
| 46 | |||
| 23 | SRC += $(VISUALIZER_DIR)/visualizer.c \ | 47 | SRC += $(VISUALIZER_DIR)/visualizer.c \ |
| 24 | $(VISUALIZER_DIR)/visualizer_keyframes.c | 48 | $(VISUALIZER_DIR)/visualizer_keyframes.c |
| 25 | EXTRAINCDIRS += $(GFXINC) $(VISUALIZER_DIR) | 49 | EXTRAINCDIRS += $(GFXINC) $(VISUALIZER_DIR) |
| @@ -40,10 +64,12 @@ SRC += $(VISUALIZER_DIR)/lcd_backlight_keyframes.c | |||
| 40 | # Note, that the linker will strip out any resources that are not actually in use | 64 | # Note, that the linker will strip out any resources that are not actually in use |
| 41 | SRC += $(VISUALIZER_DIR)/resources/lcd_logo.c | 65 | SRC += $(VISUALIZER_DIR)/resources/lcd_logo.c |
| 42 | OPT_DEFS += -DLCD_BACKLIGHT_ENABLE | 66 | OPT_DEFS += -DLCD_BACKLIGHT_ENABLE |
| 67 | $(eval $(call ADD_DRIVER,LCD)) | ||
| 43 | endif | 68 | endif |
| 44 | 69 | ||
| 45 | ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) | 70 | ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) |
| 46 | SRC += $(VISUALIZER_DIR)/led_backlight_keyframes.c | 71 | SRC += $(VISUALIZER_DIR)/led_backlight_keyframes.c |
| 72 | $(eval $(call ADD_DRIVER,LED)) | ||
| 47 | endif | 73 | endif |
| 48 | 74 | ||
| 49 | SRC += $(VISUALIZER_DIR)/default_animations.c | 75 | SRC += $(VISUALIZER_DIR)/default_animations.c |
| @@ -55,6 +81,15 @@ GFXINC += quantum/visualizer | |||
| 55 | GFXSRC := $(patsubst $(TOP_DIR)/%,%,$(GFXSRC)) | 81 | GFXSRC := $(patsubst $(TOP_DIR)/%,%,$(GFXSRC)) |
| 56 | GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS))) | 82 | GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS))) |
| 57 | 83 | ||
| 84 | GDISP_LIST_COMMA=, | ||
| 85 | GDISP_LIST_EMPTY= | ||
| 86 | GDISP_LIST_SPACE=$(GDISP_LIST_EMPTY) $(GDISP_LIST_EMPTY) | ||
| 87 | |||
| 88 | GDISP_DRIVER_LIST := $(strip $(GDISP_DRIVER_LIST)) | ||
| 89 | GDISP_DRIVER_LIST := $(subst $(GDISP_LIST_SPACE),$(GDISP_LIST_COMMA),$(GDISP_DRIVER_LIST)) | ||
| 90 | |||
| 91 | GFXDEFS +=-DGDISP_DRIVER_LIST="$(GDISP_DRIVER_LIST)" | ||
| 92 | |||
| 58 | ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","") | 93 | ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","") |
| 59 | SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c | 94 | SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c |
| 60 | else | 95 | else |
