]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Add custom led and lcd display support
authorFred Sundvik <fsundvik@gmail.com>
Wed, 18 May 2016 05:40:36 +0000 (08:40 +0300)
committerFred Sundvik <fsundvik@gmail.com>
Wed, 18 May 2016 05:40:36 +0000 (08:40 +0300)
visualizer.c
visualizer.h

index ff99e960fdadd9fb18c9e1765372209fcd457931..bbb00debcf283b82494ccf2f6374760ce086ee4f 100644 (file)
@@ -85,6 +85,15 @@ static remote_object_t* remote_objects[] = {
 GDisplay* LCD_DISPLAY = 0;
 GDisplay* LED_DISPLAY = 0;
 
+__attribute__((weak))
+GDisplay* get_lcd_display(void) {
+    return gdispGetDisplay(0);
+}
+
+__attribute__((weak))
+GDisplay* get_led_display(void) {
+    return gdispGetDisplay(1);
+}
 
 void start_keyframe_animation(keyframe_animation_t* animation) {
     animation->current_frame = -1;
@@ -444,10 +453,13 @@ void visualizer_init(void) {
 #ifdef USE_SERIAL_LINK
     add_remote_objects(remote_objects, sizeof(remote_objects) / sizeof(remote_object_t*) );
 #endif
-    // TODO: Make sure these works when either of these are disabled
-    LCD_DISPLAY = gdispGetDisplay(0);
-    LED_DISPLAY = gdispGetDisplay(1);
 
+#ifdef LCD_ENABLE
+    LCD_DISPLAY = get_lcd_display();
+#endif
+#ifdef LED_ENABLE
+    LED_DISPLAY = get_led_display();
+#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
index 8a2772c6dab0eee68ed843895f706a8a4006f93e..4d6a61dda3da8e834fa613df41f915b2dd704048 100644 (file)
@@ -45,6 +45,11 @@ void visualizer_suspend(void);
 // This should be called when the keyboard wakes up from suspend state
 void visualizer_resume(void);
 
+// These functions are week, so they can be overridden by the keyboard
+// if needed
+GDisplay* get_lcd_display(void);
+GDisplay* get_led_display(void);
+
 // If you need support for more than 16 keyframes per animation, you can change this
 #define MAX_VISUALIZER_KEY_FRAMES 16