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/visualizer/visualizer.c | |
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/visualizer/visualizer.c')
-rw-r--r-- | quantum/visualizer/visualizer.c | 33 |
1 files changed, 19 insertions, 14 deletions
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) { |