1 /* Copyright 2017 Fred Sundvik
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #if defined(VISUALIZER_ENABLE)
19 # include "default_animations.h"
20 # include "visualizer.h"
22 # include "lcd_keyframes.h"
24 # ifdef LCD_BACKLIGHT_ENABLE
25 # include "lcd_backlight_keyframes.h"
28 # ifdef BACKLIGHT_ENABLE
29 # include "led_backlight_keyframes.h"
32 # include "visualizer_keyframes.h"
34 # if defined(LCD_ENABLE) || defined(LCD_BACKLIGHT_ENABLE) || defined(BACKLIGHT_ENABLE)
36 static bool keyframe_enable(keyframe_animation_t
* animation
, visualizer_state_t
* state
) {
38 lcd_keyframe_enable(animation
, state
);
40 # ifdef LCD_BACKLIGHT_ENABLE
41 lcd_backlight_keyframe_enable(animation
, state
);
43 # ifdef BACKLIGHT_ENABLE
44 led_backlight_keyframe_enable(animation
, state
);
49 static bool keyframe_disable(keyframe_animation_t
* animation
, visualizer_state_t
* state
) {
51 lcd_keyframe_disable(animation
, state
);
53 # ifdef LCD_BACKLIGHT_ENABLE
54 lcd_backlight_keyframe_disable(animation
, state
);
56 # ifdef BACKLIGHT_ENABLE
57 led_backlight_keyframe_disable(animation
, state
);
62 static bool keyframe_fade_in(keyframe_animation_t
* animation
, visualizer_state_t
* state
) {
64 # ifdef LCD_BACKLIGHT_ENABLE
65 ret
|= lcd_backlight_keyframe_animate_color(animation
, state
);
67 # ifdef BACKLIGHT_ENABLE
68 ret
|= led_backlight_keyframe_fade_in_all(animation
, state
);
73 static bool keyframe_fade_out(keyframe_animation_t
* animation
, visualizer_state_t
* state
) {
75 # ifdef LCD_BACKLIGHT_ENABLE
76 ret
|= lcd_backlight_keyframe_animate_color(animation
, state
);
78 # ifdef BACKLIGHT_ENABLE
79 ret
|= led_backlight_keyframe_fade_out_all(animation
, state
);
84 // Don't worry, if the startup animation is long, you can use the keyboard like normal
86 keyframe_animation_t default_startup_animation
= {
97 gfxMillisecondsToTicks(5000)},
102 lcd_keyframe_draw_logo
,
108 keyframe_animation_t default_suspend_animation
= {
120 gfxMillisecondsToTicks(1000), 0},
124 lcd_keyframe_display_layer_text
,
132 # if defined(BACKLIGHT_ENABLE)
133 # define CROSSFADE_TIME 1000
134 # define GRADIENT_TIME 3000
136 keyframe_animation_t led_test_animation
= {
141 gfxMillisecondsToTicks(1000), // fade in
142 gfxMillisecondsToTicks(1000), // no op (leds on)
143 gfxMillisecondsToTicks(1000), // fade out
144 gfxMillisecondsToTicks(CROSSFADE_TIME
), // crossfade
145 gfxMillisecondsToTicks(GRADIENT_TIME
), // left to rigt (outside in)
146 gfxMillisecondsToTicks(CROSSFADE_TIME
), // crossfade
147 gfxMillisecondsToTicks(GRADIENT_TIME
), // top_to_bottom
149 gfxMillisecondsToTicks(CROSSFADE_TIME
), // crossfade
150 gfxMillisecondsToTicks(GRADIENT_TIME
), // left_to_right (mirrored, so inside out)
151 gfxMillisecondsToTicks(CROSSFADE_TIME
), // crossfade
152 gfxMillisecondsToTicks(GRADIENT_TIME
), // top_to_bottom
154 gfxMillisecondsToTicks(CROSSFADE_TIME
), // crossfade
159 led_backlight_keyframe_fade_in_all
,
160 keyframe_no_operation
,
161 led_backlight_keyframe_fade_out_all
,
162 led_backlight_keyframe_crossfade
,
163 led_backlight_keyframe_left_to_right_gradient
,
164 led_backlight_keyframe_crossfade
,
165 led_backlight_keyframe_top_to_bottom_gradient
,
166 led_backlight_keyframe_mirror_orientation
,
167 led_backlight_keyframe_crossfade
,
168 led_backlight_keyframe_left_to_right_gradient
,
169 led_backlight_keyframe_crossfade
,
170 led_backlight_keyframe_top_to_bottom_gradient
,
171 led_backlight_keyframe_normal_orientation
,
172 led_backlight_keyframe_crossfade
,