diff options
| author | Fred Sundvik <fsundvik@gmail.com> | 2017-04-05 09:21:18 +0300 |
|---|---|---|
| committer | Fred Sundvik <fsundvik@gmail.com> | 2017-04-09 18:34:59 +0300 |
| commit | 1e7585e76771e1a2d8ca733fc09c19f9fa0e903c (patch) | |
| tree | e4e5ebff65cd1f60fe4ecdd71501c05bff9b6b24 | |
| parent | 5ba228b684a32c1099efc6207842a56ff102961a (diff) | |
| download | qmk_firmware-1e7585e76771e1a2d8ca733fc09c19f9fa0e903c.tar.gz qmk_firmware-1e7585e76771e1a2d8ca733fc09c19f9fa0e903c.zip | |
Separated backlight and LCD disable/enable
Also moved them to correct places
| -rw-r--r-- | keyboards/ergodox/infinity/visualizer.c | 14 | ||||
| -rw-r--r-- | keyboards/ergodox/keymaps/default/visualizer.c | 14 | ||||
| -rw-r--r-- | quantum/visualizer/lcd_backlight_keyframes.c | 16 | ||||
| -rw-r--r-- | quantum/visualizer/lcd_backlight_keyframes.h | 3 | ||||
| -rw-r--r-- | quantum/visualizer/lcd_keyframes.c | 14 | ||||
| -rw-r--r-- | quantum/visualizer/lcd_keyframes.h | 4 | ||||
| -rw-r--r-- | quantum/visualizer/visualizer.c | 21 | ||||
| -rw-r--r-- | quantum/visualizer/visualizer.h | 3 |
8 files changed, 53 insertions, 36 deletions
diff --git a/keyboards/ergodox/infinity/visualizer.c b/keyboards/ergodox/infinity/visualizer.c index bbed4e989..8e684d991 100644 --- a/keyboards/ergodox/infinity/visualizer.c +++ b/keyboards/ergodox/infinity/visualizer.c | |||
| @@ -186,22 +186,24 @@ static keyframe_animation_t lcd_bitmap_leds_animation = { | |||
| 186 | }; | 186 | }; |
| 187 | 187 | ||
| 188 | static keyframe_animation_t suspend_animation = { | 188 | static keyframe_animation_t suspend_animation = { |
| 189 | .num_frames = 3, | 189 | .num_frames = 4, |
| 190 | .loop = false, | 190 | .loop = false, |
| 191 | .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0}, | 191 | .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0, 0}, |
| 192 | .frame_functions = { | 192 | .frame_functions = { |
| 193 | lcd_keyframe_display_layer_text, | 193 | lcd_keyframe_display_layer_text, |
| 194 | backlight_keyframe_animate_color, | 194 | backlight_keyframe_animate_color, |
| 195 | keyframe_disable_lcd_and_backlight, | 195 | lcd_keyframe_disable, |
| 196 | lcd_keyframe_disable, | ||
| 196 | }, | 197 | }, |
| 197 | }; | 198 | }; |
| 198 | 199 | ||
| 199 | static keyframe_animation_t resume_animation = { | 200 | static keyframe_animation_t resume_animation = { |
| 200 | .num_frames = 4, | 201 | .num_frames = 5, |
| 201 | .loop = false, | 202 | .loop = false, |
| 202 | .frame_lengths = {0, 0, gfxMillisecondsToTicks(10000), 0}, | 203 | .frame_lengths = {0, 0, 0, gfxMillisecondsToTicks(10000), 0}, |
| 203 | .frame_functions = { | 204 | .frame_functions = { |
| 204 | keyframe_enable_lcd_and_backlight, | 205 | lcd_keyframe_enable, |
| 206 | backlight_keyframe_enable, | ||
| 205 | display_logo, | 207 | display_logo, |
| 206 | backlight_keyframe_animate_color, | 208 | backlight_keyframe_animate_color, |
| 207 | enable_visualization, | 209 | enable_visualization, |
diff --git a/keyboards/ergodox/keymaps/default/visualizer.c b/keyboards/ergodox/keymaps/default/visualizer.c index 07f5a44ab..5ee49c9bc 100644 --- a/keyboards/ergodox/keymaps/default/visualizer.c +++ b/keyboards/ergodox/keymaps/default/visualizer.c | |||
| @@ -128,22 +128,24 @@ static keyframe_animation_t lcd_layer_display = { | |||
| 128 | }; | 128 | }; |
| 129 | 129 | ||
| 130 | static keyframe_animation_t suspend_animation = { | 130 | static keyframe_animation_t suspend_animation = { |
| 131 | .num_frames = 3, | 131 | .num_frames = 4, |
| 132 | .loop = false, | 132 | .loop = false, |
| 133 | .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0}, | 133 | .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0, 0}, |
| 134 | .frame_functions = { | 134 | .frame_functions = { |
| 135 | lcd_keyframe_display_layer_text, | 135 | lcd_keyframe_display_layer_text, |
| 136 | backlight_keyframe_animate_color, | 136 | backlight_keyframe_animate_color, |
| 137 | keyframe_disable_lcd_and_backlight, | 137 | lcd_keyframe_disable, |
| 138 | lcd_keyframe_disable, | ||
| 138 | }, | 139 | }, |
| 139 | }; | 140 | }; |
| 140 | 141 | ||
| 141 | static keyframe_animation_t resume_animation = { | 142 | static keyframe_animation_t resume_animation = { |
| 142 | .num_frames = 4, | 143 | .num_frames = 5, |
| 143 | .loop = false, | 144 | .loop = false, |
| 144 | .frame_lengths = {0, 0, gfxMillisecondsToTicks(10000), 0}, | 145 | .frame_lengths = {0, 0, 0, gfxMillisecondsToTicks(10000), 0}, |
| 145 | .frame_functions = { | 146 | .frame_functions = { |
| 146 | keyframe_enable_lcd_and_backlight, | 147 | lcd_keyframe_enable, |
| 148 | backlight_keyframe_enable, | ||
| 147 | display_logo, | 149 | display_logo, |
| 148 | backlight_keyframe_animate_color, | 150 | backlight_keyframe_animate_color, |
| 149 | enable_visualization, | 151 | enable_visualization, |
diff --git a/quantum/visualizer/lcd_backlight_keyframes.c b/quantum/visualizer/lcd_backlight_keyframes.c index 096473708..8436d4e3d 100644 --- a/quantum/visualizer/lcd_backlight_keyframes.c +++ b/quantum/visualizer/lcd_backlight_keyframes.c | |||
| @@ -59,3 +59,19 @@ bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_st | |||
| 59 | LCD_INT(state->current_lcd_color)); | 59 | LCD_INT(state->current_lcd_color)); |
| 60 | return false; | 60 | return false; |
| 61 | } | 61 | } |
| 62 | |||
| 63 | bool backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 64 | (void)animation; | ||
| 65 | (void)state; | ||
| 66 | lcd_backlight_hal_color(0, 0, 0); | ||
| 67 | return false; | ||
| 68 | } | ||
| 69 | |||
| 70 | bool backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 71 | (void)animation; | ||
| 72 | (void)state; | ||
| 73 | lcd_backlight_color(LCD_HUE(state->current_lcd_color), | ||
| 74 | LCD_SAT(state->current_lcd_color), | ||
| 75 | LCD_INT(state->current_lcd_color)); | ||
| 76 | return false; | ||
| 77 | } | ||
diff --git a/quantum/visualizer/lcd_backlight_keyframes.h b/quantum/visualizer/lcd_backlight_keyframes.h index 8cd5a46c6..e1c125cf9 100644 --- a/quantum/visualizer/lcd_backlight_keyframes.h +++ b/quantum/visualizer/lcd_backlight_keyframes.h | |||
| @@ -24,4 +24,7 @@ bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualize | |||
| 24 | // Sets the backlight color to the target color | 24 | // Sets the backlight color to the target color |
| 25 | bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state); | 25 | bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state); |
| 26 | 26 | ||
| 27 | bool backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state); | ||
| 28 | bool backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state); | ||
| 29 | |||
| 27 | #endif /* QUANTUM_VISUALIZER_LCD_BACKLIGHT_KEYFRAMES_H_ */ | 30 | #endif /* QUANTUM_VISUALIZER_LCD_BACKLIGHT_KEYFRAMES_H_ */ |
diff --git a/quantum/visualizer/lcd_keyframes.c b/quantum/visualizer/lcd_keyframes.c index 00d9734e6..74f6e3b47 100644 --- a/quantum/visualizer/lcd_keyframes.c +++ b/quantum/visualizer/lcd_keyframes.c | |||
| @@ -158,3 +158,17 @@ bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation, | |||
| 158 | gdispFlush(); | 158 | gdispFlush(); |
| 159 | return false; | 159 | return false; |
| 160 | } | 160 | } |
| 161 | |||
| 162 | bool lcd_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 163 | (void)animation; | ||
| 164 | (void)state; | ||
| 165 | gdispSetPowerMode(powerOff); | ||
| 166 | return false; | ||
| 167 | } | ||
| 168 | |||
| 169 | bool lcd_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 170 | (void)animation; | ||
| 171 | (void)state; | ||
| 172 | gdispSetPowerMode(powerOn); | ||
| 173 | return false; | ||
| 174 | } | ||
diff --git a/quantum/visualizer/lcd_keyframes.h b/quantum/visualizer/lcd_keyframes.h index 0c9f39ab8..8f79a541c 100644 --- a/quantum/visualizer/lcd_keyframes.h +++ b/quantum/visualizer/lcd_keyframes.h | |||
| @@ -30,4 +30,8 @@ bool lcd_keyframe_display_led_states(keyframe_animation_t* animation, visualizer | |||
| 30 | // Displays both the layer text and the led states | 30 | // Displays both the layer text and the led states |
| 31 | bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation, visualizer_state_t* state); | 31 | bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation, visualizer_state_t* state); |
| 32 | 32 | ||
| 33 | bool lcd_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state); | ||
| 34 | bool lcd_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state); | ||
| 35 | |||
| 36 | |||
| 33 | #endif /* QUANTUM_VISUALIZER_LCD_KEYFRAMES_H_ */ | 37 | #endif /* QUANTUM_VISUALIZER_LCD_KEYFRAMES_H_ */ |
diff --git a/quantum/visualizer/visualizer.c b/quantum/visualizer/visualizer.c index 6ebd806e4..98cd7ba55 100644 --- a/quantum/visualizer/visualizer.c +++ b/quantum/visualizer/visualizer.c | |||
| @@ -228,27 +228,6 @@ bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t* | |||
| 228 | return false; | 228 | return false; |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | bool keyframe_disable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 232 | (void)animation; | ||
| 233 | (void)state; | ||
| 234 | #ifdef LCD_ENABLE | ||
| 235 | gdispSetPowerMode(powerOff); | ||
| 236 | #endif | ||
| 237 | #ifdef LCD_BACKLIGHT_ENABLE | ||
| 238 | lcd_backlight_hal_color(0, 0, 0); | ||
| 239 | #endif | ||
| 240 | return false; | ||
| 241 | } | ||
| 242 | |||
| 243 | bool keyframe_enable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 244 | (void)animation; | ||
| 245 | (void)state; | ||
| 246 | #ifdef LCD_ENABLE | ||
| 247 | gdispSetPowerMode(powerOn); | ||
| 248 | #endif | ||
| 249 | return false; | ||
| 250 | } | ||
| 251 | |||
| 252 | bool enable_visualization(keyframe_animation_t* animation, visualizer_state_t* state) { | 231 | bool enable_visualization(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 253 | (void)animation; | 232 | (void)animation; |
| 254 | (void)state; | 233 | (void)state; |
diff --git a/quantum/visualizer/visualizer.h b/quantum/visualizer/visualizer.h index 5c870dbfe..f37ce8416 100644 --- a/quantum/visualizer/visualizer.h +++ b/quantum/visualizer/visualizer.h | |||
| @@ -130,9 +130,6 @@ void run_next_keyframe(keyframe_animation_t* animation, visualizer_state_t* stat | |||
| 130 | // Does nothing, useful for adding delays | 130 | // Does nothing, useful for adding delays |
| 131 | bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t* state); | 131 | bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t* state); |
| 132 | 132 | ||
| 133 | bool keyframe_disable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state); | ||
| 134 | bool keyframe_enable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state); | ||
| 135 | |||
| 136 | // Call this once, when the initial animation has finished, alternatively you can call it | 133 | // Call this once, when the initial animation has finished, alternatively you can call it |
| 137 | // directly from the initalize_user_visualizer function (the animation can be null) | 134 | // directly from the initalize_user_visualizer function (the animation can be null) |
| 138 | bool enable_visualization(keyframe_animation_t* animation, visualizer_state_t* state); | 135 | bool enable_visualization(keyframe_animation_t* animation, visualizer_state_t* state); |
