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 "animations.h"
20 #include "visualizer.h"
22 #ifdef BACKLIGHT_ENABLE
23 #include "led_keyframes.h"
26 #include "visualizer_keyframes.h"
29 #if defined(LCD_ENABLE) || defined(LCD_BACKLIGHT_ENABLE) || defined(BACKLIGHT_ENABLE)
31 static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
32 #ifdef BACKLIGHT_ENABLE
33 led_keyframe_enable(animation, state);
38 static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
39 #ifdef BACKLIGHT_ENABLE
40 led_keyframe_disable(animation, state);
45 static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) {
47 #ifdef BACKLIGHT_ENABLE
48 ret |= led_keyframe_fade_in_all(animation, state);
53 static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) {
55 #ifdef BACKLIGHT_ENABLE
56 ret |= led_keyframe_fade_out_all(animation, state);
62 // Don't worry, if the startup animation is long, you can use the keyboard like normal
64 keyframe_animation_t default_startup_animation = {
67 .frame_lengths = {0, gfxMillisecondsToTicks(5000)},
74 keyframe_animation_t default_suspend_animation = {
77 .frame_lengths = {gfxMillisecondsToTicks(1000), 0},
85 #if defined(BACKLIGHT_ENABLE)
86 #define CROSSFADE_TIME 1000
87 #define GRADIENT_TIME 3000
89 keyframe_animation_t led_test_animation = {
93 gfxMillisecondsToTicks(1000), // fade in
94 gfxMillisecondsToTicks(1000), // no op (leds on)
95 gfxMillisecondsToTicks(1000), // fade out
96 gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
97 gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in)
98 gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
99 gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom
101 gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
102 gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out)
103 gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
104 gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom
106 gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
110 led_keyframe_fade_in_all,
111 keyframe_no_operation,
112 led_keyframe_fade_out_all,
113 led_keyframe_crossfade,
114 led_keyframe_left_to_right_gradient,
115 led_keyframe_crossfade,
116 led_keyframe_top_to_bottom_gradient,
117 led_keyframe_mirror_orientation,
118 led_keyframe_crossfade,
119 led_keyframe_left_to_right_gradient,
120 led_keyframe_crossfade,
121 led_keyframe_top_to_bottom_gradient,
122 led_keyframe_normal_orientation,
123 led_keyframe_crossfade,