diff options
| author | Ethan Madden <crazeh.monkeh@gmail.com> | 2017-06-25 18:30:40 -0700 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2017-06-25 21:30:40 -0400 |
| commit | 42e6ecc36b65ad0f0d29c6c35c93b95078c11a1a (patch) | |
| tree | dbaf2d2f0a3ea05cedd0c30310c3533225cdc27b /quantum | |
| parent | 43579a80a7bba63ddf2b3eceb4d05a51727a7cbb (diff) | |
| download | qmk_firmware-42e6ecc36b65ad0f0d29c6c35c93b95078c11a1a.tar.gz qmk_firmware-42e6ecc36b65ad0f0d29c6c35c93b95078c11a1a.zip | |
Whitefox LED control (#1432)
* use new grave_esc functionality
* Port LED control from Ergodox Infinity to Whitefox
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/visualizer/led_keyframes.c | 4 | ||||
| -rw-r--r-- | quantum/visualizer/visualizer.c | 33 | ||||
| -rw-r--r-- | quantum/visualizer/visualizer.mk | 26 |
3 files changed, 36 insertions, 27 deletions
diff --git a/quantum/visualizer/led_keyframes.c b/quantum/visualizer/led_keyframes.c index 2f4e20043..7e6e5d1ab 100644 --- a/quantum/visualizer/led_keyframes.c +++ b/quantum/visualizer/led_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 7 | 44 | #define NUM_ROWS LED_NUM_ROWS |
| 45 | #define NUM_COLS 7 | 45 | #define NUM_COLS LED_NUM_COLS |
| 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.c b/quantum/visualizer/visualizer.c index a4b3ea7e4..cc99d1e3b 100644 --- a/quantum/visualizer/visualizer.c +++ b/quantum/visualizer/visualizer.c | |||
| @@ -105,15 +105,19 @@ static remote_object_t* remote_objects[] = { | |||
| 105 | GDisplay* LCD_DISPLAY = 0; | 105 | GDisplay* LCD_DISPLAY = 0; |
| 106 | GDisplay* LED_DISPLAY = 0; | 106 | GDisplay* LED_DISPLAY = 0; |
| 107 | 107 | ||
| 108 | #ifdef LCD_DISPLAY_NUMBER | ||
| 108 | __attribute__((weak)) | 109 | __attribute__((weak)) |
| 109 | GDisplay* get_lcd_display(void) { | 110 | GDisplay* get_lcd_display(void) { |
| 110 | return gdispGetDisplay(0); | 111 | return gdispGetDisplay(LCD_DISPLAY_NUMBER); |
| 111 | } | 112 | } |
| 113 | #endif | ||
| 112 | 114 | ||
| 115 | #ifdef LED_DISPLAY_NUMBER | ||
| 113 | __attribute__((weak)) | 116 | __attribute__((weak)) |
| 114 | GDisplay* get_led_display(void) { | 117 | GDisplay* get_led_display(void) { |
| 115 | return gdispGetDisplay(1); | 118 | return gdispGetDisplay(LED_DISPLAY_NUMBER); |
| 116 | } | 119 | } |
| 120 | #endif | ||
| 117 | 121 | ||
| 118 | void start_keyframe_animation(keyframe_animation_t* animation) { | 122 | void start_keyframe_animation(keyframe_animation_t* animation) { |
| 119 | animation->current_frame = -1; | 123 | animation->current_frame = -1; |
| @@ -251,9 +255,9 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) { | |||
| 251 | .mods = 0xFF, | 255 | .mods = 0xFF, |
| 252 | .leds = 0xFFFFFFFF, | 256 | .leds = 0xFFFFFFFF, |
| 253 | .suspended = false, | 257 | .suspended = false, |
| 254 | #ifdef VISUALIZER_USER_DATA_SIZE | 258 | #ifdef VISUALIZER_USER_DATA_SIZE |
| 255 | .user_data = {0}, | 259 | .user_data = {0}, |
| 256 | #endif | 260 | #endif |
| 257 | }; | 261 | }; |
| 258 | 262 | ||
| 259 | visualizer_state_t state = { | 263 | visualizer_state_t state = { |
| @@ -379,25 +383,26 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) { | |||
| 379 | void visualizer_init(void) { | 383 | void visualizer_init(void) { |
| 380 | gfxInit(); | 384 | gfxInit(); |
| 381 | 385 | ||
| 382 | #ifdef LCD_BACKLIGHT_ENABLE | 386 | #ifdef LCD_BACKLIGHT_ENABLE |
| 383 | lcd_backlight_init(); | 387 | lcd_backlight_init(); |
| 384 | #endif | 388 | #endif |
| 385 | 389 | ||
| 386 | #ifdef SERIAL_LINK_ENABLE | 390 | #ifdef SERIAL_LINK_ENABLE |
| 387 | add_remote_objects(remote_objects, sizeof(remote_objects) / sizeof(remote_object_t*) ); | 391 | add_remote_objects(remote_objects, sizeof(remote_objects) / sizeof(remote_object_t*) ); |
| 388 | #endif | 392 | #endif |
| 389 | 393 | ||
| 390 | #ifdef LCD_ENABLE | 394 | #ifdef LCD_ENABLE |
| 391 | LCD_DISPLAY = get_lcd_display(); | 395 | LCD_DISPLAY = get_lcd_display(); |
| 392 | #endif | 396 | #endif |
| 393 | #ifdef BACKLIGHT_ENABLE | 397 | |
| 398 | #ifdef BACKLIGHT_ENABLE | ||
| 394 | LED_DISPLAY = get_led_display(); | 399 | LED_DISPLAY = get_led_display(); |
| 395 | #endif | 400 | #endif |
| 396 | 401 | ||
| 397 | // We are using a low priority thread, the idea is to have it run only | 402 | // We are using a low priority thread, the idea is to have it run only |
| 398 | // when the main thread is sleeping during the matrix scanning | 403 | // when the main thread is sleeping during the matrix scanning |
| 399 | gfxThreadCreate(visualizerThreadStack, sizeof(visualizerThreadStack), | 404 | gfxThreadCreate(visualizerThreadStack, sizeof(visualizerThreadStack), |
| 400 | VISUALIZER_THREAD_PRIORITY, visualizerThread, NULL); | 405 | VISUALIZER_THREAD_PRIORITY, visualizerThread, NULL); |
| 401 | } | 406 | } |
| 402 | 407 | ||
| 403 | void update_status(bool changed) { | 408 | void update_status(bool changed) { |
diff --git a/quantum/visualizer/visualizer.mk b/quantum/visualizer/visualizer.mk index 6f97603bd..0f7d8636c 100644 --- a/quantum/visualizer/visualizer.mk +++ b/quantum/visualizer/visualizer.mk | |||
| @@ -51,19 +51,23 @@ GFXSRC := $(patsubst $(TOP_DIR)/%,%,$(GFXSRC)) | |||
| 51 | GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS))) | 51 | GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS))) |
| 52 | 52 | ||
| 53 | ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","") | 53 | ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","") |
| 54 | SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c | 54 | SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c |
| 55 | else | 55 | else |
| 56 | ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/visualizer.c)","") | 56 | ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/visualizer.c)","") |
| 57 | ifeq ("$(wildcard $(SUBPROJECT_PATH)/visualizer.c)","") | 57 | ifeq ("$(wildcard $(SUBPROJECT_PATH)/visualizer.c)","") |
| 58 | $(error "$(KEYMAP_PATH)/visualizer.c" does not exist) | 58 | ifeq ("$(wildcard $(KEYBOARD_PATH)/visualizer.c)","") |
| 59 | else | 59 | $(error "visualizer.c" not found") |
| 60 | SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/visualizer.c | 60 | else |
| 61 | endif | 61 | SRC += keyboards/$(KEYBOARD)/visualizer.c |
| 62 | else | 62 | endif |
| 63 | SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/visualizer.c | 63 | else |
| 64 | endif | 64 | SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/visualizer.c |
| 65 | endif | ||
| 66 | else | ||
| 67 | SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/visualizer.c | ||
| 68 | endif | ||
| 65 | endif | 69 | endif |
| 66 | 70 | ||
| 67 | ifdef EMULATOR | 71 | ifdef EMULATOR |
| 68 | UINCDIR += $(TMK_DIR)/common | 72 | UINCDIR += $(TMK_DIR)/common |
| 69 | endif \ No newline at end of file | 73 | endif |
