]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Separated backlight and LCD disable/enable
authorFred Sundvik <fsundvik@gmail.com>
Wed, 5 Apr 2017 06:21:18 +0000 (09:21 +0300)
committerFred Sundvik <fsundvik@gmail.com>
Sun, 9 Apr 2017 15:34:59 +0000 (18:34 +0300)
Also moved them to correct places

keyboards/ergodox/infinity/visualizer.c
keyboards/ergodox/keymaps/default/visualizer.c
quantum/visualizer/lcd_backlight_keyframes.c
quantum/visualizer/lcd_backlight_keyframes.h
quantum/visualizer/lcd_keyframes.c
quantum/visualizer/lcd_keyframes.h
quantum/visualizer/visualizer.c
quantum/visualizer/visualizer.h

index bbed4e9897f16b1daef2cebdd39d41102f1b5271..8e684d991958a9c341657d0f2ea70a87a4c84e7c 100644 (file)
@@ -186,22 +186,24 @@ static keyframe_animation_t lcd_bitmap_leds_animation = {
 };
 
 static keyframe_animation_t suspend_animation = {
-    .num_frames = 3,
+    .num_frames = 4,
     .loop = false,
-    .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0},
+    .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0, 0},
     .frame_functions = {
             lcd_keyframe_display_layer_text,
             backlight_keyframe_animate_color,
-            keyframe_disable_lcd_and_backlight,
+            lcd_keyframe_disable,
+            lcd_keyframe_disable,
     },
 };
 
 static keyframe_animation_t resume_animation = {
-    .num_frames = 4,
+    .num_frames = 5,
     .loop = false,
-    .frame_lengths = {0, 0, gfxMillisecondsToTicks(10000), 0},
+    .frame_lengths = {0, 0, 0, gfxMillisecondsToTicks(10000), 0},
     .frame_functions = {
-            keyframe_enable_lcd_and_backlight,
+            lcd_keyframe_enable,
+            backlight_keyframe_enable,
             display_logo,
             backlight_keyframe_animate_color,
             enable_visualization,
index 07f5a44ab3dcb4f564ebc4c5cf224ee018133d5a..5ee49c9bc2a9fb23a971b2eb8ef03f48940a319e 100644 (file)
@@ -128,22 +128,24 @@ static keyframe_animation_t lcd_layer_display = {
 };
 
 static keyframe_animation_t suspend_animation = {
-    .num_frames = 3,
+    .num_frames = 4,
     .loop = false,
-    .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0},
+    .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0, 0},
     .frame_functions = {
             lcd_keyframe_display_layer_text,
             backlight_keyframe_animate_color,
-            keyframe_disable_lcd_and_backlight,
+            lcd_keyframe_disable,
+            lcd_keyframe_disable,
     },
 };
 
 static keyframe_animation_t resume_animation = {
-    .num_frames = 4,
+    .num_frames = 5,
     .loop = false,
-    .frame_lengths = {0, 0, gfxMillisecondsToTicks(10000), 0},
+    .frame_lengths = {0, 0, 0, gfxMillisecondsToTicks(10000), 0},
     .frame_functions = {
-            keyframe_enable_lcd_and_backlight,
+            lcd_keyframe_enable,
+            backlight_keyframe_enable,
             display_logo,
             backlight_keyframe_animate_color,
             enable_visualization,
index 096473708745255b14814986246008d67c58f0db..8436d4e3ddae21a727279c995e25ed1fde74c525 100644 (file)
@@ -59,3 +59,19 @@ bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_st
             LCD_INT(state->current_lcd_color));
     return false;
 }
+
+bool backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
+    (void)animation;
+    (void)state;
+    lcd_backlight_hal_color(0, 0, 0);
+    return false;
+}
+
+bool backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
+    (void)animation;
+    (void)state;
+    lcd_backlight_color(LCD_HUE(state->current_lcd_color),
+        LCD_SAT(state->current_lcd_color),
+        LCD_INT(state->current_lcd_color));
+    return false;
+}
index 8cd5a46c6ae8789c1fb6c6f893315394efeafeac..e1c125cf915f4e1a13083f34e5356798543c77a7 100644 (file)
@@ -24,4 +24,7 @@ bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualize
 // Sets the backlight color to the target color
 bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state);
 
+bool backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
+bool backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
+
 #endif /* QUANTUM_VISUALIZER_LCD_BACKLIGHT_KEYFRAMES_H_ */
index 00d9734e6aeb78e28faa890f558765bdf9b07b9d..74f6e3b47038816e4e20f948ae1aba9c4650fec8 100644 (file)
@@ -158,3 +158,17 @@ bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation,
     gdispFlush();
     return false;
 }
+
+bool lcd_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
+    (void)animation;
+    (void)state;
+    gdispSetPowerMode(powerOff);
+    return false;
+}
+
+bool lcd_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
+    (void)animation;
+    (void)state;
+    gdispSetPowerMode(powerOn);
+    return false;
+}
index 0c9f39ab8c58dfaf3d96851a5343ff51d0ee771b..8f79a541c88b92b6dd0c369d7e62d12912f252a9 100644 (file)
@@ -30,4 +30,8 @@ bool lcd_keyframe_display_led_states(keyframe_animation_t* animation, visualizer
 // Displays both the layer text and the led states
 bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation, visualizer_state_t* state);
 
+bool lcd_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
+bool lcd_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
+
+
 #endif /* QUANTUM_VISUALIZER_LCD_KEYFRAMES_H_ */
index 6ebd806e40b9240256883bc16e7024e74d0393e9..98cd7ba55410235b74c7843e65af7b16c2b502f3 100644 (file)
@@ -228,27 +228,6 @@ bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t*
     return false;
 }
 
-bool keyframe_disable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state) {
-    (void)animation;
-    (void)state;
-#ifdef LCD_ENABLE
-    gdispSetPowerMode(powerOff);
-#endif
-#ifdef LCD_BACKLIGHT_ENABLE
-    lcd_backlight_hal_color(0, 0, 0);
-#endif
-    return false;
-}
-
-bool keyframe_enable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state) {
-    (void)animation;
-    (void)state;
-#ifdef LCD_ENABLE
-    gdispSetPowerMode(powerOn);
-#endif
-    return false;
-}
-
 bool enable_visualization(keyframe_animation_t* animation, visualizer_state_t* state) {
     (void)animation;
     (void)state;
index 5c870dbfe94bc0fb123dd78b40016d3a4ce2ce73..f37ce8416e348417dbf37701e2bf4969c26b4798 100644 (file)
@@ -130,9 +130,6 @@ void run_next_keyframe(keyframe_animation_t* animation, visualizer_state_t* stat
 // Does nothing, useful for adding delays
 bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t* state);
 
-bool keyframe_disable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state);
-bool keyframe_enable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state);
-
 // Call this once, when the initial animation has finished, alternatively you can call it
 // directly from the initalize_user_visualizer function (the animation can be null)
 bool enable_visualization(keyframe_animation_t* animation, visualizer_state_t* state);