diff options
| author | Fred Sundvik <fsundvik@gmail.com> | 2017-07-09 17:50:01 +0300 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2017-07-10 09:01:59 -0400 |
| commit | 4da3b19603255115f71812964383ee7b518637be (patch) | |
| tree | ede4b62835bd2119880b9739b3e6b3d52915fbd4 /keyboards/whitefox | |
| parent | 2251560256ff1a139178dc80b18dd8ef1d8e83d6 (diff) | |
| download | qmk_firmware-4da3b19603255115f71812964383ee7b518637be.tar.gz qmk_firmware-4da3b19603255115f71812964383ee7b518637be.zip | |
Shared default animations
Diffstat (limited to 'keyboards/whitefox')
| -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 |
4 files changed, 2 insertions, 161 deletions
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; |
