diff options
Diffstat (limited to 'keyboards/ergodox/keymaps/default/visualizer.c')
| -rw-r--r-- | keyboards/ergodox/keymaps/default/visualizer.c | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/keyboards/ergodox/keymaps/default/visualizer.c b/keyboards/ergodox/keymaps/default/visualizer.c index 6a7178968..779de0050 100644 --- a/keyboards/ergodox/keymaps/default/visualizer.c +++ b/keyboards/ergodox/keymaps/default/visualizer.c | |||
| @@ -32,8 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 32 | #include "lcd_backlight_keyframes.h" | 32 | #include "lcd_backlight_keyframes.h" |
| 33 | #include "system/serial_link.h" | 33 | #include "system/serial_link.h" |
| 34 | #include "led.h" | 34 | #include "led.h" |
| 35 | 35 | #include "animations.h" | |
| 36 | #include "resources/resources.h" | ||
| 37 | 36 | ||
| 38 | static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); | 37 | static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); |
| 39 | static const uint32_t initial_color = LCD_COLOR(0, 0, 0); | 38 | static const uint32_t initial_color = LCD_COLOR(0, 0, 0); |
| @@ -48,18 +47,6 @@ static lcd_state_t lcd_state = LCD_STATE_INITIAL; | |||
| 48 | 47 | ||
| 49 | // Feel free to modify the animations below, or even add new ones if needed | 48 | // Feel free to modify the animations below, or even add new ones if needed |
| 50 | 49 | ||
| 51 | // Don't worry, if the startup animation is long, you can use the keyboard like normal | ||
| 52 | // during that time | ||
| 53 | static keyframe_animation_t startup_animation = { | ||
| 54 | .num_frames = 2, | ||
| 55 | .loop = false, | ||
| 56 | .frame_lengths = {0, gfxMillisecondsToTicks(10000), 0}, | ||
| 57 | .frame_functions = { | ||
| 58 | lcd_keyframe_draw_logo, | ||
| 59 | backlight_keyframe_animate_color, | ||
| 60 | }, | ||
| 61 | }; | ||
| 62 | |||
| 63 | static keyframe_animation_t lcd_layer_display = { | 50 | static keyframe_animation_t lcd_layer_display = { |
| 64 | .num_frames = 1, | 51 | .num_frames = 1, |
| 65 | .loop = false, | 52 | .loop = false, |
| @@ -67,30 +54,6 @@ static keyframe_animation_t lcd_layer_display = { | |||
| 67 | .frame_functions = {lcd_keyframe_display_layer_and_led_states} | 54 | .frame_functions = {lcd_keyframe_display_layer_and_led_states} |
| 68 | }; | 55 | }; |
| 69 | 56 | ||
| 70 | static keyframe_animation_t suspend_animation = { | ||
| 71 | .num_frames = 4, | ||
| 72 | .loop = false, | ||
| 73 | .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0, 0}, | ||
| 74 | .frame_functions = { | ||
| 75 | lcd_keyframe_display_layer_text, | ||
| 76 | backlight_keyframe_animate_color, | ||
| 77 | lcd_keyframe_disable, | ||
| 78 | backlight_keyframe_disable, | ||
| 79 | }, | ||
| 80 | }; | ||
| 81 | |||
| 82 | static keyframe_animation_t resume_animation = { | ||
| 83 | .num_frames = 4, | ||
| 84 | .loop = false, | ||
| 85 | .frame_lengths = {0, 0, 0, gfxMillisecondsToTicks(10000), 0}, | ||
| 86 | .frame_functions = { | ||
| 87 | lcd_keyframe_enable, | ||
| 88 | backlight_keyframe_enable, | ||
| 89 | lcd_keyframe_draw_logo, | ||
| 90 | backlight_keyframe_animate_color, | ||
| 91 | }, | ||
| 92 | }; | ||
| 93 | |||
| 94 | // The color animation animates the LCD color when you change layers | 57 | // The color animation animates the LCD color when you change layers |
| 95 | static keyframe_animation_t color_animation = { | 58 | static keyframe_animation_t color_animation = { |
| 96 | .num_frames = 2, | 59 | .num_frames = 2, |
| @@ -109,7 +72,7 @@ void initialize_user_visualizer(visualizer_state_t* state) { | |||
| 109 | state->current_lcd_color = initial_color; | 72 | state->current_lcd_color = initial_color; |
| 110 | state->target_lcd_color = logo_background_color; | 73 | state->target_lcd_color = logo_background_color; |
| 111 | lcd_state = LCD_STATE_INITIAL; | 74 | lcd_state = LCD_STATE_INITIAL; |
| 112 | start_keyframe_animation(&startup_animation); | 75 | start_keyframe_animation(&default_startup_animation); |
| 113 | } | 76 | } |
| 114 | 77 | ||
| 115 | void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) { | 78 | void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) { |
| @@ -156,12 +119,12 @@ void user_visualizer_suspend(visualizer_state_t* state) { | |||
| 156 | uint8_t hue = LCD_HUE(state->current_lcd_color); | 119 | uint8_t hue = LCD_HUE(state->current_lcd_color); |
| 157 | uint8_t sat = LCD_SAT(state->current_lcd_color); | 120 | uint8_t sat = LCD_SAT(state->current_lcd_color); |
| 158 | state->target_lcd_color = LCD_COLOR(hue, sat, 0); | 121 | state->target_lcd_color = LCD_COLOR(hue, sat, 0); |
| 159 | start_keyframe_animation(&suspend_animation); | 122 | start_keyframe_animation(&default_suspend_animation); |
| 160 | } | 123 | } |
| 161 | 124 | ||
| 162 | void user_visualizer_resume(visualizer_state_t* state) { | 125 | void user_visualizer_resume(visualizer_state_t* state) { |
| 163 | state->current_lcd_color = initial_color; | 126 | state->current_lcd_color = initial_color; |
| 164 | state->target_lcd_color = logo_background_color; | 127 | state->target_lcd_color = logo_background_color; |
| 165 | lcd_state = LCD_STATE_INITIAL; | 128 | lcd_state = LCD_STATE_INITIAL; |
| 166 | start_keyframe_animation(&resume_animation); | 129 | start_keyframe_animation(&default_startup_animation); |
| 167 | } | 130 | } |
