aboutsummaryrefslogtreecommitdiff
path: root/quantum/rgb_matrix_runners
diff options
context:
space:
mode:
authorskullY <skullydazed@gmail.com>2019-08-30 11:19:03 -0700
committerskullydazed <skullydazed@users.noreply.github.com>2019-08-30 15:01:52 -0700
commitb624f32f944acdc59dcb130674c09090c5c404cb (patch)
treebc13adbba137d122d9a2c2fb2fafcbb08ac10e25 /quantum/rgb_matrix_runners
parent61af76a10d00aba185b8338604171de490a13e3b (diff)
downloadqmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.tar.gz
qmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.zip
clang-format changes
Diffstat (limited to 'quantum/rgb_matrix_runners')
-rw-r--r--quantum/rgb_matrix_runners/effect_runner_dx_dy.h20
-rw-r--r--quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h22
-rw-r--r--quantum/rgb_matrix_runners/effect_runner_i.h16
-rw-r--r--quantum/rgb_matrix_runners/effect_runner_reactive.h34
-rw-r--r--quantum/rgb_matrix_runners/effect_runner_reactive_splash.h36
-rw-r--r--quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h20
6 files changed, 74 insertions, 74 deletions
diff --git a/quantum/rgb_matrix_runners/effect_runner_dx_dy.h b/quantum/rgb_matrix_runners/effect_runner_dx_dy.h
index 9650c9a13..3d312190a 100644
--- a/quantum/rgb_matrix_runners/effect_runner_dx_dy.h
+++ b/quantum/rgb_matrix_runners/effect_runner_dx_dy.h
@@ -3,15 +3,15 @@
3typedef HSV (*dx_dy_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t time); 3typedef HSV (*dx_dy_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t time);
4 4
5bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) { 5bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) {
6 RGB_MATRIX_USE_LIMITS(led_min, led_max); 6 RGB_MATRIX_USE_LIMITS(led_min, led_max);
7 7
8 uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2); 8 uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2);
9 for (uint8_t i = led_min; i < led_max; i++) { 9 for (uint8_t i = led_min; i < led_max; i++) {
10 RGB_MATRIX_TEST_LED_FLAGS(); 10 RGB_MATRIX_TEST_LED_FLAGS();
11 int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; 11 int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x;
12 int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y; 12 int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y;
13 RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time)); 13 RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time));
14 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); 14 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
15 } 15 }
16 return led_max < DRIVER_LED_TOTAL; 16 return led_max < DRIVER_LED_TOTAL;
17} 17}
diff --git a/quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h b/quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h
index eb0c4d8dd..1f4767e32 100644
--- a/quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h
+++ b/quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h
@@ -3,16 +3,16 @@
3typedef HSV (*dx_dy_dist_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time); 3typedef HSV (*dx_dy_dist_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time);
4 4
5bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func) { 5bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func) {
6 RGB_MATRIX_USE_LIMITS(led_min, led_max); 6 RGB_MATRIX_USE_LIMITS(led_min, led_max);
7 7
8 uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2); 8 uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2);
9 for (uint8_t i = led_min; i < led_max; i++) { 9 for (uint8_t i = led_min; i < led_max; i++) {
10 RGB_MATRIX_TEST_LED_FLAGS(); 10 RGB_MATRIX_TEST_LED_FLAGS();
11 int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; 11 int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x;
12 int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y; 12 int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y;
13 uint8_t dist = sqrt16(dx * dx + dy * dy); 13 uint8_t dist = sqrt16(dx * dx + dy * dy);
14 RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, dist, time)); 14 RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, dist, time));
15 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); 15 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
16 } 16 }
17 return led_max < DRIVER_LED_TOTAL; 17 return led_max < DRIVER_LED_TOTAL;
18} 18}
diff --git a/quantum/rgb_matrix_runners/effect_runner_i.h b/quantum/rgb_matrix_runners/effect_runner_i.h
index d4a7ef392..eebfb78c0 100644
--- a/quantum/rgb_matrix_runners/effect_runner_i.h
+++ b/quantum/rgb_matrix_runners/effect_runner_i.h
@@ -3,13 +3,13 @@
3typedef HSV (*i_f)(HSV hsv, uint8_t i, uint8_t time); 3typedef HSV (*i_f)(HSV hsv, uint8_t i, uint8_t time);
4 4
5bool effect_runner_i(effect_params_t* params, i_f effect_func) { 5bool effect_runner_i(effect_params_t* params, i_f effect_func) {
6 RGB_MATRIX_USE_LIMITS(led_min, led_max); 6 RGB_MATRIX_USE_LIMITS(led_min, led_max);
7 7
8 uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); 8 uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
9 for (uint8_t i = led_min; i < led_max; i++) { 9 for (uint8_t i = led_min; i < led_max; i++) {
10 RGB_MATRIX_TEST_LED_FLAGS(); 10 RGB_MATRIX_TEST_LED_FLAGS();
11 RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); 11 RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time));
12 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); 12 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
13 } 13 }
14 return led_max < DRIVER_LED_TOTAL; 14 return led_max < DRIVER_LED_TOTAL;
15} 15}
diff --git a/quantum/rgb_matrix_runners/effect_runner_reactive.h b/quantum/rgb_matrix_runners/effect_runner_reactive.h
index 9da2814ce..53e77e3fb 100644
--- a/quantum/rgb_matrix_runners/effect_runner_reactive.h
+++ b/quantum/rgb_matrix_runners/effect_runner_reactive.h
@@ -7,23 +7,23 @@ typedef HSV (*reactive_f)(HSV hsv, uint16_t offset);
7bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) { 7bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) {
8 RGB_MATRIX_USE_LIMITS(led_min, led_max); 8 RGB_MATRIX_USE_LIMITS(led_min, led_max);
9 9
10 uint16_t max_tick = 65535 / rgb_matrix_config.speed; 10 uint16_t max_tick = 65535 / rgb_matrix_config.speed;
11 for (uint8_t i = led_min; i < led_max; i++) { 11 for (uint8_t i = led_min; i < led_max; i++) {
12 RGB_MATRIX_TEST_LED_FLAGS(); 12 RGB_MATRIX_TEST_LED_FLAGS();
13 uint16_t tick = max_tick; 13 uint16_t tick = max_tick;
14 // Reverse search to find most recent key hit 14 // Reverse search to find most recent key hit
15 for (int8_t j = g_last_hit_tracker.count - 1; j >= 0; j--) { 15 for (int8_t j = g_last_hit_tracker.count - 1; j >= 0; j--) {
16 if (g_last_hit_tracker.index[j] == i && g_last_hit_tracker.tick[j] < tick) { 16 if (g_last_hit_tracker.index[j] == i && g_last_hit_tracker.tick[j] < tick) {
17 tick = g_last_hit_tracker.tick[j]; 17 tick = g_last_hit_tracker.tick[j];
18 break; 18 break;
19 } 19 }
20 } 20 }
21 21
22 uint16_t offset = scale16by8(tick, rgb_matrix_config.speed); 22 uint16_t offset = scale16by8(tick, rgb_matrix_config.speed);
23 RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, offset)); 23 RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, offset));
24 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); 24 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
25 } 25 }
26 return led_max < DRIVER_LED_TOTAL; 26 return led_max < DRIVER_LED_TOTAL;
27} 27}
28 28
29#endif // RGB_MATRIX_KEYREACTIVE_ENABLED 29#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
diff --git a/quantum/rgb_matrix_runners/effect_runner_reactive_splash.h b/quantum/rgb_matrix_runners/effect_runner_reactive_splash.h
index 4f2059c99..b5d284a40 100644
--- a/quantum/rgb_matrix_runners/effect_runner_reactive_splash.h
+++ b/quantum/rgb_matrix_runners/effect_runner_reactive_splash.h
@@ -5,25 +5,25 @@
5typedef HSV (*reactive_splash_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick); 5typedef HSV (*reactive_splash_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick);
6 6
7bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, reactive_splash_f effect_func) { 7bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, reactive_splash_f effect_func) {
8 RGB_MATRIX_USE_LIMITS(led_min, led_max); 8 RGB_MATRIX_USE_LIMITS(led_min, led_max);
9 9
10 uint8_t count = g_last_hit_tracker.count; 10 uint8_t count = g_last_hit_tracker.count;
11 for (uint8_t i = led_min; i < led_max; i++) { 11 for (uint8_t i = led_min; i < led_max; i++) {
12 RGB_MATRIX_TEST_LED_FLAGS(); 12 RGB_MATRIX_TEST_LED_FLAGS();
13 HSV hsv = rgb_matrix_config.hsv; 13 HSV hsv = rgb_matrix_config.hsv;
14 hsv.v = 0; 14 hsv.v = 0;
15 for (uint8_t j = start; j < count; j++) { 15 for (uint8_t j = start; j < count; j++) {
16 int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j]; 16 int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j];
17 int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j]; 17 int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j];
18 uint8_t dist = sqrt16(dx * dx + dy * dy); 18 uint8_t dist = sqrt16(dx * dx + dy * dy);
19 uint16_t tick = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed); 19 uint16_t tick = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed);
20 hsv = effect_func(hsv, dx, dy, dist, tick); 20 hsv = effect_func(hsv, dx, dy, dist, tick);
21 }
22 hsv.v = scale8(hsv.v, rgb_matrix_config.hsv.v);
23 RGB rgb = hsv_to_rgb(hsv);
24 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
21 } 25 }
22 hsv.v = scale8(hsv.v, rgb_matrix_config.hsv.v); 26 return led_max < DRIVER_LED_TOTAL;
23 RGB rgb = hsv_to_rgb(hsv);
24 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
25 }
26 return led_max < DRIVER_LED_TOTAL;
27} 27}
28 28
29#endif // RGB_MATRIX_KEYREACTIVE_ENABLED 29#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
diff --git a/quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h b/quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h
index e68a7a968..c02352b86 100644
--- a/quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h
+++ b/quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h
@@ -3,15 +3,15 @@
3typedef HSV (*sin_cos_i_f)(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time); 3typedef HSV (*sin_cos_i_f)(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time);
4 4
5bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) { 5bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) {
6 RGB_MATRIX_USE_LIMITS(led_min, led_max); 6 RGB_MATRIX_USE_LIMITS(led_min, led_max);
7 7
8 uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); 8 uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
9 int8_t cos_value = cos8(time) - 128; 9 int8_t cos_value = cos8(time) - 128;
10 int8_t sin_value = sin8(time) - 128; 10 int8_t sin_value = sin8(time) - 128;
11 for (uint8_t i = led_min; i < led_max; i++) { 11 for (uint8_t i = led_min; i < led_max; i++) {
12 RGB_MATRIX_TEST_LED_FLAGS(); 12 RGB_MATRIX_TEST_LED_FLAGS();
13 RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time)); 13 RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time));
14 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); 14 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
15 } 15 }
16 return led_max < DRIVER_LED_TOTAL; 16 return led_max < DRIVER_LED_TOTAL;
17} 17}