diff options
author | Fred Sundvik <fsundvik@gmail.com> | 2017-06-03 22:04:10 +0300 |
---|---|---|
committer | Fred Sundvik <fsundvik@gmail.com> | 2017-06-03 22:04:10 +0300 |
commit | b51a0db6ed03d939baad7cb9d87ed13c3653c7d2 (patch) | |
tree | 99e8b3fd3b71d198fef3c5d6a185e8fa4218ade2 | |
parent | 2a7f9a7e46e1f4350be249c267fa7c35fd6562b5 (diff) | |
download | qmk_firmware-b51a0db6ed03d939baad7cb9d87ed13c3653c7d2.tar.gz qmk_firmware-b51a0db6ed03d939baad7cb9d87ed13c3653c7d2.zip |
Add backlight support to the default Ergodox Infinity animations
-rw-r--r-- | keyboards/ergodox/infinity/animations.c | 69 | ||||
-rw-r--r-- | quantum/visualizer/led_keyframes.c | 14 | ||||
-rw-r--r-- | quantum/visualizer/led_keyframes.h | 3 |
3 files changed, 75 insertions, 11 deletions
diff --git a/keyboards/ergodox/infinity/animations.c b/keyboards/ergodox/infinity/animations.c index 0e732b741..675519e30 100644 --- a/keyboards/ergodox/infinity/animations.c +++ b/keyboards/ergodox/infinity/animations.c | |||
@@ -32,31 +32,78 @@ | |||
32 | #include "visualizer_keyframes.h" | 32 | #include "visualizer_keyframes.h" |
33 | 33 | ||
34 | 34 | ||
35 | #if defined(LCD_ENABLE) && defined(LCD_BACKLIGHT_ENABLE) | 35 | #if defined(LCD_ENABLE) || defined(LCD_BACKLIGHT_ENABLE) || defined(BACKLIGHT_ENABLE) |
36 | |||
37 | static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
38 | #ifdef LCD_ENABLE | ||
39 | lcd_keyframe_enable(animation, state); | ||
40 | #endif | ||
41 | #ifdef LCD_BACKLIGHT_ENABLE | ||
42 | backlight_keyframe_enable(animation, state); | ||
43 | #endif | ||
44 | #ifdef BACKLIGHT_ENABLE | ||
45 | led_keyframe_enable(animation, state); | ||
46 | #endif | ||
47 | return false; | ||
48 | } | ||
49 | |||
50 | static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
51 | #ifdef LCD_ENABLE | ||
52 | lcd_keyframe_disable(animation, state); | ||
53 | #endif | ||
54 | #ifdef LCD_BACKLIGHT_ENABLE | ||
55 | backlight_keyframe_disable(animation, state); | ||
56 | #endif | ||
57 | #ifdef BACKLIGHT_ENABLE | ||
58 | led_keyframe_disable(animation, state); | ||
59 | #endif | ||
60 | return false; | ||
61 | } | ||
62 | |||
63 | static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
64 | bool ret = false; | ||
65 | #ifdef LCD_BACKLIGHT_ENABLE | ||
66 | ret |= backlight_keyframe_animate_color(animation, state); | ||
67 | #endif | ||
68 | #ifdef BACLIGHT_ENABLE | ||
69 | ret |= led_keyframe_fade_in_all(animation, state); | ||
70 | #endif | ||
71 | return ret; | ||
72 | } | ||
73 | |||
74 | static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
75 | bool ret = false; | ||
76 | #ifdef LCD_BACKLIGHT_ENABLE | ||
77 | ret |= backlight_keyframe_animate_color(animation, state); | ||
78 | #endif | ||
79 | #ifdef BACLIGHT_ENABLE | ||
80 | ret |= led_keyframe_fade_out_all(animation, state); | ||
81 | #endif | ||
82 | return ret; | ||
83 | } | ||
84 | |||
36 | 85 | ||
37 | // Don't worry, if the startup animation is long, you can use the keyboard like normal | 86 | // Don't worry, if the startup animation is long, you can use the keyboard like normal |
38 | // during that time | 87 | // during that time |
39 | keyframe_animation_t default_startup_animation = { | 88 | keyframe_animation_t default_startup_animation = { |
40 | .num_frames = 4, | 89 | .num_frames = 3, |
41 | .loop = false, | 90 | .loop = false, |
42 | .frame_lengths = {0, 0, 0, gfxMillisecondsToTicks(5000), 0}, | 91 | .frame_lengths = {0, 0, gfxMillisecondsToTicks(5000)}, |
43 | .frame_functions = { | 92 | .frame_functions = { |
44 | lcd_keyframe_enable, | 93 | keyframe_enable, |
45 | backlight_keyframe_enable, | ||
46 | lcd_keyframe_draw_logo, | 94 | lcd_keyframe_draw_logo, |
47 | backlight_keyframe_animate_color, | 95 | keyframe_fade_in, |
48 | }, | 96 | }, |
49 | }; | 97 | }; |
50 | 98 | ||
51 | keyframe_animation_t default_suspend_animation = { | 99 | keyframe_animation_t default_suspend_animation = { |
52 | .num_frames = 4, | 100 | .num_frames = 3, |
53 | .loop = false, | 101 | .loop = false, |
54 | .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0, 0}, | 102 | .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0}, |
55 | .frame_functions = { | 103 | .frame_functions = { |
56 | lcd_keyframe_display_layer_text, | 104 | lcd_keyframe_display_layer_text, |
57 | backlight_keyframe_animate_color, | 105 | keyframe_fade_out, |
58 | lcd_keyframe_disable, | 106 | keyframe_disable, |
59 | backlight_keyframe_disable, | ||
60 | }, | 107 | }, |
61 | }; | 108 | }; |
62 | #endif | 109 | #endif |
diff --git a/quantum/visualizer/led_keyframes.c b/quantum/visualizer/led_keyframes.c index 2dacd990d..c14491e5e 100644 --- a/quantum/visualizer/led_keyframes.c +++ b/quantum/visualizer/led_keyframes.c | |||
@@ -127,3 +127,17 @@ bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer | |||
127 | gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0); | 127 | gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0); |
128 | return false; | 128 | return false; |
129 | } | 129 | } |
130 | |||
131 | bool led_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
132 | (void)state; | ||
133 | (void)animation; | ||
134 | gdispGSetPowerMode(LED_DISPLAY, powerOff); | ||
135 | return false; | ||
136 | } | ||
137 | |||
138 | bool led_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
139 | (void)state; | ||
140 | (void)animation; | ||
141 | gdispGSetPowerMode(LED_DISPLAY, powerOn); | ||
142 | return false; | ||
143 | } | ||
diff --git a/quantum/visualizer/led_keyframes.h b/quantum/visualizer/led_keyframes.h index a68943041..a59a4f37d 100644 --- a/quantum/visualizer/led_keyframes.h +++ b/quantum/visualizer/led_keyframes.h | |||
@@ -35,6 +35,9 @@ bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* | |||
35 | bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state); | 35 | bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state); |
36 | bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state); | 36 | bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state); |
37 | 37 | ||
38 | bool led_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state); | ||
39 | bool led_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state); | ||
40 | |||
38 | extern keyframe_animation_t led_test_animation; | 41 | extern keyframe_animation_t led_test_animation; |
39 | 42 | ||
40 | 43 | ||