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"
35 #if defined(LCD_ENABLE) || defined(LCD_BACKLIGHT_ENABLE) || defined(BACKLIGHT_ENABLE)
37 static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
39 lcd_keyframe_enable(animation, state);
41 #ifdef LCD_BACKLIGHT_ENABLE
42 lcd_backlight_keyframe_enable(animation, state);
44 #ifdef BACKLIGHT_ENABLE
45 led_backlight_keyframe_enable(animation, state);
50 static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
52 lcd_keyframe_disable(animation, state);
54 #ifdef LCD_BACKLIGHT_ENABLE
55 lcd_backlight_keyframe_disable(animation, state);
57 #ifdef BACKLIGHT_ENABLE
58 led_backlight_keyframe_disable(animation, state);
63 static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) {
65 #ifdef LCD_BACKLIGHT_ENABLE
66 ret |= lcd_backlight_keyframe_animate_color(animation, state);
68 #ifdef BACKLIGHT_ENABLE
69 ret |= led_backlight_keyframe_fade_in_all(animation, state);
74 static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) {
76 #ifdef LCD_BACKLIGHT_ENABLE
77 ret |= lcd_backlight_keyframe_animate_color(animation, state);
79 #ifdef BACKLIGHT_ENABLE
80 ret |= led_backlight_keyframe_fade_out_all(animation, state);
86 // Don't worry, if the startup animation is long, you can use the keyboard like normal
88 keyframe_animation_t default_startup_animation = {
100 gfxMillisecondsToTicks(5000)},
104 lcd_keyframe_draw_logo,
110 keyframe_animation_t default_suspend_animation = {
121 gfxMillisecondsToTicks(1000),
125 lcd_keyframe_display_layer_text,
133 #if defined(BACKLIGHT_ENABLE)
134 #define CROSSFADE_TIME 1000
135 #define GRADIENT_TIME 3000
137 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
158 led_backlight_keyframe_fade_in_all,
159 keyframe_no_operation,
160 led_backlight_keyframe_fade_out_all,
161 led_backlight_keyframe_crossfade,
162 led_backlight_keyframe_left_to_right_gradient,
163 led_backlight_keyframe_crossfade,
164 led_backlight_keyframe_top_to_bottom_gradient,
165 led_backlight_keyframe_mirror_orientation,
166 led_backlight_keyframe_crossfade,
167 led_backlight_keyframe_left_to_right_gradient,
168 led_backlight_keyframe_crossfade,
169 led_backlight_keyframe_top_to_bottom_gradient,
170 led_backlight_keyframe_normal_orientation,
171 led_backlight_keyframe_crossfade,