diff options
59 files changed, 122 insertions, 117 deletions
diff --git a/drivers/led/apa102.c b/drivers/led/apa102.c index 0cf0ecb401..050609263d 100644 --- a/drivers/led/apa102.c +++ b/drivers/led/apa102.c | |||
| @@ -53,8 +53,8 @@ | |||
| 53 | io_wait; \ | 53 | io_wait; \ |
| 54 | } while (0) | 54 | } while (0) |
| 55 | 55 | ||
| 56 | rgb_led_t apa102_leds[APA102_LED_COUNT]; | 56 | rgb_t apa102_leds[APA102_LED_COUNT]; |
| 57 | uint8_t apa102_led_brightness = APA102_DEFAULT_BRIGHTNESS; | 57 | uint8_t apa102_led_brightness = APA102_DEFAULT_BRIGHTNESS; |
| 58 | 58 | ||
| 59 | static void apa102_send_byte(uint8_t byte) { | 59 | static void apa102_send_byte(uint8_t byte) { |
| 60 | APA102_SEND_BIT(byte, 7); | 60 | APA102_SEND_BIT(byte, 7); |
diff --git a/drivers/painter/generic/qp_surface_rgb565.c b/drivers/painter/generic/qp_surface_rgb565.c index 8883ed541d..c5b351311a 100644 --- a/drivers/painter/generic/qp_surface_rgb565.c +++ b/drivers/painter/generic/qp_surface_rgb565.c | |||
| @@ -52,7 +52,7 @@ static bool qp_surface_pixdata_rgb565(painter_device_t device, const void *pixel | |||
| 52 | // Pixel colour conversion | 52 | // Pixel colour conversion |
| 53 | static bool qp_surface_palette_convert_rgb565_swapped(painter_device_t device, int16_t palette_size, qp_pixel_t *palette) { | 53 | static bool qp_surface_palette_convert_rgb565_swapped(painter_device_t device, int16_t palette_size, qp_pixel_t *palette) { |
| 54 | for (int16_t i = 0; i < palette_size; ++i) { | 54 | for (int16_t i = 0; i < palette_size; ++i) { |
| 55 | RGB rgb = hsv_to_rgb_nocie((HSV){palette[i].hsv888.h, palette[i].hsv888.s, palette[i].hsv888.v}); | 55 | rgb_t rgb = hsv_to_rgb_nocie((hsv_t){palette[i].hsv888.h, palette[i].hsv888.s, palette[i].hsv888.v}); |
| 56 | uint16_t rgb565 = (((uint16_t)rgb.r) >> 3) << 11 | (((uint16_t)rgb.g) >> 2) << 5 | (((uint16_t)rgb.b) >> 3); | 56 | uint16_t rgb565 = (((uint16_t)rgb.r) >> 3) << 11 | (((uint16_t)rgb.g) >> 2) << 5 | (((uint16_t)rgb.b) >> 3); |
| 57 | palette[i].rgb565 = __builtin_bswap16(rgb565); | 57 | palette[i].rgb565 = __builtin_bswap16(rgb565); |
| 58 | } | 58 | } |
diff --git a/drivers/painter/tft_panel/qp_tft_panel.c b/drivers/painter/tft_panel/qp_tft_panel.c index 16dba9d6a6..c8e33343d4 100644 --- a/drivers/painter/tft_panel/qp_tft_panel.c +++ b/drivers/painter/tft_panel/qp_tft_panel.c | |||
| @@ -90,7 +90,7 @@ bool qp_tft_panel_pixdata(painter_device_t device, const void *pixel_data, uint3 | |||
| 90 | 90 | ||
| 91 | bool qp_tft_panel_palette_convert_rgb565_swapped(painter_device_t device, int16_t palette_size, qp_pixel_t *palette) { | 91 | bool qp_tft_panel_palette_convert_rgb565_swapped(painter_device_t device, int16_t palette_size, qp_pixel_t *palette) { |
| 92 | for (int16_t i = 0; i < palette_size; ++i) { | 92 | for (int16_t i = 0; i < palette_size; ++i) { |
| 93 | RGB rgb = hsv_to_rgb_nocie((HSV){palette[i].hsv888.h, palette[i].hsv888.s, palette[i].hsv888.v}); | 93 | rgb_t rgb = hsv_to_rgb_nocie((hsv_t){palette[i].hsv888.h, palette[i].hsv888.s, palette[i].hsv888.v}); |
| 94 | uint16_t rgb565 = (((uint16_t)rgb.r) >> 3) << 11 | (((uint16_t)rgb.g) >> 2) << 5 | (((uint16_t)rgb.b) >> 3); | 94 | uint16_t rgb565 = (((uint16_t)rgb.r) >> 3) << 11 | (((uint16_t)rgb.g) >> 2) << 5 | (((uint16_t)rgb.b) >> 3); |
| 95 | palette[i].rgb565 = __builtin_bswap16(rgb565); | 95 | palette[i].rgb565 = __builtin_bswap16(rgb565); |
| 96 | } | 96 | } |
| @@ -99,7 +99,7 @@ bool qp_tft_panel_palette_convert_rgb565_swapped(painter_device_t device, int16_ | |||
| 99 | 99 | ||
| 100 | bool qp_tft_panel_palette_convert_rgb888(painter_device_t device, int16_t palette_size, qp_pixel_t *palette) { | 100 | bool qp_tft_panel_palette_convert_rgb888(painter_device_t device, int16_t palette_size, qp_pixel_t *palette) { |
| 101 | for (int16_t i = 0; i < palette_size; ++i) { | 101 | for (int16_t i = 0; i < palette_size; ++i) { |
| 102 | RGB rgb = hsv_to_rgb_nocie((HSV){palette[i].hsv888.h, palette[i].hsv888.s, palette[i].hsv888.v}); | 102 | rgb_t rgb = hsv_to_rgb_nocie((hsv_t){palette[i].hsv888.h, palette[i].hsv888.s, palette[i].hsv888.v}); |
| 103 | palette[i].rgb888.r = rgb.r; | 103 | palette[i].rgb888.r = rgb.r; |
| 104 | palette[i].rgb888.g = rgb.g; | 104 | palette[i].rgb888.g = rgb.g; |
| 105 | palette[i].rgb888.b = rgb.b; | 105 | palette[i].rgb888.b = rgb.b; |
diff --git a/quantum/color.c b/quantum/color.c index 5f264cb76f..93564784f0 100644 --- a/quantum/color.c +++ b/quantum/color.c | |||
| @@ -19,8 +19,8 @@ | |||
| 19 | #include "progmem.h" | 19 | #include "progmem.h" |
| 20 | #include "util.h" | 20 | #include "util.h" |
| 21 | 21 | ||
| 22 | RGB hsv_to_rgb_impl(HSV hsv, bool use_cie) { | 22 | rgb_t hsv_to_rgb_impl(hsv_t hsv, bool use_cie) { |
| 23 | RGB rgb; | 23 | rgb_t rgb; |
| 24 | uint8_t region, remainder, p, q, t; | 24 | uint8_t region, remainder, p, q, t; |
| 25 | uint16_t h, s, v; | 25 | uint16_t h, s, v; |
| 26 | 26 | ||
| @@ -97,7 +97,7 @@ RGB hsv_to_rgb_impl(HSV hsv, bool use_cie) { | |||
| 97 | return rgb; | 97 | return rgb; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | RGB hsv_to_rgb(HSV hsv) { | 100 | rgb_t hsv_to_rgb(hsv_t hsv) { |
| 101 | #ifdef USE_CIE1931_CURVE | 101 | #ifdef USE_CIE1931_CURVE |
| 102 | return hsv_to_rgb_impl(hsv, true); | 102 | return hsv_to_rgb_impl(hsv, true); |
| 103 | #else | 103 | #else |
| @@ -105,6 +105,6 @@ RGB hsv_to_rgb(HSV hsv) { | |||
| 105 | #endif | 105 | #endif |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | RGB hsv_to_rgb_nocie(HSV hsv) { | 108 | rgb_t hsv_to_rgb_nocie(hsv_t hsv) { |
| 109 | return hsv_to_rgb_impl(hsv, false); | 109 | return hsv_to_rgb_impl(hsv, false); |
| 110 | } | 110 | } |
diff --git a/quantum/color.h b/quantum/color.h index 81a2c1e7ba..5c23b25335 100644 --- a/quantum/color.h +++ b/quantum/color.h | |||
| @@ -74,19 +74,24 @@ | |||
| 74 | 74 | ||
| 75 | // clang-format on | 75 | // clang-format on |
| 76 | 76 | ||
| 77 | typedef struct PACKED rgb_led_t { | 77 | typedef struct PACKED rgb_t { |
| 78 | uint8_t r; | 78 | uint8_t r; |
| 79 | uint8_t g; | 79 | uint8_t g; |
| 80 | uint8_t b; | 80 | uint8_t b; |
| 81 | } rgb_led_t; | 81 | } rgb_t; |
| 82 | 82 | ||
| 83 | typedef rgb_led_t RGB; | 83 | // DEPRECATED |
| 84 | typedef rgb_t RGB; | ||
| 85 | typedef rgb_t rgb_led_t; | ||
| 84 | 86 | ||
| 85 | typedef struct PACKED HSV { | 87 | typedef struct PACKED hsv_t { |
| 86 | uint8_t h; | 88 | uint8_t h; |
| 87 | uint8_t s; | 89 | uint8_t s; |
| 88 | uint8_t v; | 90 | uint8_t v; |
| 89 | } HSV; | 91 | } hsv_t; |
| 90 | 92 | ||
| 91 | RGB hsv_to_rgb(HSV hsv); | 93 | // DEPRECATED |
| 92 | RGB hsv_to_rgb_nocie(HSV hsv); | 94 | typedef hsv_t HSV; |
| 95 | |||
| 96 | rgb_t hsv_to_rgb(hsv_t hsv); | ||
| 97 | rgb_t hsv_to_rgb_nocie(hsv_t hsv); | ||
diff --git a/quantum/rgb_matrix/animations/alpha_mods_anim.h b/quantum/rgb_matrix/animations/alpha_mods_anim.h index 59b8381d69..2f76feb0fc 100644 --- a/quantum/rgb_matrix/animations/alpha_mods_anim.h +++ b/quantum/rgb_matrix/animations/alpha_mods_anim.h | |||
| @@ -6,10 +6,10 @@ RGB_MATRIX_EFFECT(ALPHAS_MODS) | |||
| 6 | bool ALPHAS_MODS(effect_params_t* params) { | 6 | bool ALPHAS_MODS(effect_params_t* params) { |
| 7 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 7 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
| 8 | 8 | ||
| 9 | HSV hsv = rgb_matrix_config.hsv; | 9 | hsv_t hsv = rgb_matrix_config.hsv; |
| 10 | RGB rgb1 = rgb_matrix_hsv_to_rgb(hsv); | 10 | rgb_t rgb1 = rgb_matrix_hsv_to_rgb(hsv); |
| 11 | hsv.h += rgb_matrix_config.speed; | 11 | hsv.h += rgb_matrix_config.speed; |
| 12 | RGB rgb2 = rgb_matrix_hsv_to_rgb(hsv); | 12 | rgb_t rgb2 = rgb_matrix_hsv_to_rgb(hsv); |
| 13 | 13 | ||
| 14 | for (uint8_t i = led_min; i < led_max; i++) { | 14 | for (uint8_t i = led_min; i < led_max; i++) { |
| 15 | RGB_MATRIX_TEST_LED_FLAGS(); | 15 | RGB_MATRIX_TEST_LED_FLAGS(); |
diff --git a/quantum/rgb_matrix/animations/breathing_anim.h b/quantum/rgb_matrix/animations/breathing_anim.h index e9a3c96e1b..ed0c808f87 100644 --- a/quantum/rgb_matrix/animations/breathing_anim.h +++ b/quantum/rgb_matrix/animations/breathing_anim.h | |||
| @@ -5,10 +5,10 @@ RGB_MATRIX_EFFECT(BREATHING) | |||
| 5 | bool BREATHING(effect_params_t* params) { | 5 | bool BREATHING(effect_params_t* params) { |
| 6 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 6 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
| 7 | 7 | ||
| 8 | HSV hsv = rgb_matrix_config.hsv; | 8 | hsv_t hsv = rgb_matrix_config.hsv; |
| 9 | uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); | 9 | uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); |
| 10 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); | 10 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); |
| 11 | RGB rgb = rgb_matrix_hsv_to_rgb(hsv); | 11 | rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); |
| 12 | for (uint8_t i = led_min; i < led_max; i++) { | 12 | for (uint8_t i = led_min; i < led_max; i++) { |
| 13 | RGB_MATRIX_TEST_LED_FLAGS(); | 13 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 14 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 14 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
diff --git a/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h b/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h index 06aa8b5ed5..5ae5b193b0 100644 --- a/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h +++ b/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(BAND_PINWHEEL_SAT) | 2 | RGB_MATRIX_EFFECT(BAND_PINWHEEL_SAT) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV BAND_PINWHEEL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { | 5 | static hsv_t BAND_PINWHEEL_SAT_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t time) { |
| 6 | hsv.s = scale8(hsv.s - time - atan2_8(dy, dx) * 3, hsv.s); | 6 | hsv.s = scale8(hsv.s - time - atan2_8(dy, dx) * 3, hsv.s); |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
diff --git a/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h b/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h index bcbc319498..157a8c1c19 100644 --- a/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h +++ b/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(BAND_PINWHEEL_VAL) | 2 | RGB_MATRIX_EFFECT(BAND_PINWHEEL_VAL) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV BAND_PINWHEEL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { | 5 | static hsv_t BAND_PINWHEEL_VAL_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t time) { |
| 6 | hsv.v = scale8(hsv.v - time - atan2_8(dy, dx) * 3, hsv.v); | 6 | hsv.v = scale8(hsv.v - time - atan2_8(dy, dx) * 3, hsv.v); |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
diff --git a/quantum/rgb_matrix/animations/colorband_sat_anim.h b/quantum/rgb_matrix/animations/colorband_sat_anim.h index cb0897ad3e..a0d0e6e811 100644 --- a/quantum/rgb_matrix/animations/colorband_sat_anim.h +++ b/quantum/rgb_matrix/animations/colorband_sat_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(BAND_SAT) | 2 | RGB_MATRIX_EFFECT(BAND_SAT) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV BAND_SAT_math(HSV hsv, uint8_t i, uint8_t time) { | 5 | static hsv_t BAND_SAT_math(hsv_t hsv, uint8_t i, uint8_t time) { |
| 6 | int16_t s = hsv.s - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8; | 6 | int16_t s = hsv.s - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8; |
| 7 | hsv.s = scale8(s < 0 ? 0 : s, hsv.s); | 7 | hsv.s = scale8(s < 0 ? 0 : s, hsv.s); |
| 8 | return hsv; | 8 | return hsv; |
diff --git a/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h b/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h index d26eb37855..7d2e5b3269 100644 --- a/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h +++ b/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(BAND_SPIRAL_SAT) | 2 | RGB_MATRIX_EFFECT(BAND_SPIRAL_SAT) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV BAND_SPIRAL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { | 5 | static hsv_t BAND_SPIRAL_SAT_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { |
| 6 | hsv.s = scale8(hsv.s + dist - time - atan2_8(dy, dx), hsv.s); | 6 | hsv.s = scale8(hsv.s + dist - time - atan2_8(dy, dx), hsv.s); |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
diff --git a/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h b/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h index 3ae34bb6f0..9cd9c084d1 100644 --- a/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h +++ b/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(BAND_SPIRAL_VAL) | 2 | RGB_MATRIX_EFFECT(BAND_SPIRAL_VAL) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV BAND_SPIRAL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { | 5 | static hsv_t BAND_SPIRAL_VAL_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { |
| 6 | hsv.v = scale8(hsv.v + dist - time - atan2_8(dy, dx), hsv.v); | 6 | hsv.v = scale8(hsv.v + dist - time - atan2_8(dy, dx), hsv.v); |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
diff --git a/quantum/rgb_matrix/animations/colorband_val_anim.h b/quantum/rgb_matrix/animations/colorband_val_anim.h index 69c29f53a3..ccffae259f 100644 --- a/quantum/rgb_matrix/animations/colorband_val_anim.h +++ b/quantum/rgb_matrix/animations/colorband_val_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(BAND_VAL) | 2 | RGB_MATRIX_EFFECT(BAND_VAL) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV BAND_VAL_math(HSV hsv, uint8_t i, uint8_t time) { | 5 | static hsv_t BAND_VAL_math(hsv_t hsv, uint8_t i, uint8_t time) { |
| 6 | int16_t v = hsv.v - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8; | 6 | int16_t v = hsv.v - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8; |
| 7 | hsv.v = scale8(v < 0 ? 0 : v, hsv.v); | 7 | hsv.v = scale8(v < 0 ? 0 : v, hsv.v); |
| 8 | return hsv; | 8 | return hsv; |
diff --git a/quantum/rgb_matrix/animations/cycle_all_anim.h b/quantum/rgb_matrix/animations/cycle_all_anim.h index d8c7220d95..8fafcf8d11 100644 --- a/quantum/rgb_matrix/animations/cycle_all_anim.h +++ b/quantum/rgb_matrix/animations/cycle_all_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(CYCLE_ALL) | 2 | RGB_MATRIX_EFFECT(CYCLE_ALL) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV CYCLE_ALL_math(HSV hsv, uint8_t i, uint8_t time) { | 5 | static hsv_t CYCLE_ALL_math(hsv_t hsv, uint8_t i, uint8_t time) { |
| 6 | hsv.h = time; | 6 | hsv.h = time; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
diff --git a/quantum/rgb_matrix/animations/cycle_left_right_anim.h b/quantum/rgb_matrix/animations/cycle_left_right_anim.h index 84c2127aff..2d8871a300 100644 --- a/quantum/rgb_matrix/animations/cycle_left_right_anim.h +++ b/quantum/rgb_matrix/animations/cycle_left_right_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(CYCLE_LEFT_RIGHT) | 2 | RGB_MATRIX_EFFECT(CYCLE_LEFT_RIGHT) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV CYCLE_LEFT_RIGHT_math(HSV hsv, uint8_t i, uint8_t time) { | 5 | static hsv_t CYCLE_LEFT_RIGHT_math(hsv_t hsv, uint8_t i, uint8_t time) { |
| 6 | hsv.h = g_led_config.point[i].x - time; | 6 | hsv.h = g_led_config.point[i].x - time; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
diff --git a/quantum/rgb_matrix/animations/cycle_out_in_anim.h b/quantum/rgb_matrix/animations/cycle_out_in_anim.h index 9513fe9593..faf920a608 100644 --- a/quantum/rgb_matrix/animations/cycle_out_in_anim.h +++ b/quantum/rgb_matrix/animations/cycle_out_in_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(CYCLE_OUT_IN) | 2 | RGB_MATRIX_EFFECT(CYCLE_OUT_IN) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV CYCLE_OUT_IN_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { | 5 | static hsv_t CYCLE_OUT_IN_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { |
| 6 | hsv.h = 3 * dist / 2 + time; | 6 | hsv.h = 3 * dist / 2 + time; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
diff --git a/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h b/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h index 3cca45f27a..4203a8ffd2 100644 --- a/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h +++ b/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(CYCLE_OUT_IN_DUAL) | 2 | RGB_MATRIX_EFFECT(CYCLE_OUT_IN_DUAL) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV CYCLE_OUT_IN_DUAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { | 5 | static hsv_t CYCLE_OUT_IN_DUAL_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t time) { |
| 6 | dx = (k_rgb_matrix_center.x / 2) - abs8(dx); | 6 | dx = (k_rgb_matrix_center.x / 2) - abs8(dx); |
| 7 | uint8_t dist = sqrt16(dx * dx + dy * dy); | 7 | uint8_t dist = sqrt16(dx * dx + dy * dy); |
| 8 | hsv.h = 3 * dist + time; | 8 | hsv.h = 3 * dist + time; |
diff --git a/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h b/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h index de5993992c..d557ffeb78 100644 --- a/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h +++ b/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(CYCLE_PINWHEEL) | 2 | RGB_MATRIX_EFFECT(CYCLE_PINWHEEL) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV CYCLE_PINWHEEL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { | 5 | static hsv_t CYCLE_PINWHEEL_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t time) { |
| 6 | hsv.h = atan2_8(dy, dx) + time; | 6 | hsv.h = atan2_8(dy, dx) + time; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
diff --git a/quantum/rgb_matrix/animations/cycle_spiral_anim.h b/quantum/rgb_matrix/animations/cycle_spiral_anim.h index 904450179e..6d7a2dc5b4 100644 --- a/quantum/rgb_matrix/animations/cycle_spiral_anim.h +++ b/quantum/rgb_matrix/animations/cycle_spiral_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(CYCLE_SPIRAL) | 2 | RGB_MATRIX_EFFECT(CYCLE_SPIRAL) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV CYCLE_SPIRAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { | 5 | static hsv_t CYCLE_SPIRAL_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { |
| 6 | hsv.h = dist - time - atan2_8(dy, dx); | 6 | hsv.h = dist - time - atan2_8(dy, dx); |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
diff --git a/quantum/rgb_matrix/animations/cycle_up_down_anim.h b/quantum/rgb_matrix/animations/cycle_up_down_anim.h index dce05fecff..09c8ace46b 100644 --- a/quantum/rgb_matrix/animations/cycle_up_down_anim.h +++ b/quantum/rgb_matrix/animations/cycle_up_down_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(CYCLE_UP_DOWN) | 2 | RGB_MATRIX_EFFECT(CYCLE_UP_DOWN) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV CYCLE_UP_DOWN_math(HSV hsv, uint8_t i, uint8_t time) { | 5 | static hsv_t CYCLE_UP_DOWN_math(hsv_t hsv, uint8_t i, uint8_t time) { |
| 6 | hsv.h = g_led_config.point[i].y - time; | 6 | hsv.h = g_led_config.point[i].y - time; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
diff --git a/quantum/rgb_matrix/animations/dual_beacon_anim.h b/quantum/rgb_matrix/animations/dual_beacon_anim.h index 5585015b86..7279f1ce53 100644 --- a/quantum/rgb_matrix/animations/dual_beacon_anim.h +++ b/quantum/rgb_matrix/animations/dual_beacon_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(DUAL_BEACON) | 2 | RGB_MATRIX_EFFECT(DUAL_BEACON) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV DUAL_BEACON_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { | 5 | static hsv_t DUAL_BEACON_math(hsv_t hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { |
| 6 | hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * sin) / 128; | 6 | hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * sin) / 128; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
diff --git a/quantum/rgb_matrix/animations/flower_blooming_anim.h b/quantum/rgb_matrix/animations/flower_blooming_anim.h index 7629fde858..91f70c8d52 100644 --- a/quantum/rgb_matrix/animations/flower_blooming_anim.h +++ b/quantum/rgb_matrix/animations/flower_blooming_anim.h | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | RGB_MATRIX_EFFECT(FLOWER_BLOOMING) | 18 | RGB_MATRIX_EFFECT(FLOWER_BLOOMING) |
| 19 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 19 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 20 | 20 | ||
| 21 | typedef HSV (*flower_blooming_f)(HSV hsv, uint8_t i, uint8_t time); | 21 | typedef hsv_t (*flower_blooming_f)(hsv_t hsv, uint8_t i, uint8_t time); |
| 22 | 22 | ||
| 23 | bool effect_runner_bloom(effect_params_t* params, flower_blooming_f effect_func) { | 23 | bool effect_runner_bloom(effect_params_t* params, flower_blooming_f effect_func) { |
| 24 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 24 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
| @@ -27,17 +27,17 @@ bool effect_runner_bloom(effect_params_t* params, flower_blooming_f effect_func) | |||
| 27 | for (uint8_t i = led_min; i < led_max; i++) { | 27 | for (uint8_t i = led_min; i < led_max; i++) { |
| 28 | RGB_MATRIX_TEST_LED_FLAGS(); | 28 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 29 | if (g_led_config.point[i].y > k_rgb_matrix_center.y) { | 29 | if (g_led_config.point[i].y > k_rgb_matrix_center.y) { |
| 30 | RGB bgr = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); | 30 | rgb_t bgr = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); |
| 31 | rgb_matrix_set_color(i, bgr.b, bgr.g, bgr.r); | 31 | rgb_matrix_set_color(i, bgr.b, bgr.g, bgr.r); |
| 32 | } else { | 32 | } else { |
| 33 | RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); | 33 | rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); |
| 34 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 34 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 35 | } | 35 | } |
| 36 | } | 36 | } |
| 37 | return rgb_matrix_check_finished_leds(led_max); | 37 | return rgb_matrix_check_finished_leds(led_max); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | static HSV FLOWER_BLOOMING_math(HSV hsv, uint8_t i, uint8_t time) { | 40 | static hsv_t FLOWER_BLOOMING_math(hsv_t hsv, uint8_t i, uint8_t time) { |
| 41 | if (g_led_config.point[i].y > k_rgb_matrix_center.y) | 41 | if (g_led_config.point[i].y > k_rgb_matrix_center.y) |
| 42 | hsv.h = g_led_config.point[i].x * 3 - g_led_config.point[i].y * 3 + time; | 42 | hsv.h = g_led_config.point[i].x * 3 - g_led_config.point[i].y * 3 + time; |
| 43 | else | 43 | else |
diff --git a/quantum/rgb_matrix/animations/gradient_left_right_anim.h b/quantum/rgb_matrix/animations/gradient_left_right_anim.h index ebb06f59f2..4175ab330d 100644 --- a/quantum/rgb_matrix/animations/gradient_left_right_anim.h +++ b/quantum/rgb_matrix/animations/gradient_left_right_anim.h | |||
| @@ -5,14 +5,14 @@ RGB_MATRIX_EFFECT(GRADIENT_LEFT_RIGHT) | |||
| 5 | bool GRADIENT_LEFT_RIGHT(effect_params_t* params) { | 5 | bool GRADIENT_LEFT_RIGHT(effect_params_t* params) { |
| 6 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 6 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
| 7 | 7 | ||
| 8 | HSV hsv = rgb_matrix_config.hsv; | 8 | hsv_t hsv = rgb_matrix_config.hsv; |
| 9 | uint8_t scale = scale8(64, rgb_matrix_config.speed); | 9 | uint8_t scale = scale8(64, rgb_matrix_config.speed); |
| 10 | for (uint8_t i = led_min; i < led_max; i++) { | 10 | for (uint8_t i = led_min; i < led_max; i++) { |
| 11 | RGB_MATRIX_TEST_LED_FLAGS(); | 11 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 12 | // The x range will be 0..224, map this to 0..7 | 12 | // The x range will be 0..224, map this to 0..7 |
| 13 | // Relies on hue being 8-bit and wrapping | 13 | // Relies on hue being 8-bit and wrapping |
| 14 | hsv.h = rgb_matrix_config.hsv.h + (scale * g_led_config.point[i].x >> 5); | 14 | hsv.h = rgb_matrix_config.hsv.h + (scale * g_led_config.point[i].x >> 5); |
| 15 | RGB rgb = rgb_matrix_hsv_to_rgb(hsv); | 15 | rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); |
| 16 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 16 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 17 | } | 17 | } |
| 18 | return rgb_matrix_check_finished_leds(led_max); | 18 | return rgb_matrix_check_finished_leds(led_max); |
diff --git a/quantum/rgb_matrix/animations/gradient_up_down_anim.h b/quantum/rgb_matrix/animations/gradient_up_down_anim.h index febc3919a8..e3953fb035 100644 --- a/quantum/rgb_matrix/animations/gradient_up_down_anim.h +++ b/quantum/rgb_matrix/animations/gradient_up_down_anim.h | |||
| @@ -5,14 +5,14 @@ RGB_MATRIX_EFFECT(GRADIENT_UP_DOWN) | |||
| 5 | bool GRADIENT_UP_DOWN(effect_params_t* params) { | 5 | bool GRADIENT_UP_DOWN(effect_params_t* params) { |
| 6 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 6 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
| 7 | 7 | ||
| 8 | HSV hsv = rgb_matrix_config.hsv; | 8 | hsv_t hsv = rgb_matrix_config.hsv; |
| 9 | uint8_t scale = scale8(64, rgb_matrix_config.speed); | 9 | uint8_t scale = scale8(64, rgb_matrix_config.speed); |
| 10 | for (uint8_t i = led_min; i < led_max; i++) { | 10 | for (uint8_t i = led_min; i < led_max; i++) { |
| 11 | RGB_MATRIX_TEST_LED_FLAGS(); | 11 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 12 | // The y range will be 0..64, map this to 0..4 | 12 | // The y range will be 0..64, map this to 0..4 |
| 13 | // Relies on hue being 8-bit and wrapping | 13 | // Relies on hue being 8-bit and wrapping |
| 14 | hsv.h = rgb_matrix_config.hsv.h + scale * (g_led_config.point[i].y >> 4); | 14 | hsv.h = rgb_matrix_config.hsv.h + scale * (g_led_config.point[i].y >> 4); |
| 15 | RGB rgb = rgb_matrix_hsv_to_rgb(hsv); | 15 | rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); |
| 16 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 16 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 17 | } | 17 | } |
| 18 | return rgb_matrix_check_finished_leds(led_max); | 18 | return rgb_matrix_check_finished_leds(led_max); |
diff --git a/quantum/rgb_matrix/animations/hue_breathing_anim.h b/quantum/rgb_matrix/animations/hue_breathing_anim.h index 8537762832..5316e92dbd 100644 --- a/quantum/rgb_matrix/animations/hue_breathing_anim.h +++ b/quantum/rgb_matrix/animations/hue_breathing_anim.h | |||
| @@ -7,10 +7,10 @@ RGB_MATRIX_EFFECT(HUE_BREATHING) | |||
| 7 | bool HUE_BREATHING(effect_params_t* params) { | 7 | bool HUE_BREATHING(effect_params_t* params) { |
| 8 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 8 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
| 9 | uint8_t huedelta = 12; | 9 | uint8_t huedelta = 12; |
| 10 | HSV hsv = rgb_matrix_config.hsv; | 10 | hsv_t hsv = rgb_matrix_config.hsv; |
| 11 | uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); | 11 | uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); |
| 12 | hsv.h = hsv.h + scale8(abs8(sin8(time) - 128) * 2, huedelta); | 12 | hsv.h = hsv.h + scale8(abs8(sin8(time) - 128) * 2, huedelta); |
| 13 | RGB rgb = hsv_to_rgb(hsv); | 13 | rgb_t rgb = hsv_to_rgb(hsv); |
| 14 | for (uint8_t i = led_min; i < led_max; i++) { | 14 | for (uint8_t i = led_min; i < led_max; i++) { |
| 15 | RGB_MATRIX_TEST_LED_FLAGS(); | 15 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 16 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 16 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
diff --git a/quantum/rgb_matrix/animations/hue_pendulum_anim.h b/quantum/rgb_matrix/animations/hue_pendulum_anim.h index 7d8cbcdfb2..ba0a5b45a4 100644 --- a/quantum/rgb_matrix/animations/hue_pendulum_anim.h +++ b/quantum/rgb_matrix/animations/hue_pendulum_anim.h | |||
| @@ -5,7 +5,7 @@ RGB_MATRIX_EFFECT(HUE_PENDULUM) | |||
| 5 | // Change huedelta to adjust range of hue change. 0-255. | 5 | // Change huedelta to adjust range of hue change. 0-255. |
| 6 | // Looks better with a low value and slow speed for subtle change. | 6 | // Looks better with a low value and slow speed for subtle change. |
| 7 | // Hue Pendulum - color changes in a wave to the right before reversing direction | 7 | // Hue Pendulum - color changes in a wave to the right before reversing direction |
| 8 | static HSV HUE_PENDULUM_math(HSV hsv, uint8_t i, uint8_t time) { | 8 | static hsv_t HUE_PENDULUM_math(hsv_t hsv, uint8_t i, uint8_t time) { |
| 9 | uint8_t huedelta = 12; | 9 | uint8_t huedelta = 12; |
| 10 | hsv.h = hsv.h + scale8(abs8(sin8(time) + (g_led_config.point[i].x) - 128) * 2, huedelta); | 10 | hsv.h = hsv.h + scale8(abs8(sin8(time) + (g_led_config.point[i].x) - 128) * 2, huedelta); |
| 11 | return hsv; | 11 | return hsv; |
diff --git a/quantum/rgb_matrix/animations/hue_wave_anim.h b/quantum/rgb_matrix/animations/hue_wave_anim.h index 81aa7e139e..7b729a1816 100644 --- a/quantum/rgb_matrix/animations/hue_wave_anim.h +++ b/quantum/rgb_matrix/animations/hue_wave_anim.h | |||
| @@ -5,7 +5,7 @@ RGB_MATRIX_EFFECT(HUE_WAVE) | |||
| 5 | // Change huedelta to adjust range of hue change. 0-255. | 5 | // Change huedelta to adjust range of hue change. 0-255. |
| 6 | // Looks better with a low value and slow speed for subtle change. | 6 | // Looks better with a low value and slow speed for subtle change. |
| 7 | // Hue Wave - color changes in a wave to the right | 7 | // Hue Wave - color changes in a wave to the right |
| 8 | static HSV HUE_WAVE_math(HSV hsv, uint8_t i, uint8_t time) { | 8 | static hsv_t HUE_WAVE_math(hsv_t hsv, uint8_t i, uint8_t time) { |
| 9 | uint8_t huedelta = 24; | 9 | uint8_t huedelta = 24; |
| 10 | hsv.h = hsv.h + scale8(abs8(g_led_config.point[i].x - time), huedelta); | 10 | hsv.h = hsv.h + scale8(abs8(g_led_config.point[i].x - time), huedelta); |
| 11 | return hsv; | 11 | return hsv; |
diff --git a/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h index 5d3df1059e..2b20b0706b 100644 --- a/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h +++ b/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h | |||
| @@ -4,8 +4,8 @@ RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS) | |||
| 4 | 4 | ||
| 5 | static void jellybean_raindrops_set_color(int i, effect_params_t* params) { | 5 | static void jellybean_raindrops_set_color(int i, effect_params_t* params) { |
| 6 | if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; | 6 | if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; |
| 7 | HSV hsv = {random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v}; | 7 | hsv_t hsv = {random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v}; |
| 8 | RGB rgb = rgb_matrix_hsv_to_rgb(hsv); | 8 | rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); |
| 9 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 9 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 10 | } | 10 | } |
| 11 | 11 | ||
diff --git a/quantum/rgb_matrix/animations/pixel_flow_anim.h b/quantum/rgb_matrix/animations/pixel_flow_anim.h index 27567b4f3a..35170f9588 100644 --- a/quantum/rgb_matrix/animations/pixel_flow_anim.h +++ b/quantum/rgb_matrix/animations/pixel_flow_anim.h | |||
| @@ -7,7 +7,7 @@ RGB_MATRIX_EFFECT(PIXEL_FLOW) | |||
| 7 | 7 | ||
| 8 | static bool PIXEL_FLOW(effect_params_t* params) { | 8 | static bool PIXEL_FLOW(effect_params_t* params) { |
| 9 | // LED state array | 9 | // LED state array |
| 10 | static RGB led[RGB_MATRIX_LED_COUNT]; | 10 | static rgb_t led[RGB_MATRIX_LED_COUNT]; |
| 11 | 11 | ||
| 12 | static uint32_t wait_timer = 0; | 12 | static uint32_t wait_timer = 0; |
| 13 | if (wait_timer > g_rgb_timer) { | 13 | if (wait_timer > g_rgb_timer) { |
| @@ -22,7 +22,7 @@ static bool PIXEL_FLOW(effect_params_t* params) { | |||
| 22 | // Clear LEDs and fill the state array | 22 | // Clear LEDs and fill the state array |
| 23 | rgb_matrix_set_color_all(0, 0, 0); | 23 | rgb_matrix_set_color_all(0, 0, 0); |
| 24 | for (uint8_t j = 0; j < RGB_MATRIX_LED_COUNT; ++j) { | 24 | for (uint8_t j = 0; j < RGB_MATRIX_LED_COUNT; ++j) { |
| 25 | led[j] = (random8() & 2) ? (RGB){0, 0, 0} : hsv_to_rgb((HSV){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v}); | 25 | led[j] = (random8() & 2) ? (rgb_t){0, 0, 0} : hsv_to_rgb((hsv_t){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v}); |
| 26 | } | 26 | } |
| 27 | } | 27 | } |
| 28 | 28 | ||
| @@ -39,7 +39,7 @@ static bool PIXEL_FLOW(effect_params_t* params) { | |||
| 39 | led[j] = led[j + 1]; | 39 | led[j] = led[j + 1]; |
| 40 | } | 40 | } |
| 41 | // Fill last LED | 41 | // Fill last LED |
| 42 | led[led_max - 1] = (random8() & 2) ? (RGB){0, 0, 0} : hsv_to_rgb((HSV){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v}); | 42 | led[led_max - 1] = (random8() & 2) ? (rgb_t){0, 0, 0} : hsv_to_rgb((hsv_t){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v}); |
| 43 | // Set pulse timer | 43 | // Set pulse timer |
| 44 | wait_timer = g_rgb_timer + interval(); | 44 | wait_timer = g_rgb_timer + interval(); |
| 45 | } | 45 | } |
diff --git a/quantum/rgb_matrix/animations/pixel_fractal_anim.h b/quantum/rgb_matrix/animations/pixel_fractal_anim.h index 90a75ed321..bf5c22a64e 100644 --- a/quantum/rgb_matrix/animations/pixel_fractal_anim.h +++ b/quantum/rgb_matrix/animations/pixel_fractal_anim.h | |||
| @@ -26,11 +26,11 @@ static bool PIXEL_FRACTAL(effect_params_t* params) { | |||
| 26 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 26 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
| 27 | 27 | ||
| 28 | if (g_rgb_timer > wait_timer) { | 28 | if (g_rgb_timer > wait_timer) { |
| 29 | RGB rgb = rgb_matrix_hsv_to_rgb(rgb_matrix_config.hsv); | 29 | rgb_t rgb = rgb_matrix_hsv_to_rgb(rgb_matrix_config.hsv); |
| 30 | for (uint8_t h = 0; h < MATRIX_ROWS; ++h) { | 30 | for (uint8_t h = 0; h < MATRIX_ROWS; ++h) { |
| 31 | // Light and copy columns outward | 31 | // Light and copy columns outward |
| 32 | for (uint8_t l = 0; l < MID_COL - 1; ++l) { | 32 | for (uint8_t l = 0; l < MID_COL - 1; ++l) { |
| 33 | RGB index_rgb = led[h][l] ? (RGB){rgb.r, rgb.g, rgb.b} : (RGB){0, 0, 0}; | 33 | rgb_t index_rgb = led[h][l] ? (rgb_t){rgb.r, rgb.g, rgb.b} : (rgb_t){0, 0, 0}; |
| 34 | if (HAS_ANY_FLAGS(g_led_config.flags[g_led_config.matrix_co[h][l]], params->flags)) { | 34 | if (HAS_ANY_FLAGS(g_led_config.flags[g_led_config.matrix_co[h][l]], params->flags)) { |
| 35 | rgb_matrix_set_color(g_led_config.matrix_co[h][l], index_rgb.r, index_rgb.g, index_rgb.b); | 35 | rgb_matrix_set_color(g_led_config.matrix_co[h][l], index_rgb.r, index_rgb.g, index_rgb.b); |
| 36 | } | 36 | } |
| @@ -41,7 +41,7 @@ static bool PIXEL_FRACTAL(effect_params_t* params) { | |||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | // Light both middle columns | 43 | // Light both middle columns |
| 44 | RGB index_rgb = led[h][MID_COL - 1] ? (RGB){rgb.r, rgb.g, rgb.b} : (RGB){0, 0, 0}; | 44 | rgb_t index_rgb = led[h][MID_COL - 1] ? (rgb_t){rgb.r, rgb.g, rgb.b} : (rgb_t){0, 0, 0}; |
| 45 | if (HAS_ANY_FLAGS(g_led_config.flags[g_led_config.matrix_co[h][MID_COL - 1]], params->flags)) { | 45 | if (HAS_ANY_FLAGS(g_led_config.flags[g_led_config.matrix_co[h][MID_COL - 1]], params->flags)) { |
| 46 | rgb_matrix_set_color(g_led_config.matrix_co[h][MID_COL - 1], index_rgb.r, index_rgb.g, index_rgb.b); | 46 | rgb_matrix_set_color(g_led_config.matrix_co[h][MID_COL - 1], index_rgb.r, index_rgb.g, index_rgb.b); |
| 47 | } | 47 | } |
diff --git a/quantum/rgb_matrix/animations/pixel_rain_anim.h b/quantum/rgb_matrix/animations/pixel_rain_anim.h index 26cd73b578..d7f0e3bebd 100644 --- a/quantum/rgb_matrix/animations/pixel_rain_anim.h +++ b/quantum/rgb_matrix/animations/pixel_rain_anim.h | |||
| @@ -16,8 +16,8 @@ static bool PIXEL_RAIN(effect_params_t* params) { | |||
| 16 | if (!HAS_ANY_FLAGS(g_led_config.flags[led_index], params->flags)) { | 16 | if (!HAS_ANY_FLAGS(g_led_config.flags[led_index], params->flags)) { |
| 17 | return; | 17 | return; |
| 18 | } | 18 | } |
| 19 | HSV hsv = (random8() & 2) ? (HSV){0, 0, 0} : (HSV){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v}; | 19 | hsv_t hsv = (random8() & 2) ? (hsv_t){0, 0, 0} : (hsv_t){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v}; |
| 20 | RGB rgb = rgb_matrix_hsv_to_rgb(hsv); | 20 | rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); |
| 21 | rgb_matrix_set_color(led_index, rgb.r, rgb.g, rgb.b); | 21 | rgb_matrix_set_color(led_index, rgb.r, rgb.g, rgb.b); |
| 22 | wait_timer = g_rgb_timer + interval(); | 22 | wait_timer = g_rgb_timer + interval(); |
| 23 | } | 23 | } |
diff --git a/quantum/rgb_matrix/animations/rainbow_beacon_anim.h b/quantum/rgb_matrix/animations/rainbow_beacon_anim.h index bdcca5530f..3c7d8e59d2 100644 --- a/quantum/rgb_matrix/animations/rainbow_beacon_anim.h +++ b/quantum/rgb_matrix/animations/rainbow_beacon_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(RAINBOW_BEACON) | 2 | RGB_MATRIX_EFFECT(RAINBOW_BEACON) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV RAINBOW_BEACON_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { | 5 | static hsv_t RAINBOW_BEACON_math(hsv_t hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { |
| 6 | hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 2 * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * 2 * sin) / 128; | 6 | hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 2 * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * 2 * sin) / 128; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
diff --git a/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h b/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h index f7b8f6c2f3..309ea82975 100644 --- a/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h +++ b/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(RAINBOW_MOVING_CHEVRON) | 2 | RGB_MATRIX_EFFECT(RAINBOW_MOVING_CHEVRON) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV RAINBOW_MOVING_CHEVRON_math(HSV hsv, uint8_t i, uint8_t time) { | 5 | static hsv_t RAINBOW_MOVING_CHEVRON_math(hsv_t hsv, uint8_t i, uint8_t time) { |
| 6 | hsv.h += abs8(g_led_config.point[i].y - k_rgb_matrix_center.y) + (g_led_config.point[i].x - time); | 6 | hsv.h += abs8(g_led_config.point[i].y - k_rgb_matrix_center.y) + (g_led_config.point[i].x - time); |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
diff --git a/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h b/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h index 91e31ea8cc..5d2558d492 100644 --- a/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h +++ b/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | RGB_MATRIX_EFFECT(RAINBOW_PINWHEELS) | 2 | RGB_MATRIX_EFFECT(RAINBOW_PINWHEELS) |
| 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 4 | 4 | ||
| 5 | static HSV RAINBOW_PINWHEELS_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { | 5 | static hsv_t RAINBOW_PINWHEELS_math(hsv_t hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { |
| 6 | hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 3 * cos + (56 - abs8(g_led_config.point[i].x - k_rgb_matrix_center.x)) * 3 * sin) / 128; | 6 | hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 3 * cos + (56 - abs8(g_led_config.point[i].x - k_rgb_matrix_center.x)) * 3 * sin) / 128; |
| 7 | return hsv; | 7 | return hsv; |
| 8 | } | 8 | } |
diff --git a/quantum/rgb_matrix/animations/raindrops_anim.h b/quantum/rgb_matrix/animations/raindrops_anim.h index e8e1f6de04..a682156da2 100644 --- a/quantum/rgb_matrix/animations/raindrops_anim.h +++ b/quantum/rgb_matrix/animations/raindrops_anim.h | |||
| @@ -4,7 +4,7 @@ RGB_MATRIX_EFFECT(RAINDROPS) | |||
| 4 | 4 | ||
| 5 | static void raindrops_set_color(int i, effect_params_t* params) { | 5 | static void raindrops_set_color(int i, effect_params_t* params) { |
| 6 | if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; | 6 | if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; |
| 7 | HSV hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; | 7 | hsv_t hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; |
| 8 | 8 | ||
| 9 | // Take the shortest path between hues | 9 | // Take the shortest path between hues |
| 10 | int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4; | 10 | int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4; |
| @@ -14,8 +14,8 @@ static void raindrops_set_color(int i, effect_params_t* params) { | |||
| 14 | deltaH += 256; | 14 | deltaH += 256; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | hsv.h = rgb_matrix_config.hsv.h + (deltaH * (random8() & 0x03)); | 17 | hsv.h = rgb_matrix_config.hsv.h + (deltaH * (random8() & 0x03)); |
| 18 | RGB rgb = rgb_matrix_hsv_to_rgb(hsv); | 18 | rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); |
| 19 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 19 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 20 | } | 20 | } |
| 21 | 21 | ||
diff --git a/quantum/rgb_matrix/animations/riverflow_anim.h b/quantum/rgb_matrix/animations/riverflow_anim.h index 195d15986d..737735fe83 100644 --- a/quantum/rgb_matrix/animations/riverflow_anim.h +++ b/quantum/rgb_matrix/animations/riverflow_anim.h | |||
| @@ -8,10 +8,10 @@ bool RIVERFLOW(effect_params_t* params) { | |||
| 8 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 8 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
| 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 | HSV hsv = rgb_matrix_config.hsv; | 11 | hsv_t hsv = rgb_matrix_config.hsv; |
| 12 | uint16_t time = scale16by8(g_rgb_timer + (i * 315), rgb_matrix_config.speed / 8); | 12 | uint16_t time = scale16by8(g_rgb_timer + (i * 315), rgb_matrix_config.speed / 8); |
| 13 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); | 13 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); |
| 14 | RGB rgb = rgb_matrix_hsv_to_rgb(hsv); | 14 | rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); |
| 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 | 17 | ||
diff --git a/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy.h b/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy.h index 2ad0f22c28..d43f1c0d70 100644 --- a/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy.h +++ b/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | 2 | ||
| 3 | typedef HSV (*dx_dy_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t time); | 3 | typedef hsv_t (*dx_dy_f)(hsv_t hsv, int16_t dx, int16_t dy, uint8_t time); |
| 4 | 4 | ||
| 5 | bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) { | 5 | bool 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); |
| @@ -10,7 +10,7 @@ bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) { | |||
| 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 = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time)); | 13 | rgb_t rgb = rgb_matrix_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 rgb_matrix_check_finished_leds(led_max); | 16 | return rgb_matrix_check_finished_leds(led_max); |
diff --git a/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy_dist.h b/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy_dist.h index bcae7c79b6..29fa42a0ed 100644 --- a/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy_dist.h +++ b/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy_dist.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | 2 | ||
| 3 | typedef HSV (*dx_dy_dist_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time); | 3 | typedef hsv_t (*dx_dy_dist_f)(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time); |
| 4 | 4 | ||
| 5 | bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func) { | 5 | bool 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); |
| @@ -11,7 +11,7 @@ bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func) | |||
| 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 = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, dist, time)); | 14 | rgb_t rgb = rgb_matrix_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 rgb_matrix_check_finished_leds(led_max); | 17 | return rgb_matrix_check_finished_leds(led_max); |
diff --git a/quantum/rgb_matrix/animations/runners/effect_runner_i.h b/quantum/rgb_matrix/animations/runners/effect_runner_i.h index b4de2992b6..670fd83ebe 100644 --- a/quantum/rgb_matrix/animations/runners/effect_runner_i.h +++ b/quantum/rgb_matrix/animations/runners/effect_runner_i.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | 2 | ||
| 3 | typedef HSV (*i_f)(HSV hsv, uint8_t i, uint8_t time); | 3 | typedef hsv_t (*i_f)(hsv_t hsv, uint8_t i, uint8_t time); |
| 4 | 4 | ||
| 5 | bool effect_runner_i(effect_params_t* params, i_f effect_func) { | 5 | bool 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); |
| @@ -8,7 +8,7 @@ bool effect_runner_i(effect_params_t* params, i_f effect_func) { | |||
| 8 | uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 4, 1)); | 8 | uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 4, 1)); |
| 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 = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); | 11 | rgb_t rgb = rgb_matrix_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 rgb_matrix_check_finished_leds(led_max); | 14 | return rgb_matrix_check_finished_leds(led_max); |
diff --git a/quantum/rgb_matrix/animations/runners/effect_runner_reactive.h b/quantum/rgb_matrix/animations/runners/effect_runner_reactive.h index f9584d7071..958db170ae 100644 --- a/quantum/rgb_matrix/animations/runners/effect_runner_reactive.h +++ b/quantum/rgb_matrix/animations/runners/effect_runner_reactive.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 3 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| 4 | 4 | ||
| 5 | typedef HSV (*reactive_f)(HSV hsv, uint16_t offset); | 5 | typedef hsv_t (*reactive_f)(hsv_t hsv, uint16_t offset); |
| 6 | 6 | ||
| 7 | bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) { | 7 | bool 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); |
| @@ -20,7 +20,7 @@ bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) { | |||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | uint16_t offset = scale16by8(tick, qadd8(rgb_matrix_config.speed, 1)); | 22 | uint16_t offset = scale16by8(tick, qadd8(rgb_matrix_config.speed, 1)); |
| 23 | RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, offset)); | 23 | rgb_t rgb = rgb_matrix_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 rgb_matrix_check_finished_leds(led_max); | 26 | return rgb_matrix_check_finished_leds(led_max); |
diff --git a/quantum/rgb_matrix/animations/runners/effect_runner_reactive_splash.h b/quantum/rgb_matrix/animations/runners/effect_runner_reactive_splash.h index 41020eb47f..2e18491450 100644 --- a/quantum/rgb_matrix/animations/runners/effect_runner_reactive_splash.h +++ b/quantum/rgb_matrix/animations/runners/effect_runner_reactive_splash.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 3 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| 4 | 4 | ||
| 5 | typedef HSV (*reactive_splash_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick); | 5 | typedef hsv_t (*reactive_splash_f)(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick); |
| 6 | 6 | ||
| 7 | bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, reactive_splash_f effect_func) { | 7 | bool 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); |
| @@ -10,8 +10,8 @@ bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, react | |||
| 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_t 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]; |
| @@ -19,8 +19,8 @@ bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, react | |||
| 19 | uint16_t tick = scale16by8(g_last_hit_tracker.tick[j], qadd8(rgb_matrix_config.speed, 1)); | 19 | uint16_t tick = scale16by8(g_last_hit_tracker.tick[j], qadd8(rgb_matrix_config.speed, 1)); |
| 20 | hsv = effect_func(hsv, dx, dy, dist, tick); | 20 | hsv = effect_func(hsv, dx, dy, dist, tick); |
| 21 | } | 21 | } |
| 22 | hsv.v = scale8(hsv.v, rgb_matrix_config.hsv.v); | 22 | hsv.v = scale8(hsv.v, rgb_matrix_config.hsv.v); |
| 23 | RGB rgb = rgb_matrix_hsv_to_rgb(hsv); | 23 | rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); |
| 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 rgb_matrix_check_finished_leds(led_max); | 26 | return rgb_matrix_check_finished_leds(led_max); |
diff --git a/quantum/rgb_matrix/animations/runners/effect_runner_sin_cos_i.h b/quantum/rgb_matrix/animations/runners/effect_runner_sin_cos_i.h index 7776491d51..b96530aa5f 100644 --- a/quantum/rgb_matrix/animations/runners/effect_runner_sin_cos_i.h +++ b/quantum/rgb_matrix/animations/runners/effect_runner_sin_cos_i.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | 2 | ||
| 3 | typedef HSV (*sin_cos_i_f)(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time); | 3 | typedef hsv_t (*sin_cos_i_f)(hsv_t hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time); |
| 4 | 4 | ||
| 5 | bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) { | 5 | bool 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); |
| @@ -10,7 +10,7 @@ bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) { | |||
| 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 = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time)); | 13 | rgb_t rgb = rgb_matrix_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 rgb_matrix_check_finished_leds(led_max); | 16 | return rgb_matrix_check_finished_leds(led_max); |
diff --git a/quantum/rgb_matrix/animations/solid_color_anim.h b/quantum/rgb_matrix/animations/solid_color_anim.h index c8762dcbc2..82b0007df9 100644 --- a/quantum/rgb_matrix/animations/solid_color_anim.h +++ b/quantum/rgb_matrix/animations/solid_color_anim.h | |||
| @@ -4,7 +4,7 @@ RGB_MATRIX_EFFECT(SOLID_COLOR) | |||
| 4 | bool SOLID_COLOR(effect_params_t* params) { | 4 | bool SOLID_COLOR(effect_params_t* params) { |
| 5 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | 5 | RGB_MATRIX_USE_LIMITS(led_min, led_max); |
| 6 | 6 | ||
| 7 | RGB rgb = rgb_matrix_hsv_to_rgb(rgb_matrix_config.hsv); | 7 | rgb_t rgb = rgb_matrix_hsv_to_rgb(rgb_matrix_config.hsv); |
| 8 | for (uint8_t i = led_min; i < led_max; i++) { | 8 | for (uint8_t i = led_min; i < led_max; i++) { |
| 9 | RGB_MATRIX_TEST_LED_FLAGS(); | 9 | RGB_MATRIX_TEST_LED_FLAGS(); |
| 10 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 10 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
diff --git a/quantum/rgb_matrix/animations/solid_reactive_anim.h b/quantum/rgb_matrix/animations/solid_reactive_anim.h index e18ffb5f2b..67f568ca38 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_anim.h +++ b/quantum/rgb_matrix/animations/solid_reactive_anim.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | RGB_MATRIX_EFFECT(SOLID_REACTIVE) | 3 | RGB_MATRIX_EFFECT(SOLID_REACTIVE) |
| 4 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 4 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 5 | 5 | ||
| 6 | static HSV SOLID_REACTIVE_math(HSV hsv, uint16_t offset) { | 6 | static hsv_t SOLID_REACTIVE_math(hsv_t hsv, uint16_t offset) { |
| 7 | # ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE | 7 | # ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE |
| 8 | hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); | 8 | hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); |
| 9 | # endif | 9 | # endif |
diff --git a/quantum/rgb_matrix/animations/solid_reactive_cross.h b/quantum/rgb_matrix/animations/solid_reactive_cross.h index a18d6b03dd..e52a7d8481 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_cross.h +++ b/quantum/rgb_matrix/animations/solid_reactive_cross.h | |||
| @@ -11,7 +11,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS) | |||
| 11 | 11 | ||
| 12 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 13 | 13 | ||
| 14 | static HSV SOLID_REACTIVE_CROSS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { | 14 | static hsv_t SOLID_REACTIVE_CROSS_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { |
| 15 | uint16_t effect = tick + dist; | 15 | uint16_t effect = tick + dist; |
| 16 | dx = dx < 0 ? dx * -1 : dx; | 16 | dx = dx < 0 ? dx * -1 : dx; |
| 17 | dy = dy < 0 ? dy * -1 : dy; | 17 | dy = dy < 0 ? dy * -1 : dy; |
diff --git a/quantum/rgb_matrix/animations/solid_reactive_nexus.h b/quantum/rgb_matrix/animations/solid_reactive_nexus.h index 53cc008616..471a2682ca 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_nexus.h +++ b/quantum/rgb_matrix/animations/solid_reactive_nexus.h | |||
| @@ -11,7 +11,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS) | |||
| 11 | 11 | ||
| 12 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 13 | 13 | ||
| 14 | static HSV SOLID_REACTIVE_NEXUS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { | 14 | static hsv_t SOLID_REACTIVE_NEXUS_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { |
| 15 | uint16_t effect = tick - dist; | 15 | uint16_t effect = tick - dist; |
| 16 | if (effect > 255) effect = 255; | 16 | if (effect > 255) effect = 255; |
| 17 | if (dist > 72) effect = 255; | 17 | if (dist > 72) effect = 255; |
diff --git a/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h b/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h index 7f4e48747a..f20f1b1fb6 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h +++ b/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | RGB_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE) | 3 | RGB_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE) |
| 4 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 4 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 5 | 5 | ||
| 6 | static HSV SOLID_REACTIVE_SIMPLE_math(HSV hsv, uint16_t offset) { | 6 | static hsv_t SOLID_REACTIVE_SIMPLE_math(hsv_t hsv, uint16_t offset) { |
| 7 | # ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE | 7 | # ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE |
| 8 | hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); | 8 | hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4); |
| 9 | # endif | 9 | # endif |
diff --git a/quantum/rgb_matrix/animations/solid_reactive_wide.h b/quantum/rgb_matrix/animations/solid_reactive_wide.h index feca126648..b780c13d27 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_wide.h +++ b/quantum/rgb_matrix/animations/solid_reactive_wide.h | |||
| @@ -11,7 +11,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE) | |||
| 11 | 11 | ||
| 12 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 13 | 13 | ||
| 14 | static HSV SOLID_REACTIVE_WIDE_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { | 14 | static hsv_t SOLID_REACTIVE_WIDE_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { |
| 15 | uint16_t effect = tick + dist * 5; | 15 | uint16_t effect = tick + dist * 5; |
| 16 | if (effect > 255) effect = 255; | 16 | if (effect > 255) effect = 255; |
| 17 | # ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE | 17 | # ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE |
diff --git a/quantum/rgb_matrix/animations/solid_splash_anim.h b/quantum/rgb_matrix/animations/solid_splash_anim.h index 77d6f8c5eb..839ab05b38 100644 --- a/quantum/rgb_matrix/animations/solid_splash_anim.h +++ b/quantum/rgb_matrix/animations/solid_splash_anim.h | |||
| @@ -11,7 +11,7 @@ RGB_MATRIX_EFFECT(SOLID_MULTISPLASH) | |||
| 11 | 11 | ||
| 12 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 13 | 13 | ||
| 14 | HSV SOLID_SPLASH_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { | 14 | hsv_t SOLID_SPLASH_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { |
| 15 | uint16_t effect = tick - dist; | 15 | uint16_t effect = tick - dist; |
| 16 | if (effect > 255) effect = 255; | 16 | if (effect > 255) effect = 255; |
| 17 | hsv.v = qadd8(hsv.v, 255 - effect); | 17 | hsv.v = qadd8(hsv.v, 255 - effect); |
diff --git a/quantum/rgb_matrix/animations/splash_anim.h b/quantum/rgb_matrix/animations/splash_anim.h index 06459e1b0a..a28cadb9f4 100644 --- a/quantum/rgb_matrix/animations/splash_anim.h +++ b/quantum/rgb_matrix/animations/splash_anim.h | |||
| @@ -11,7 +11,7 @@ RGB_MATRIX_EFFECT(MULTISPLASH) | |||
| 11 | 11 | ||
| 12 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | 12 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS |
| 13 | 13 | ||
| 14 | HSV SPLASH_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { | 14 | hsv_t SPLASH_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { |
| 15 | uint16_t effect = tick - dist; | 15 | uint16_t effect = tick - dist; |
| 16 | if (effect > 255) effect = 255; | 16 | if (effect > 255) effect = 255; |
| 17 | hsv.h += effect; | 17 | hsv.h += effect; |
diff --git a/quantum/rgb_matrix/animations/starlight_anim.h b/quantum/rgb_matrix/animations/starlight_anim.h index 91626a4663..742e843b57 100644 --- a/quantum/rgb_matrix/animations/starlight_anim.h +++ b/quantum/rgb_matrix/animations/starlight_anim.h | |||
| @@ -4,9 +4,9 @@ RGB_MATRIX_EFFECT(STARLIGHT) | |||
| 4 | 4 | ||
| 5 | void set_starlight_color(uint8_t i, effect_params_t* params) { | 5 | void set_starlight_color(uint8_t i, effect_params_t* params) { |
| 6 | uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); | 6 | uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); |
| 7 | HSV hsv = rgb_matrix_config.hsv; | 7 | hsv_t hsv = rgb_matrix_config.hsv; |
| 8 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); | 8 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); |
| 9 | RGB rgb = rgb_matrix_hsv_to_rgb(hsv); | 9 | rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); |
| 10 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 10 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 11 | } | 11 | } |
| 12 | 12 | ||
diff --git a/quantum/rgb_matrix/animations/starlight_dual_hue_anim.h b/quantum/rgb_matrix/animations/starlight_dual_hue_anim.h index 5ef831476f..50ce5d6ab4 100644 --- a/quantum/rgb_matrix/animations/starlight_dual_hue_anim.h +++ b/quantum/rgb_matrix/animations/starlight_dual_hue_anim.h | |||
| @@ -4,10 +4,10 @@ RGB_MATRIX_EFFECT(STARLIGHT_DUAL_HUE) | |||
| 4 | 4 | ||
| 5 | void set_starlight_dual_hue_color(uint8_t i, effect_params_t* params) { | 5 | void set_starlight_dual_hue_color(uint8_t i, effect_params_t* params) { |
| 6 | uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); | 6 | uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); |
| 7 | HSV hsv = rgb_matrix_config.hsv; | 7 | hsv_t hsv = rgb_matrix_config.hsv; |
| 8 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); | 8 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); |
| 9 | hsv.h = hsv.h + random8_max((30 + 1 - -30) + -30); | 9 | hsv.h = hsv.h + random8_max((30 + 1 - -30) + -30); |
| 10 | RGB rgb = rgb_matrix_hsv_to_rgb(hsv); | 10 | rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); |
| 11 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 11 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 12 | } | 12 | } |
| 13 | 13 | ||
diff --git a/quantum/rgb_matrix/animations/starlight_dual_sat_anim.h b/quantum/rgb_matrix/animations/starlight_dual_sat_anim.h index 1994aba8a8..6def4eea09 100644 --- a/quantum/rgb_matrix/animations/starlight_dual_sat_anim.h +++ b/quantum/rgb_matrix/animations/starlight_dual_sat_anim.h | |||
| @@ -4,10 +4,10 @@ RGB_MATRIX_EFFECT(STARLIGHT_DUAL_SAT) | |||
| 4 | 4 | ||
| 5 | void set_starlight_dual_sat_color(uint8_t i, effect_params_t* params) { | 5 | void set_starlight_dual_sat_color(uint8_t i, effect_params_t* params) { |
| 6 | uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); | 6 | uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); |
| 7 | HSV hsv = rgb_matrix_config.hsv; | 7 | hsv_t hsv = rgb_matrix_config.hsv; |
| 8 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); | 8 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); |
| 9 | hsv.s = hsv.s + random8_max((30 + 1 - -30) + -30); | 9 | hsv.s = hsv.s + random8_max((30 + 1 - -30) + -30); |
| 10 | RGB rgb = rgb_matrix_hsv_to_rgb(hsv); | 10 | rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); |
| 11 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | 11 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); |
| 12 | } | 12 | } |
| 13 | 13 | ||
diff --git a/quantum/rgb_matrix/animations/typing_heatmap_anim.h b/quantum/rgb_matrix/animations/typing_heatmap_anim.h index d09bdc4631..0606738891 100644 --- a/quantum/rgb_matrix/animations/typing_heatmap_anim.h +++ b/quantum/rgb_matrix/animations/typing_heatmap_anim.h | |||
| @@ -82,8 +82,8 @@ bool TYPING_HEATMAP(effect_params_t* params) { | |||
| 82 | uint8_t val = g_rgb_frame_buffer[row][col]; | 82 | uint8_t val = g_rgb_frame_buffer[row][col]; |
| 83 | if (!HAS_ANY_FLAGS(g_led_config.flags[g_led_config.matrix_co[row][col]], params->flags)) continue; | 83 | if (!HAS_ANY_FLAGS(g_led_config.flags[g_led_config.matrix_co[row][col]], params->flags)) continue; |
| 84 | 84 | ||
| 85 | HSV hsv = {170 - qsub8(val, 85), rgb_matrix_config.hsv.s, scale8((qadd8(170, val) - 170) * 3, rgb_matrix_config.hsv.v)}; | 85 | hsv_t hsv = {170 - qsub8(val, 85), rgb_matrix_config.hsv.s, scale8((qadd8(170, val) - 170) * 3, rgb_matrix_config.hsv.v)}; |
| 86 | RGB rgb = rgb_matrix_hsv_to_rgb(hsv); | 86 | rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); |
| 87 | rgb_matrix_set_color(g_led_config.matrix_co[row][col], rgb.r, rgb.g, rgb.b); | 87 | rgb_matrix_set_color(g_led_config.matrix_co[row][col], rgb.r, rgb.g, rgb.b); |
| 88 | 88 | ||
| 89 | if (decrease_heatmap_values) { | 89 | if (decrease_heatmap_values) { |
diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c index 47bba278e4..484d177546 100644 --- a/quantum/rgb_matrix/rgb_matrix.c +++ b/quantum/rgb_matrix/rgb_matrix.c | |||
| @@ -35,7 +35,7 @@ const led_point_t k_rgb_matrix_center = {112, 32}; | |||
| 35 | const led_point_t k_rgb_matrix_center = RGB_MATRIX_CENTER; | 35 | const led_point_t k_rgb_matrix_center = RGB_MATRIX_CENTER; |
| 36 | #endif | 36 | #endif |
| 37 | 37 | ||
| 38 | __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { | 38 | __attribute__((weak)) rgb_t rgb_matrix_hsv_to_rgb(hsv_t hsv) { |
| 39 | return hsv_to_rgb(hsv); | 39 | return hsv_to_rgb(hsv); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| @@ -98,7 +98,7 @@ void eeconfig_update_rgb_matrix_default(void) { | |||
| 98 | dprintf("eeconfig_update_rgb_matrix_default\n"); | 98 | dprintf("eeconfig_update_rgb_matrix_default\n"); |
| 99 | rgb_matrix_config.enable = RGB_MATRIX_DEFAULT_ON; | 99 | rgb_matrix_config.enable = RGB_MATRIX_DEFAULT_ON; |
| 100 | rgb_matrix_config.mode = RGB_MATRIX_DEFAULT_MODE; | 100 | rgb_matrix_config.mode = RGB_MATRIX_DEFAULT_MODE; |
| 101 | rgb_matrix_config.hsv = (HSV){RGB_MATRIX_DEFAULT_HUE, RGB_MATRIX_DEFAULT_SAT, RGB_MATRIX_DEFAULT_VAL}; | 101 | rgb_matrix_config.hsv = (hsv_t){RGB_MATRIX_DEFAULT_HUE, RGB_MATRIX_DEFAULT_SAT, RGB_MATRIX_DEFAULT_VAL}; |
| 102 | rgb_matrix_config.speed = RGB_MATRIX_DEFAULT_SPD; | 102 | rgb_matrix_config.speed = RGB_MATRIX_DEFAULT_SPD; |
| 103 | rgb_matrix_config.flags = RGB_MATRIX_DEFAULT_FLAGS; | 103 | rgb_matrix_config.flags = RGB_MATRIX_DEFAULT_FLAGS; |
| 104 | eeconfig_flush_rgb_matrix(true); | 104 | eeconfig_flush_rgb_matrix(true); |
| @@ -591,7 +591,7 @@ void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val) { | |||
| 591 | rgb_matrix_sethsv_eeprom_helper(hue, sat, val, true); | 591 | rgb_matrix_sethsv_eeprom_helper(hue, sat, val, true); |
| 592 | } | 592 | } |
| 593 | 593 | ||
| 594 | HSV rgb_matrix_get_hsv(void) { | 594 | hsv_t rgb_matrix_get_hsv(void) { |
| 595 | return rgb_matrix_config.hsv; | 595 | return rgb_matrix_config.hsv; |
| 596 | } | 596 | } |
| 597 | uint8_t rgb_matrix_get_hue(void) { | 597 | uint8_t rgb_matrix_get_hue(void) { |
diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h index a1115a721e..842a60c8b7 100644 --- a/quantum/rgb_matrix/rgb_matrix.h +++ b/quantum/rgb_matrix/rgb_matrix.h | |||
| @@ -186,7 +186,7 @@ void rgb_matrix_step_reverse(void); | |||
| 186 | void rgb_matrix_step_reverse_noeeprom(void); | 186 | void rgb_matrix_step_reverse_noeeprom(void); |
| 187 | void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val); | 187 | void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val); |
| 188 | void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val); | 188 | void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val); |
| 189 | HSV rgb_matrix_get_hsv(void); | 189 | hsv_t rgb_matrix_get_hsv(void); |
| 190 | uint8_t rgb_matrix_get_hue(void); | 190 | uint8_t rgb_matrix_get_hue(void); |
| 191 | uint8_t rgb_matrix_get_sat(void); | 191 | uint8_t rgb_matrix_get_sat(void); |
| 192 | uint8_t rgb_matrix_get_val(void); | 192 | uint8_t rgb_matrix_get_val(void); |
diff --git a/quantum/rgb_matrix/rgb_matrix_types.h b/quantum/rgb_matrix/rgb_matrix_types.h index 0a3fd7cc0d..0834a7067c 100644 --- a/quantum/rgb_matrix/rgb_matrix_types.h +++ b/quantum/rgb_matrix/rgb_matrix_types.h | |||
| @@ -78,7 +78,7 @@ typedef union { | |||
| 78 | struct PACKED { | 78 | struct PACKED { |
| 79 | uint8_t enable : 2; | 79 | uint8_t enable : 2; |
| 80 | uint8_t mode : 6; | 80 | uint8_t mode : 6; |
| 81 | HSV hsv; | 81 | hsv_t hsv; |
| 82 | uint8_t speed; | 82 | uint8_t speed; |
| 83 | led_flags_t flags; | 83 | led_flags_t flags; |
| 84 | }; | 84 | }; |
diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c index e16fb99c3b..6426ccf2c8 100644 --- a/quantum/rgblight/rgblight.c +++ b/quantum/rgblight/rgblight.c | |||
| @@ -136,7 +136,7 @@ void rgblight_set_effect_range(uint8_t start_pos, uint8_t num_leds) { | |||
| 136 | rgblight_ranges.effect_num_leds = num_leds; | 136 | rgblight_ranges.effect_num_leds = num_leds; |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | __attribute__((weak)) RGB rgblight_hsv_to_rgb(HSV hsv) { | 139 | __attribute__((weak)) rgb_t rgblight_hsv_to_rgb(hsv_t hsv) { |
| 140 | return hsv_to_rgb(hsv); | 140 | return hsv_to_rgb(hsv); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| @@ -153,8 +153,8 @@ void setrgb(uint8_t r, uint8_t g, uint8_t b, int index) { | |||
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, int index) { | 155 | void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, int index) { |
| 156 | HSV hsv = {hue, sat, val}; | 156 | hsv_t hsv = {hue, sat, val}; |
| 157 | RGB rgb = rgblight_hsv_to_rgb(hsv); | 157 | rgb_t rgb = rgblight_hsv_to_rgb(hsv); |
| 158 | setrgb(rgb.r, rgb.g, rgb.b, index); | 158 | setrgb(rgb.r, rgb.g, rgb.b, index); |
| 159 | } | 159 | } |
| 160 | 160 | ||
| @@ -513,7 +513,7 @@ void rgblight_decrease_speed_noeeprom(void) { | |||
| 513 | 513 | ||
| 514 | void rgblight_sethsv_noeeprom_old(uint8_t hue, uint8_t sat, uint8_t val) { | 514 | void rgblight_sethsv_noeeprom_old(uint8_t hue, uint8_t sat, uint8_t val) { |
| 515 | if (rgblight_config.enable) { | 515 | if (rgblight_config.enable) { |
| 516 | RGB rgb = hsv_to_rgb((HSV){hue, sat, val > RGBLIGHT_LIMIT_VAL ? RGBLIGHT_LIMIT_VAL : val}); | 516 | rgb_t rgb = hsv_to_rgb((hsv_t){hue, sat, val > RGBLIGHT_LIMIT_VAL ? RGBLIGHT_LIMIT_VAL : val}); |
| 517 | rgblight_setrgb(rgb.r, rgb.g, rgb.b); | 517 | rgblight_setrgb(rgb.r, rgb.g, rgb.b); |
| 518 | } | 518 | } |
| 519 | } | 519 | } |
| @@ -532,7 +532,7 @@ void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool w | |||
| 532 | // needed for rgblight_layers_write() to get the new val, since it reads rgblight_config.val | 532 | // needed for rgblight_layers_write() to get the new val, since it reads rgblight_config.val |
| 533 | rgblight_config.val = val; | 533 | rgblight_config.val = val; |
| 534 | #endif | 534 | #endif |
| 535 | RGB rgb = hsv_to_rgb((HSV){hue, sat, val > RGBLIGHT_LIMIT_VAL ? RGBLIGHT_LIMIT_VAL : val}); | 535 | rgb_t rgb = hsv_to_rgb((hsv_t){hue, sat, val > RGBLIGHT_LIMIT_VAL ? RGBLIGHT_LIMIT_VAL : val}); |
| 536 | rgblight_setrgb(rgb.r, rgb.g, rgb.b); | 536 | rgblight_setrgb(rgb.r, rgb.g, rgb.b); |
| 537 | } else { | 537 | } else { |
| 538 | // all LEDs in same color | 538 | // all LEDs in same color |
| @@ -635,8 +635,8 @@ uint8_t rgblight_get_val(void) { | |||
| 635 | return rgblight_config.val; | 635 | return rgblight_config.val; |
| 636 | } | 636 | } |
| 637 | 637 | ||
| 638 | HSV rgblight_get_hsv(void) { | 638 | hsv_t rgblight_get_hsv(void) { |
| 639 | return (HSV){rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; | 639 | return (hsv_t){rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; |
| 640 | } | 640 | } |
| 641 | 641 | ||
| 642 | void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { | 642 | void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { |
| @@ -664,7 +664,7 @@ void rgblight_sethsv_at(uint8_t hue, uint8_t sat, uint8_t val, uint8_t index) { | |||
| 664 | return; | 664 | return; |
| 665 | } | 665 | } |
| 666 | 666 | ||
| 667 | RGB rgb = hsv_to_rgb((HSV){hue, sat, val > RGBLIGHT_LIMIT_VAL ? RGBLIGHT_LIMIT_VAL : val}); | 667 | rgb_t rgb = hsv_to_rgb((hsv_t){hue, sat, val > RGBLIGHT_LIMIT_VAL ? RGBLIGHT_LIMIT_VAL : val}); |
| 668 | rgblight_setrgb_at(rgb.r, rgb.g, rgb.b, index); | 668 | rgblight_setrgb_at(rgb.r, rgb.g, rgb.b, index); |
| 669 | } | 669 | } |
| 670 | 670 | ||
| @@ -696,7 +696,7 @@ void rgblight_sethsv_range(uint8_t hue, uint8_t sat, uint8_t val, uint8_t start, | |||
| 696 | return; | 696 | return; |
| 697 | } | 697 | } |
| 698 | 698 | ||
| 699 | RGB rgb = hsv_to_rgb((HSV){hue, sat, val > RGBLIGHT_LIMIT_VAL ? RGBLIGHT_LIMIT_VAL : val}); | 699 | rgb_t rgb = hsv_to_rgb((hsv_t){hue, sat, val > RGBLIGHT_LIMIT_VAL ? RGBLIGHT_LIMIT_VAL : val}); |
| 700 | rgblight_setrgb_range(rgb.r, rgb.g, rgb.b, start, end); | 700 | rgblight_setrgb_range(rgb.r, rgb.g, rgb.b, start, end); |
| 701 | } | 701 | } |
| 702 | 702 | ||
| @@ -1348,8 +1348,8 @@ void rgblight_effect_rgbtest(animation_status_t *anim) { | |||
| 1348 | uint8_t b; | 1348 | uint8_t b; |
| 1349 | 1349 | ||
| 1350 | if (maxval == 0) { | 1350 | if (maxval == 0) { |
| 1351 | RGB rgb = hsv_to_rgb((HSV){0, 255, RGBLIGHT_LIMIT_VAL}); | 1351 | rgb_t rgb = hsv_to_rgb((hsv_t){0, 255, RGBLIGHT_LIMIT_VAL}); |
| 1352 | maxval = rgb.r; | 1352 | maxval = rgb.r; |
| 1353 | } | 1353 | } |
| 1354 | g = r = b = 0; | 1354 | g = r = b = 0; |
| 1355 | switch (anim->pos) { | 1355 | switch (anim->pos) { |
| @@ -1388,7 +1388,7 @@ void rgblight_effect_alternating(animation_status_t *anim) { | |||
| 1388 | __attribute__((weak)) const uint8_t RGBLED_TWINKLE_INTERVALS[] PROGMEM = {30, 15, 5}; | 1388 | __attribute__((weak)) const uint8_t RGBLED_TWINKLE_INTERVALS[] PROGMEM = {30, 15, 5}; |
| 1389 | 1389 | ||
| 1390 | typedef struct PACKED { | 1390 | typedef struct PACKED { |
| 1391 | HSV hsv; | 1391 | hsv_t hsv; |
| 1392 | uint8_t life; | 1392 | uint8_t life; |
| 1393 | uint8_t max_life; | 1393 | uint8_t max_life; |
| 1394 | } TwinkleState; | 1394 | } TwinkleState; |
| @@ -1414,7 +1414,7 @@ void rgblight_effect_twinkle(animation_status_t *anim) { | |||
| 1414 | 1414 | ||
| 1415 | for (uint8_t i = 0; i < rgblight_ranges.effect_num_leds; i++) { | 1415 | for (uint8_t i = 0; i < rgblight_ranges.effect_num_leds; i++) { |
| 1416 | TwinkleState *t = &(led_twinkle_state[i]); | 1416 | TwinkleState *t = &(led_twinkle_state[i]); |
| 1417 | HSV * c = &(t->hsv); | 1417 | hsv_t * c = &(t->hsv); |
| 1418 | 1418 | ||
| 1419 | if (!random_color) { | 1419 | if (!random_color) { |
| 1420 | c->h = rgblight_config.hue; | 1420 | c->h = rgblight_config.hue; |
diff --git a/quantum/rgblight/rgblight.h b/quantum/rgblight/rgblight.h index 7c23805129..f4b6e621e4 100644 --- a/quantum/rgblight/rgblight.h +++ b/quantum/rgblight/rgblight.h | |||
| @@ -362,7 +362,7 @@ uint8_t rgblight_get_hue(void); | |||
| 362 | uint8_t rgblight_get_sat(void); | 362 | uint8_t rgblight_get_sat(void); |
| 363 | uint8_t rgblight_get_val(void); | 363 | uint8_t rgblight_get_val(void); |
| 364 | bool rgblight_is_enabled(void); | 364 | bool rgblight_is_enabled(void); |
| 365 | HSV rgblight_get_hsv(void); | 365 | hsv_t rgblight_get_hsv(void); |
| 366 | 366 | ||
| 367 | /* === qmk_firmware (core)internal Functions === */ | 367 | /* === qmk_firmware (core)internal Functions === */ |
| 368 | void rgblight_init(void); | 368 | void rgblight_init(void); |
