diff options
| -rw-r--r-- | keyboards/ergodox/infinity/rules.mk | 3 | ||||
| -rw-r--r-- | keyboards/ergodox/infinity/simple_visualizer.h | 2 | ||||
| -rw-r--r-- | keyboards/ergodox/infinity/visualizer.c | 2 | ||||
| -rw-r--r-- | keyboards/whitefox/animations.c | 128 | ||||
| -rw-r--r-- | keyboards/whitefox/animations.h | 30 | ||||
| -rw-r--r-- | keyboards/whitefox/rules.mk | 3 | ||||
| -rw-r--r-- | keyboards/whitefox/visualizer.c | 2 | ||||
| -rw-r--r-- | quantum/visualizer/default_animations.c (renamed from keyboards/ergodox/infinity/animations.c) | 28 | ||||
| -rw-r--r-- | quantum/visualizer/default_animations.h (renamed from keyboards/ergodox/infinity/animations.h) | 6 | ||||
| -rw-r--r-- | quantum/visualizer/visualizer.mk | 2 |
10 files changed, 35 insertions, 171 deletions
diff --git a/keyboards/ergodox/infinity/rules.mk b/keyboards/ergodox/infinity/rules.mk index 18171560d..2ccf98b8c 100644 --- a/keyboards/ergodox/infinity/rules.mk +++ b/keyboards/ergodox/infinity/rules.mk | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | # project specific files | 1 | # project specific files |
| 2 | SRC = matrix.c \ | 2 | SRC = matrix.c \ |
| 3 | led.c \ | 3 | led.c |
| 4 | animations.c | ||
| 5 | 4 | ||
| 6 | ## chip/board settings | 5 | ## chip/board settings |
| 7 | # - the next two should match the directories in | 6 | # - the next two should match the directories in |
diff --git a/keyboards/ergodox/infinity/simple_visualizer.h b/keyboards/ergodox/infinity/simple_visualizer.h index 88e96f2af..73d0e0887 100644 --- a/keyboards/ergodox/infinity/simple_visualizer.h +++ b/keyboards/ergodox/infinity/simple_visualizer.h | |||
| @@ -34,7 +34,7 @@ | |||
| 34 | #include "lcd_backlight_keyframes.h" | 34 | #include "lcd_backlight_keyframes.h" |
| 35 | #include "system/serial_link.h" | 35 | #include "system/serial_link.h" |
| 36 | #include "led.h" | 36 | #include "led.h" |
| 37 | #include "animations.h" | 37 | #include "default_animations.h" |
| 38 | 38 | ||
| 39 | static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); | 39 | static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); |
| 40 | static const uint32_t initial_color = LCD_COLOR(0, 0, 0); | 40 | static const uint32_t initial_color = LCD_COLOR(0, 0, 0); |
diff --git a/keyboards/ergodox/infinity/visualizer.c b/keyboards/ergodox/infinity/visualizer.c index 047a1119c..4b16021ab 100644 --- a/keyboards/ergodox/infinity/visualizer.c +++ b/keyboards/ergodox/infinity/visualizer.c | |||
| @@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 31 | #include "lcd_keyframes.h" | 31 | #include "lcd_keyframes.h" |
| 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 "animations.h" | 34 | #include "default_animations.h" |
| 35 | 35 | ||
| 36 | static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); | 36 | static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); |
| 37 | static const uint32_t initial_color = LCD_COLOR(0, 0, 0); | 37 | static const uint32_t initial_color = LCD_COLOR(0, 0, 0); |
diff --git a/keyboards/whitefox/animations.c b/keyboards/whitefox/animations.c deleted file mode 100644 index a15d46ccd..000000000 --- a/keyboards/whitefox/animations.c +++ /dev/null | |||
| @@ -1,128 +0,0 @@ | |||
| 1 | /* Copyright 2017 Fred Sundvik | ||
| 2 | * | ||
| 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. | ||
| 7 | * | ||
| 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. | ||
| 12 | * | ||
| 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/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #if defined(VISUALIZER_ENABLE) | ||
| 18 | |||
| 19 | #include "animations.h" | ||
| 20 | #include "visualizer.h" | ||
| 21 | |||
| 22 | #ifdef BACKLIGHT_ENABLE | ||
| 23 | #include "led_backlight_keyframes.h" | ||
| 24 | #endif | ||
| 25 | |||
| 26 | #include "visualizer_keyframes.h" | ||
| 27 | |||
| 28 | |||
| 29 | #if defined(LCD_ENABLE) || defined(LCD_BACKLIGHT_ENABLE) || defined(BACKLIGHT_ENABLE) | ||
| 30 | |||
| 31 | static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 32 | #ifdef BACKLIGHT_ENABLE | ||
| 33 | led_backlight_keyframe_enable(animation, state); | ||
| 34 | #endif | ||
| 35 | return false; | ||
| 36 | } | ||
| 37 | |||
| 38 | static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 39 | #ifdef BACKLIGHT_ENABLE | ||
| 40 | led_backlight_keyframe_disable(animation, state); | ||
| 41 | #endif | ||
| 42 | return false; | ||
| 43 | } | ||
| 44 | |||
| 45 | static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 46 | bool ret = false; | ||
| 47 | #ifdef BACKLIGHT_ENABLE | ||
| 48 | ret |= led_backlight_keyframe_fade_in_all(animation, state); | ||
| 49 | #endif | ||
| 50 | return ret; | ||
| 51 | } | ||
| 52 | |||
| 53 | static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 54 | bool ret = false; | ||
| 55 | #ifdef BACKLIGHT_ENABLE | ||
| 56 | ret |= led_backlight_keyframe_fade_out_all(animation, state); | ||
| 57 | #endif | ||
| 58 | return ret; | ||
| 59 | } | ||
| 60 | |||
| 61 | |||
| 62 | // Don't worry, if the startup animation is long, you can use the keyboard like normal | ||
| 63 | // during that time | ||
| 64 | keyframe_animation_t default_startup_animation = { | ||
| 65 | .num_frames = 2, | ||
| 66 | .loop = false, | ||
| 67 | .frame_lengths = {0, gfxMillisecondsToTicks(5000)}, | ||
| 68 | .frame_functions = { | ||
| 69 | keyframe_enable, | ||
| 70 | keyframe_fade_in, | ||
| 71 | }, | ||
| 72 | }; | ||
| 73 | |||
| 74 | keyframe_animation_t default_suspend_animation = { | ||
| 75 | .num_frames = 2, | ||
| 76 | .loop = false, | ||
| 77 | .frame_lengths = {gfxMillisecondsToTicks(1000), 0}, | ||
| 78 | .frame_functions = { | ||
| 79 | keyframe_fade_out, | ||
| 80 | keyframe_disable, | ||
| 81 | }, | ||
| 82 | }; | ||
| 83 | #endif | ||
| 84 | |||
| 85 | #if defined(BACKLIGHT_ENABLE) | ||
| 86 | #define CROSSFADE_TIME 1000 | ||
| 87 | #define GRADIENT_TIME 3000 | ||
| 88 | |||
| 89 | keyframe_animation_t led_test_animation = { | ||
| 90 | .num_frames = 14, | ||
| 91 | .loop = true, | ||
| 92 | .frame_lengths = { | ||
| 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 | ||
| 100 | 0, // mirror leds | ||
| 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 | ||
| 105 | 0, // normal leds | ||
| 106 | gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade | ||
| 107 | |||
| 108 | }, | ||
| 109 | .frame_functions = { | ||
| 110 | led_backlight_keyframe_fade_in_all, | ||
| 111 | keyframe_no_operation, | ||
| 112 | led_backlight_keyframe_fade_out_all, | ||
| 113 | led_backlight_keyframe_crossfade, | ||
| 114 | led_backlight_keyframe_left_to_right_gradient, | ||
| 115 | led_backlight_keyframe_crossfade, | ||
| 116 | led_backlight_keyframe_top_to_bottom_gradient, | ||
| 117 | led_backlight_keyframe_mirror_orientation, | ||
| 118 | led_backlight_keyframe_crossfade, | ||
| 119 | led_backlight_keyframe_left_to_right_gradient, | ||
| 120 | led_backlight_keyframe_crossfade, | ||
| 121 | led_backlight_keyframe_top_to_bottom_gradient, | ||
| 122 | led_backlight_keyframe_normal_orientation, | ||
| 123 | led_backlight_keyframe_crossfade, | ||
| 124 | }, | ||
| 125 | }; | ||
| 126 | #endif | ||
| 127 | |||
| 128 | #endif | ||
diff --git a/keyboards/whitefox/animations.h b/keyboards/whitefox/animations.h deleted file mode 100644 index 6d8b9830d..000000000 --- a/keyboards/whitefox/animations.h +++ /dev/null | |||
| @@ -1,30 +0,0 @@ | |||
| 1 | /* Copyright 2017 Fred Sundvik | ||
| 2 | * | ||
| 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. | ||
| 7 | * | ||
| 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. | ||
| 12 | * | ||
| 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/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ | ||
| 18 | #define KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ | ||
| 19 | |||
| 20 | #include "visualizer.h" | ||
| 21 | |||
| 22 | // You can use these default animations, but of course you can also write your own custom ones instead | ||
| 23 | extern keyframe_animation_t default_startup_animation; | ||
| 24 | extern keyframe_animation_t default_suspend_animation; | ||
| 25 | |||
| 26 | // An animation for testing and demonstrating the led support, should probably not be used for real world | ||
| 27 | // cases | ||
| 28 | extern keyframe_animation_t led_test_animation; | ||
| 29 | |||
| 30 | #endif /* KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ */ | ||
diff --git a/keyboards/whitefox/rules.mk b/keyboards/whitefox/rules.mk index c0effcb7b..391148071 100644 --- a/keyboards/whitefox/rules.mk +++ b/keyboards/whitefox/rules.mk | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | # project specific files | 1 | # project specific files |
| 2 | SRC = matrix.c \ | 2 | SRC = matrix.c \ |
| 3 | led.c \ | 3 | led.c |
| 4 | animations.c | ||
| 5 | 4 | ||
| 6 | ## chip/board settings | 5 | ## chip/board settings |
| 7 | # - the next two should match the directories in | 6 | # - the next two should match the directories in |
diff --git a/keyboards/whitefox/visualizer.c b/keyboards/whitefox/visualizer.c index 167e0ec4d..e5bafcbe9 100644 --- a/keyboards/whitefox/visualizer.c +++ b/keyboards/whitefox/visualizer.c | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | #include "visualizer.h" | 20 | #include "visualizer.h" |
| 21 | #include "visualizer_keyframes.h" | 21 | #include "visualizer_keyframes.h" |
| 22 | #include "led.h" | 22 | #include "led.h" |
| 23 | #include "animations.h" | 23 | #include "default_animations.h" |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | static bool initial_update = true; | 26 | static bool initial_update = true; |
diff --git a/keyboards/ergodox/infinity/animations.c b/quantum/visualizer/default_animations.c index faac96215..2d0327372 100644 --- a/keyboards/ergodox/infinity/animations.c +++ b/quantum/visualizer/default_animations.c | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | #if defined(VISUALIZER_ENABLE) | 17 | #if defined(VISUALIZER_ENABLE) |
| 18 | 18 | ||
| 19 | #include "animations.h" | 19 | #include "default_animations.h" |
| 20 | #include "visualizer.h" | 20 | #include "visualizer.h" |
| 21 | #ifdef LCD_ENABLE | 21 | #ifdef LCD_ENABLE |
| 22 | #include "lcd_keyframes.h" | 22 | #include "lcd_keyframes.h" |
| @@ -86,22 +86,44 @@ static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_ | |||
| 86 | // 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 |
| 87 | // during that time | 87 | // during that time |
| 88 | keyframe_animation_t default_startup_animation = { | 88 | keyframe_animation_t default_startup_animation = { |
| 89 | #if LCD_ENABLE | ||
| 89 | .num_frames = 3, | 90 | .num_frames = 3, |
| 91 | #else | ||
| 92 | .num_frames = 2, | ||
| 93 | #endif | ||
| 90 | .loop = false, | 94 | .loop = false, |
| 91 | .frame_lengths = {0, 0, gfxMillisecondsToTicks(5000)}, | 95 | .frame_lengths = { |
| 96 | 0, | ||
| 97 | #if LCD_ENABLE | ||
| 98 | 0, | ||
| 99 | #endif | ||
| 100 | gfxMillisecondsToTicks(5000)}, | ||
| 92 | .frame_functions = { | 101 | .frame_functions = { |
| 93 | keyframe_enable, | 102 | keyframe_enable, |
| 103 | #if LCD_ENABLE | ||
| 94 | lcd_keyframe_draw_logo, | 104 | lcd_keyframe_draw_logo, |
| 105 | #endif | ||
| 95 | keyframe_fade_in, | 106 | keyframe_fade_in, |
| 96 | }, | 107 | }, |
| 97 | }; | 108 | }; |
| 98 | 109 | ||
| 99 | keyframe_animation_t default_suspend_animation = { | 110 | keyframe_animation_t default_suspend_animation = { |
| 111 | #if LCD_ENABLE | ||
| 100 | .num_frames = 3, | 112 | .num_frames = 3, |
| 113 | #else | ||
| 114 | .num_frames = 2, | ||
| 115 | #endif | ||
| 101 | .loop = false, | 116 | .loop = false, |
| 102 | .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0}, | 117 | .frame_lengths = { |
| 118 | #if LCD_ENABLE | ||
| 119 | 0, | ||
| 120 | #endif | ||
| 121 | gfxMillisecondsToTicks(1000), | ||
| 122 | 0}, | ||
| 103 | .frame_functions = { | 123 | .frame_functions = { |
| 124 | #if LCD_ENABLE | ||
| 104 | lcd_keyframe_display_layer_text, | 125 | lcd_keyframe_display_layer_text, |
| 126 | #endif | ||
| 105 | keyframe_fade_out, | 127 | keyframe_fade_out, |
| 106 | keyframe_disable, | 128 | keyframe_disable, |
| 107 | }, | 129 | }, |
diff --git a/keyboards/ergodox/infinity/animations.h b/quantum/visualizer/default_animations.h index 6d8b9830d..51320b8b8 100644 --- a/keyboards/ergodox/infinity/animations.h +++ b/quantum/visualizer/default_animations.h | |||
| @@ -14,8 +14,8 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #ifndef KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ | 17 | #ifndef DEFAULT_ANIMATIONS_H_ |
| 18 | #define KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ | 18 | #define DEFAULT_ANIMATIONS_H_ |
| 19 | 19 | ||
| 20 | #include "visualizer.h" | 20 | #include "visualizer.h" |
| 21 | 21 | ||
| @@ -27,4 +27,4 @@ extern keyframe_animation_t default_suspend_animation; | |||
| 27 | // cases | 27 | // cases |
| 28 | extern keyframe_animation_t led_test_animation; | 28 | extern keyframe_animation_t led_test_animation; |
| 29 | 29 | ||
| 30 | #endif /* KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ */ | 30 | #endif /* DEFAULT_ANIMATIONS_H_ */ |
diff --git a/quantum/visualizer/visualizer.mk b/quantum/visualizer/visualizer.mk index a04c9775f..3a0f771bc 100644 --- a/quantum/visualizer/visualizer.mk +++ b/quantum/visualizer/visualizer.mk | |||
| @@ -46,6 +46,8 @@ ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) | |||
| 46 | SRC += $(VISUALIZER_DIR)/led_backlight_keyframes.c | 46 | SRC += $(VISUALIZER_DIR)/led_backlight_keyframes.c |
| 47 | endif | 47 | endif |
| 48 | 48 | ||
| 49 | SRC += $(VISUALIZER_DIR)/default_animations.c | ||
| 50 | |||
| 49 | include $(GFXLIB)/gfx.mk | 51 | include $(GFXLIB)/gfx.mk |
| 50 | # For the common_gfxconf.h | 52 | # For the common_gfxconf.h |
| 51 | GFXINC += quantum/visualizer | 53 | GFXINC += quantum/visualizer |
