diff options
author | skullY <skullydazed@gmail.com> | 2019-08-30 11:19:03 -0700 |
---|---|---|
committer | skullydazed <skullydazed@users.noreply.github.com> | 2019-08-30 15:01:52 -0700 |
commit | b624f32f944acdc59dcb130674c09090c5c404cb (patch) | |
tree | bc13adbba137d122d9a2c2fb2fafcbb08ac10e25 /quantum/visualizer/lcd_backlight_keyframes.c | |
parent | 61af76a10d00aba185b8338604171de490a13e3b (diff) | |
download | qmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.tar.gz qmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.zip |
clang-format changes
Diffstat (limited to 'quantum/visualizer/lcd_backlight_keyframes.c')
-rw-r--r-- | quantum/visualizer/lcd_backlight_keyframes.c | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/quantum/visualizer/lcd_backlight_keyframes.c b/quantum/visualizer/lcd_backlight_keyframes.c index 8c402baf6..c13cce311 100644 --- a/quantum/visualizer/lcd_backlight_keyframes.c +++ b/quantum/visualizer/lcd_backlight_keyframes.c | |||
@@ -17,46 +17,40 @@ | |||
17 | #include "lcd_backlight_keyframes.h" | 17 | #include "lcd_backlight_keyframes.h" |
18 | 18 | ||
19 | bool lcd_backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state) { | 19 | bool lcd_backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state) { |
20 | int frame_length = animation->frame_lengths[animation->current_frame]; | 20 | int frame_length = animation->frame_lengths[animation->current_frame]; |
21 | int current_pos = frame_length - animation->time_left_in_frame; | 21 | int current_pos = frame_length - animation->time_left_in_frame; |
22 | uint8_t t_h = LCD_HUE(state->target_lcd_color); | 22 | uint8_t t_h = LCD_HUE(state->target_lcd_color); |
23 | uint8_t t_s = LCD_SAT(state->target_lcd_color); | 23 | uint8_t t_s = LCD_SAT(state->target_lcd_color); |
24 | uint8_t t_i = LCD_INT(state->target_lcd_color); | 24 | uint8_t t_i = LCD_INT(state->target_lcd_color); |
25 | uint8_t p_h = LCD_HUE(state->prev_lcd_color); | 25 | uint8_t p_h = LCD_HUE(state->prev_lcd_color); |
26 | uint8_t p_s = LCD_SAT(state->prev_lcd_color); | 26 | uint8_t p_s = LCD_SAT(state->prev_lcd_color); |
27 | uint8_t p_i = LCD_INT(state->prev_lcd_color); | 27 | uint8_t p_i = LCD_INT(state->prev_lcd_color); |
28 | 28 | ||
29 | uint8_t d_h1 = t_h - p_h; //Modulo arithmetic since we want to wrap around | 29 | uint8_t d_h1 = t_h - p_h; // Modulo arithmetic since we want to wrap around |
30 | int d_h2 = t_h - p_h; | 30 | int d_h2 = t_h - p_h; |
31 | // Chose the shortest way around | 31 | // Chose the shortest way around |
32 | int d_h = abs(d_h2) < d_h1 ? d_h2 : d_h1; | 32 | int d_h = abs(d_h2) < d_h1 ? d_h2 : d_h1; |
33 | int d_s = t_s - p_s; | 33 | int d_s = t_s - p_s; |
34 | int d_i = t_i - p_i; | 34 | int d_i = t_i - p_i; |
35 | 35 | ||
36 | int hue = (d_h * current_pos) / frame_length; | 36 | int hue = (d_h * current_pos) / frame_length; |
37 | int sat = (d_s * current_pos) / frame_length; | 37 | int sat = (d_s * current_pos) / frame_length; |
38 | int intensity = (d_i * current_pos) / frame_length; | 38 | int intensity = (d_i * current_pos) / frame_length; |
39 | //dprintf("%X -> %X = %X\n", p_h, t_h, hue); | 39 | // dprintf("%X -> %X = %X\n", p_h, t_h, hue); |
40 | hue += p_h; | 40 | hue += p_h; |
41 | sat += p_s; | 41 | sat += p_s; |
42 | intensity += p_i; | 42 | intensity += p_i; |
43 | state->current_lcd_color = LCD_COLOR(hue, sat, intensity); | 43 | state->current_lcd_color = LCD_COLOR(hue, sat, intensity); |
44 | lcd_backlight_color( | 44 | lcd_backlight_color(LCD_HUE(state->current_lcd_color), LCD_SAT(state->current_lcd_color), LCD_INT(state->current_lcd_color)); |
45 | LCD_HUE(state->current_lcd_color), | ||
46 | LCD_SAT(state->current_lcd_color), | ||
47 | LCD_INT(state->current_lcd_color)); | ||
48 | 45 | ||
49 | return true; | 46 | return true; |
50 | } | 47 | } |
51 | 48 | ||
52 | bool lcd_backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state) { | 49 | bool lcd_backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state) { |
53 | (void)animation; | 50 | (void)animation; |
54 | state->prev_lcd_color = state->target_lcd_color; | 51 | state->prev_lcd_color = state->target_lcd_color; |
55 | state->current_lcd_color = state->target_lcd_color; | 52 | state->current_lcd_color = state->target_lcd_color; |
56 | lcd_backlight_color( | 53 | lcd_backlight_color(LCD_HUE(state->current_lcd_color), LCD_SAT(state->current_lcd_color), LCD_INT(state->current_lcd_color)); |
57 | LCD_HUE(state->current_lcd_color), | ||
58 | LCD_SAT(state->current_lcd_color), | ||
59 | LCD_INT(state->current_lcd_color)); | ||
60 | return false; | 54 | return false; |
61 | } | 55 | } |
62 | 56 | ||
@@ -70,8 +64,6 @@ bool lcd_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_ | |||
70 | bool lcd_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { | 64 | bool lcd_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { |
71 | (void)animation; | 65 | (void)animation; |
72 | (void)state; | 66 | (void)state; |
73 | lcd_backlight_color(LCD_HUE(state->current_lcd_color), | 67 | lcd_backlight_color(LCD_HUE(state->current_lcd_color), LCD_SAT(state->current_lcd_color), LCD_INT(state->current_lcd_color)); |
74 | LCD_SAT(state->current_lcd_color), | ||
75 | LCD_INT(state->current_lcd_color)); | ||
76 | return false; | 68 | return false; |
77 | } | 69 | } |