summaryrefslogtreecommitdiff
path: root/quantum/visualizer
diff options
context:
space:
mode:
authorEthan Madden <crazeh.monkeh@gmail.com>2017-06-25 18:30:40 -0700
committerJack Humbert <jack.humb@gmail.com>2017-06-25 21:30:40 -0400
commit42e6ecc36b65ad0f0d29c6c35c93b95078c11a1a (patch)
treedbaf2d2f0a3ea05cedd0c30310c3533225cdc27b /quantum/visualizer
parent43579a80a7bba63ddf2b3eceb4d05a51727a7cbb (diff)
Whitefox LED control (#1432)
* use new grave_esc functionality * Port LED control from Ergodox Infinity to Whitefox
Diffstat (limited to 'quantum/visualizer')
-rw-r--r--quantum/visualizer/led_keyframes.c4
-rw-r--r--quantum/visualizer/visualizer.c33
-rw-r--r--quantum/visualizer/visualizer.mk26
3 files changed, 36 insertions, 27 deletions
diff --git a/quantum/visualizer/led_keyframes.c b/quantum/visualizer/led_keyframes.c
index 2f4e200439..7e6e5d1ab9 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
}
// TODO: Should be customizable per keyboard
-#define NUM_ROWS 7
-#define NUM_COLS 7
+#define NUM_ROWS LED_NUM_ROWS
+#define NUM_COLS LED_NUM_COLS
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.c b/quantum/visualizer/visualizer.c
index a4b3ea7e49..cc99d1e3b6 100644
--- a/quantum/visualizer/visualizer.c
+++ b/quantum/visualizer/visualizer.c
@@ -105,15 +105,19 @@ static remote_object_t* remote_objects[] = {
GDisplay* LCD_DISPLAY = 0;
GDisplay* LED_DISPLAY = 0;
+#ifdef LCD_DISPLAY_NUMBER
__attribute__((weak))
GDisplay* get_lcd_display(void) {
- return gdispGetDisplay(0);
+ return gdispGetDisplay(LCD_DISPLAY_NUMBER);
}
+#endif
+#ifdef LED_DISPLAY_NUMBER
__attribute__((weak))
GDisplay* get_led_display(void) {
- return gdispGetDisplay(1);
+ return gdispGetDisplay(LED_DISPLAY_NUMBER);
}
+#endif
void start_keyframe_animation(keyframe_animation_t* animation) {
animation->current_frame = -1;
@@ -251,9 +255,9 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) {
.mods = 0xFF,
.leds = 0xFFFFFFFF,
.suspended = false,
-#ifdef VISUALIZER_USER_DATA_SIZE
+ #ifdef VISUALIZER_USER_DATA_SIZE
.user_data = {0},
-#endif
+ #endif
};
visualizer_state_t state = {
@@ -379,25 +383,26 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) {
void visualizer_init(void) {
gfxInit();
-#ifdef LCD_BACKLIGHT_ENABLE
+ #ifdef LCD_BACKLIGHT_ENABLE
lcd_backlight_init();
-#endif
+ #endif
-#ifdef SERIAL_LINK_ENABLE
+ #ifdef SERIAL_LINK_ENABLE
add_remote_objects(remote_objects, sizeof(remote_objects) / sizeof(remote_object_t*) );
-#endif
+ #endif
-#ifdef LCD_ENABLE
+ #ifdef LCD_ENABLE
LCD_DISPLAY = get_lcd_display();
-#endif
-#ifdef BACKLIGHT_ENABLE
+ #endif
+
+ #ifdef BACKLIGHT_ENABLE
LED_DISPLAY = get_led_display();
-#endif
+ #endif
// We are using a low priority thread, the idea is to have it run only
// when the main thread is sleeping during the matrix scanning
- gfxThreadCreate(visualizerThreadStack, sizeof(visualizerThreadStack),
- VISUALIZER_THREAD_PRIORITY, visualizerThread, NULL);
+ gfxThreadCreate(visualizerThreadStack, sizeof(visualizerThreadStack),
+ VISUALIZER_THREAD_PRIORITY, visualizerThread, NULL);
}
void update_status(bool changed) {
diff --git a/quantum/visualizer/visualizer.mk b/quantum/visualizer/visualizer.mk
index 6f97603bd8..0f7d8636cf 100644
--- a/quantum/visualizer/visualizer.mk
+++ b/quantum/visualizer/visualizer.mk
@@ -51,19 +51,23 @@ GFXSRC := $(patsubst $(TOP_DIR)/%,%,$(GFXSRC))
GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS)))
ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","")
- SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c
+ SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c
else
- ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/visualizer.c)","")
- ifeq ("$(wildcard $(SUBPROJECT_PATH)/visualizer.c)","")
-$(error "$(KEYMAP_PATH)/visualizer.c" does not exist)
- else
- SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/visualizer.c
- endif
- else
- SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/visualizer.c
- endif
+ ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/visualizer.c)","")
+ ifeq ("$(wildcard $(SUBPROJECT_PATH)/visualizer.c)","")
+ ifeq ("$(wildcard $(KEYBOARD_PATH)/visualizer.c)","")
+$(error "visualizer.c" not found")
+ else
+ SRC += keyboards/$(KEYBOARD)/visualizer.c
+ endif
+ else
+ SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/visualizer.c
+ endif
+ else
+ SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/visualizer.c
+ endif
endif
ifdef EMULATOR
UINCDIR += $(TMK_DIR)/common
-endif \ No newline at end of file
+endif