diff options
author | Fred Sundvik <fsundvik@gmail.com> | 2017-04-08 23:04:27 +0300 |
---|---|---|
committer | Fred Sundvik <fsundvik@gmail.com> | 2017-04-09 18:34:59 +0300 |
commit | c5d2b7ff16f81a8061127e0ec636cf9b914725c5 (patch) | |
tree | 8a4095bd3ae22fd79384d88416648129bb6176df /quantum/visualizer | |
parent | 306353bf06e5e5a76890ffb0c48a4dcca76c4399 (diff) | |
download | qmk_firmware-c5d2b7ff16f81a8061127e0ec636cf9b914725c5.tar.gz qmk_firmware-c5d2b7ff16f81a8061127e0ec636cf9b914725c5.zip |
Rename led test to led_keyframes and move animation to Ergodox
Diffstat (limited to 'quantum/visualizer')
-rw-r--r-- | quantum/visualizer/led_keyframes.c (renamed from quantum/visualizer/led_test.c) | 57 | ||||
-rw-r--r-- | quantum/visualizer/led_keyframes.h (renamed from quantum/visualizer/led_test.h) | 20 | ||||
-rw-r--r-- | quantum/visualizer/visualizer.mk | 2 |
3 files changed, 19 insertions, 60 deletions
diff --git a/quantum/visualizer/led_test.c b/quantum/visualizer/led_keyframes.c index a9abace8d..2dacd990d 100644 --- a/quantum/visualizer/led_test.c +++ b/quantum/visualizer/led_keyframes.c | |||
@@ -21,50 +21,9 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
22 | SOFTWARE. | 22 | SOFTWARE. |
23 | */ | 23 | */ |
24 | #include "led_test.h" | ||
25 | #include "gfx.h" | 24 | #include "gfx.h" |
26 | #include "math.h" | 25 | #include "math.h" |
27 | 26 | #include "led_keyframes.h" | |
28 | #define CROSSFADE_TIME 1000 | ||
29 | #define GRADIENT_TIME 3000 | ||
30 | |||
31 | keyframe_animation_t led_test_animation = { | ||
32 | .num_frames = 14, | ||
33 | .loop = true, | ||
34 | .frame_lengths = { | ||
35 | gfxMillisecondsToTicks(1000), // fade in | ||
36 | gfxMillisecondsToTicks(1000), // no op (leds on) | ||
37 | gfxMillisecondsToTicks(1000), // fade out | ||
38 | gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade | ||
39 | gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in) | ||
40 | gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade | ||
41 | gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom | ||
42 | 0, // mirror leds | ||
43 | gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade | ||
44 | gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out) | ||
45 | gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade | ||
46 | gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom | ||
47 | 0, // normal leds | ||
48 | gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade | ||
49 | |||
50 | }, | ||
51 | .frame_functions = { | ||
52 | keyframe_fade_in_all_leds, | ||
53 | keyframe_no_operation, | ||
54 | keyframe_fade_out_all_leds, | ||
55 | keyframe_led_crossfade, | ||
56 | keyframe_led_left_to_right_gradient, | ||
57 | keyframe_led_crossfade, | ||
58 | keyframe_led_top_to_bottom_gradient, | ||
59 | keyframe_mirror_led_orientation, | ||
60 | keyframe_led_crossfade, | ||
61 | keyframe_led_left_to_right_gradient, | ||
62 | keyframe_led_crossfade, | ||
63 | keyframe_led_top_to_bottom_gradient, | ||
64 | keyframe_normal_led_orientation, | ||
65 | keyframe_led_crossfade, | ||
66 | }, | ||
67 | }; | ||
68 | 27 | ||
69 | static uint8_t fade_led_color(keyframe_animation_t* animation, int from, int to) { | 28 | static uint8_t fade_led_color(keyframe_animation_t* animation, int from, int to) { |
70 | int frame_length = animation->frame_lengths[animation->current_frame]; | 29 | int frame_length = animation->frame_lengths[animation->current_frame]; |
@@ -96,19 +55,19 @@ static uint8_t compute_gradient_color(float t, float index, float num) { | |||
96 | return (uint8_t)(255.0f * v); | 55 | return (uint8_t)(255.0f * v); |
97 | } | 56 | } |
98 | 57 | ||
99 | bool keyframe_fade_in_all_leds(keyframe_animation_t* animation, visualizer_state_t* state) { | 58 | bool led_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state) { |
100 | (void)state; | 59 | (void)state; |
101 | keyframe_fade_all_leds_from_to(animation, 0, 255); | 60 | keyframe_fade_all_leds_from_to(animation, 0, 255); |
102 | return true; | 61 | return true; |
103 | } | 62 | } |
104 | 63 | ||
105 | bool keyframe_fade_out_all_leds(keyframe_animation_t* animation, visualizer_state_t* state) { | 64 | bool led_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state) { |
106 | (void)state; | 65 | (void)state; |
107 | keyframe_fade_all_leds_from_to(animation, 255, 0); | 66 | keyframe_fade_all_leds_from_to(animation, 255, 0); |
108 | return true; | 67 | return true; |
109 | } | 68 | } |
110 | 69 | ||
111 | bool keyframe_led_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state) { | 70 | bool led_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state) { |
112 | (void)state; | 71 | (void)state; |
113 | float frame_length = animation->frame_lengths[animation->current_frame]; | 72 | float frame_length = animation->frame_lengths[animation->current_frame]; |
114 | float current_pos = frame_length - animation->time_left_in_frame; | 73 | float current_pos = frame_length - animation->time_left_in_frame; |
@@ -120,7 +79,7 @@ bool keyframe_led_left_to_right_gradient(keyframe_animation_t* animation, visual | |||
120 | return true; | 79 | return true; |
121 | } | 80 | } |
122 | 81 | ||
123 | bool keyframe_led_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state) { | 82 | bool led_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state) { |
124 | (void)state; | 83 | (void)state; |
125 | float frame_length = animation->frame_lengths[animation->current_frame]; | 84 | float frame_length = animation->frame_lengths[animation->current_frame]; |
126 | float current_pos = frame_length - animation->time_left_in_frame; | 85 | float current_pos = frame_length - animation->time_left_in_frame; |
@@ -139,7 +98,7 @@ static void copy_current_led_state(uint8_t* dest) { | |||
139 | } | 98 | } |
140 | } | 99 | } |
141 | } | 100 | } |
142 | bool keyframe_led_crossfade(keyframe_animation_t* animation, visualizer_state_t* state) { | 101 | bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state) { |
143 | (void)state; | 102 | (void)state; |
144 | if (animation->first_update_of_frame) { | 103 | if (animation->first_update_of_frame) { |
145 | copy_current_led_state(&crossfade_start_frame[0][0]); | 104 | copy_current_led_state(&crossfade_start_frame[0][0]); |
@@ -155,14 +114,14 @@ bool keyframe_led_crossfade(keyframe_animation_t* animation, visualizer_state_t* | |||
155 | return true; | 114 | return true; |
156 | } | 115 | } |
157 | 116 | ||
158 | bool keyframe_mirror_led_orientation(keyframe_animation_t* animation, visualizer_state_t* state) { | 117 | bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state) { |
159 | (void)state; | 118 | (void)state; |
160 | (void)animation; | 119 | (void)animation; |
161 | gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_180); | 120 | gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_180); |
162 | return false; | 121 | return false; |
163 | } | 122 | } |
164 | 123 | ||
165 | bool keyframe_normal_led_orientation(keyframe_animation_t* animation, visualizer_state_t* state) { | 124 | bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state) { |
166 | (void)state; | 125 | (void)state; |
167 | (void)animation; | 126 | (void)animation; |
168 | gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0); | 127 | gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0); |
diff --git a/quantum/visualizer/led_test.h b/quantum/visualizer/led_keyframes.h index 5e2325753..a68943041 100644 --- a/quantum/visualizer/led_test.h +++ b/quantum/visualizer/led_keyframes.h | |||
@@ -22,20 +22,20 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||
22 | SOFTWARE. | 22 | SOFTWARE. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #ifndef TMK_VISUALIZER_LED_TEST_H_ | 25 | #ifndef LED_KEYFRAMES_H |
26 | #define TMK_VISUALIZER_LED_TEST_H_ | 26 | #define LED_KEYFRAMES_H |
27 | 27 | ||
28 | #include "visualizer.h" | 28 | #include "visualizer.h" |
29 | 29 | ||
30 | bool keyframe_fade_in_all_leds(keyframe_animation_t* animation, visualizer_state_t* state); | 30 | bool led_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state); |
31 | bool keyframe_fade_out_all_leds(keyframe_animation_t* animation, visualizer_state_t* state); | 31 | bool led_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state); |
32 | bool keyframe_led_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state); | 32 | bool led_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state); |
33 | bool keyframe_led_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state); | 33 | bool led_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state); |
34 | bool keyframe_led_crossfade(keyframe_animation_t* animation, visualizer_state_t* state); | 34 | bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state); |
35 | bool keyframe_mirror_led_orientation(keyframe_animation_t* animation, visualizer_state_t* state); | 35 | bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state); |
36 | bool keyframe_normal_led_orientation(keyframe_animation_t* animation, visualizer_state_t* state); | 36 | bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state); |
37 | 37 | ||
38 | extern keyframe_animation_t led_test_animation; | 38 | extern keyframe_animation_t led_test_animation; |
39 | 39 | ||
40 | 40 | ||
41 | #endif /* TMK_VISUALIZER_LED_TEST_H_ */ | 41 | #endif /* LED_KEYFRAMES_H */ |
diff --git a/quantum/visualizer/visualizer.mk b/quantum/visualizer/visualizer.mk index 7c8e98d67..5f710124b 100644 --- a/quantum/visualizer/visualizer.mk +++ b/quantum/visualizer/visualizer.mk | |||
@@ -43,7 +43,7 @@ OPT_DEFS += -DLCD_BACKLIGHT_ENABLE | |||
43 | endif | 43 | endif |
44 | 44 | ||
45 | ifeq ($(strip $(LED_ENABLE)), yes) | 45 | ifeq ($(strip $(LED_ENABLE)), yes) |
46 | SRC += $(VISUALIZER_DIR)/led_test.c | 46 | SRC += $(VISUALIZER_DIR)/led_keyframes.c |
47 | OPT_DEFS += -DLED_ENABLE | 47 | OPT_DEFS += -DLED_ENABLE |
48 | endif | 48 | endif |
49 | 49 | ||