From 9884e4982be942a98cf5bca9360d20cc3fca3e9d Mon Sep 17 00:00:00 2001 From: Ryan Date: Sun, 13 Oct 2024 05:00:56 +1100 Subject: [PATCH] Rename RGB/HSV structs: keyboard-level code (#24476) --- docs/features/rgb_matrix.md | 12 +-- keyboards/1k/keymaps/default/rgblite.h | 4 +- keyboards/bandominedoni/rgb_matrix_kb.inc | 4 +- keyboards/bastardkb/dilemma/3x5_3/3x5_3.c | 18 ++-- keyboards/chromatonemini/rgb_matrix_kb.inc | 10 +-- keyboards/cipulot/ec_980c/ec_980c.c | 12 +-- keyboards/gopolar/gg86/gg86.c | 4 +- .../devil68_pro/keymaps/default/keymap.c | 4 +- .../keymaps/default/keymap_stuff.h | 14 +-- .../keymaps/default/led/cool_diagonal.c | 2 +- .../keymaps/default/led/custom_gradient.c | 14 +-- .../led/flower_blooming/flower_blooming.c | 2 +- .../led/flower_blooming/flower_blooming.h | 6 +- .../handwired_k552/keymaps/default/led/kitt.c | 2 +- .../default/led/random_breath_rainbow.c | 4 +- .../nyx/rev1/lib/startup_swirl_anim.h | 10 +-- keyboards/hs60/v1/v1.c | 2 +- keyboards/inland/kb83/kb83.c | 2 +- keyboards/matrix/m20add/rgb_ring.c | 36 ++++---- .../keymaps/default/rgb_matrix_user.inc | 88 +++++++++---------- keyboards/ml/gas75/keymaps/default/keymap.c | 4 +- .../m63_rgb/keymaps/default/keymap.c | 4 +- .../m64_rgb/keymaps/default/keymap.c | 4 +- keyboards/neson_design/700e/700e.c | 4 +- keyboards/neson_design/n6/n6.c | 4 +- .../percent/canoe_gen2/rgb_matrix_kb.inc | 10 +-- keyboards/phage_studio/pila87/pila87.c | 4 +- keyboards/rgbkb/sol3/rev1/rev1.c | 2 +- .../keymaps/default/rgb_matrix_user.inc | 2 +- .../steelseries/prime_plus/rgblight_custom.c | 2 +- keyboards/system76/launch_1/rgb_matrix_kb.inc | 16 ++-- keyboards/system76/system76_ec.c | 4 +- .../native/ansi/keymaps/default/keymap.c | 12 +-- .../native/iso/keymaps/default/keymap.c | 12 +-- keyboards/teleport/native/rgb_matrix_kb.inc | 8 +- keyboards/tzarc/djinn/djinn.c | 2 +- keyboards/wekey/we27/rgb_matrix_kb.inc | 4 +- keyboards/wilba_tech/wt_mono_backlight.c | 4 +- keyboards/wilba_tech/wt_rgb_backlight.c | 48 +++++----- keyboards/xelus/la_plus/rgb_matrix_kb.inc | 4 +- .../xd002/keymaps/multilayer_rgb/rgblite.h | 2 +- keyboards/yushakobo/quick17/quick17_prefs.h | 2 +- keyboards/yushakobo/quick17/rgb_matrix_kb.inc | 22 ++--- 43 files changed, 215 insertions(+), 215 deletions(-) diff --git a/docs/features/rgb_matrix.md b/docs/features/rgb_matrix.md index d87e5f6fdb..0e53ce9c35 100644 --- a/docs/features/rgb_matrix.md +++ b/docs/features/rgb_matrix.md @@ -478,18 +478,18 @@ This example sets the modifiers to be a specific color based on the layer state. ```c bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { - HSV hsv = {0, 255, 255}; + hsv_t hsv = {0, 255, 255}; if (layer_state_is(layer_state, 2)) { - hsv = (HSV){130, 255, 255}; + hsv = (hsv_t){130, 255, 255}; } else { - hsv = (HSV){30, 255, 255}; + hsv = (hsv_t){30, 255, 255}; } if (hsv.v > rgb_matrix_get_val()) { hsv.v = rgb_matrix_get_val(); } - RGB rgb = hsv_to_rgb(hsv); + rgb_t rgb = hsv_to_rgb(hsv); for (uint8_t i = led_min; i < led_max; i++) { if (HAS_FLAGS(g_led_config.flags[i], 0x01)) { // 0x01 == LED_FLAG_MODIFIER @@ -855,13 +855,13 @@ Set the global effect hue, saturation, and value (brightness). New state is not --- -### `HSV rgb_matrix_get_hsv(void)` {#api-rgb-matrix-get-hsv} +### `hsv_t rgb_matrix_get_hsv(void)` {#api-rgb-matrix-get-hsv} Get the current global effect hue, saturation, and value (brightness). #### Return Value {#api-rgb-matrix-get-hsv-return} -The current effect HSV as an `HSV` struct. +The current effect HSV as an `hsv_t` struct. --- diff --git a/keyboards/1k/keymaps/default/rgblite.h b/keyboards/1k/keymaps/default/rgblite.h index b30ec26b04..217ab37956 100644 --- a/keyboards/1k/keymaps/default/rgblite.h +++ b/keyboards/1k/keymaps/default/rgblite.h @@ -10,7 +10,7 @@ static inline void rgblite_init(void) { ws2812_init(); } -static inline void rgblite_setrgb(RGB rgb) { +static inline void rgblite_setrgb(rgb_t rgb) { ws2812_set_color_all(rgb.r, rgb.g, rgb.b); ws2812_flush(); } @@ -18,7 +18,7 @@ static inline void rgblite_setrgb(RGB rgb) { static void rgblite_increase_hue(void) { static uint8_t state = 0; - HSV hsv = { 255, 255, 255 }; + hsv_t hsv = { 255, 255, 255 }; hsv.h = state; state = (state + 8) % 256; diff --git a/keyboards/bandominedoni/rgb_matrix_kb.inc b/keyboards/bandominedoni/rgb_matrix_kb.inc index 77ad22c1ce..081215d78f 100644 --- a/keyboards/bandominedoni/rgb_matrix_kb.inc +++ b/keyboards/bandominedoni/rgb_matrix_kb.inc @@ -5,8 +5,8 @@ RGB_MATRIX_EFFECT(my_party_rocks) bool my_party_rocks(effect_params_t* params) { RGB_MATRIX_USE_LIMITS(led_min, led_max); - HSV hsv = {rand() & 0xFF, rand() & 0xFF, rgb_matrix_config.hsv.v}; - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + hsv_t hsv = {rand() & 0xFF, rand() & 0xFF, rgb_matrix_config.hsv.v}; + rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); // rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); rgb_matrix_set_color_all(rgb.r, rgb.g, rgb.b); return rgb_matrix_check_finished_leds(led_max); diff --git a/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c b/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c index 3decc51e84..a186139835 100644 --- a/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c +++ b/keyboards/bastardkb/dilemma/3x5_3/3x5_3.c @@ -51,36 +51,36 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { uint8_t layer = get_highest_layer(layer_state); if (layer > 0) { - HSV hsv = rgb_matrix_get_hsv(); + hsv_t hsv = rgb_matrix_get_hsv(); switch (get_highest_layer(layer_state)) { case 1: - hsv = (HSV){HSV_BLUE}; + hsv = (hsv_t){HSV_BLUE}; break; case 2: - hsv = (HSV){HSV_AZURE}; + hsv = (hsv_t){HSV_AZURE}; break; case 3: - hsv = (HSV){HSV_ORANGE}; + hsv = (hsv_t){HSV_ORANGE}; break; case 4: - hsv = (HSV){HSV_GREEN}; + hsv = (hsv_t){HSV_GREEN}; break; case 5: - hsv = (HSV){HSV_TEAL}; + hsv = (hsv_t){HSV_TEAL}; break; case 6: - hsv = (HSV){HSV_PURPLE}; + hsv = (hsv_t){HSV_PURPLE}; break; case 7: default: - hsv = (HSV){HSV_RED}; + hsv = (hsv_t){HSV_RED}; break; }; if (hsv.v > rgb_matrix_get_val()) { hsv.v = MIN(rgb_matrix_get_val() + 22, 255); } - RGB rgb = hsv_to_rgb(hsv); + rgb_t rgb = hsv_to_rgb(hsv); for (uint8_t i = led_min; i < led_max; i++) { if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_UNDERGLOW)) { diff --git a/keyboards/chromatonemini/rgb_matrix_kb.inc b/keyboards/chromatonemini/rgb_matrix_kb.inc index 09877e1a31..ee9e8af427 100644 --- a/keyboards/chromatonemini/rgb_matrix_kb.inc +++ b/keyboards/chromatonemini/rgb_matrix_kb.inc @@ -5,7 +5,7 @@ RGB_MATRIX_EFFECT(my_party_rocks) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS -static HSV my_solid_reactive_multiwide_col_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { +static hsv_t my_solid_reactive_multiwide_col_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { uint16_t effect = tick + dist; dx = dx < 0 ? dx * -1 : dx; dx = dx * 16 > 255 ? 255 : dx * 16; @@ -27,7 +27,7 @@ bool my_solid_reactive_col(effect_params_t* params) { uint16_t max_tick = 65535 / rgb_matrix_config.speed; for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - HSV hsv = rgb_matrix_config.hsv; + hsv_t hsv = rgb_matrix_config.hsv; uint16_t tick = max_tick; // Reverse search to find most recent key hit for (int8_t j = g_last_hit_tracker.count - 1; j >= 0; j--) { @@ -39,7 +39,7 @@ bool my_solid_reactive_col(effect_params_t* params) { uint16_t offset = scale16by8(tick, rgb_matrix_config.speed); hsv.h += qsub8(130, offset); - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } return led_max < RGB_MATRIX_LED_COUNT; @@ -47,8 +47,8 @@ bool my_solid_reactive_col(effect_params_t* params) { bool my_party_rocks(effect_params_t* params) { RGB_MATRIX_USE_LIMITS(led_min, led_max); - HSV hsv = {rand() & 0xFF, rand() & 0xFF, rgb_matrix_config.hsv.v}; - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + hsv_t hsv = {rand() & 0xFF, rand() & 0xFF, rgb_matrix_config.hsv.v}; + rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); // rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); rgb_matrix_set_color_all(rgb.r, rgb.g, rgb.b); return led_max < RGB_MATRIX_LED_COUNT; diff --git a/keyboards/cipulot/ec_980c/ec_980c.c b/keyboards/cipulot/ec_980c/ec_980c.c index 0e23c32335..49b5248745 100644 --- a/keyboards/cipulot/ec_980c/ec_980c.c +++ b/keyboards/cipulot/ec_980c/ec_980c.c @@ -92,24 +92,24 @@ bool rgb_matrix_indicators_kb(void) { if (eeprom_ec_config.num.enabled) { // The rgb_matrix_set_color function needs an RGB code to work, so first the indicator color is cast to an HSV value and then translated to RGB - HSV hsv_num_indicator_color = {eeprom_ec_config.num.h, eeprom_ec_config.num.s, eeprom_ec_config.num.v}; - RGB rgb_num_indicator_color = hsv_to_rgb(hsv_num_indicator_color); + hsv_t hsv_num_indicator_color = {eeprom_ec_config.num.h, eeprom_ec_config.num.s, eeprom_ec_config.num.v}; + rgb_t rgb_num_indicator_color = hsv_to_rgb(hsv_num_indicator_color); if (host_keyboard_led_state().num_lock) rgb_matrix_set_color(NUM_INDICATOR_INDEX, rgb_num_indicator_color.r, rgb_num_indicator_color.g, rgb_num_indicator_color.b); else rgb_matrix_set_color(NUM_INDICATOR_INDEX, 0, 0, 0); } if (eeprom_ec_config.caps.enabled) { - HSV hsv_caps_indicator_color = {eeprom_ec_config.caps.h, eeprom_ec_config.caps.s, eeprom_ec_config.caps.v}; - RGB rgb_caps_indicator_color = hsv_to_rgb(hsv_caps_indicator_color); + hsv_t hsv_caps_indicator_color = {eeprom_ec_config.caps.h, eeprom_ec_config.caps.s, eeprom_ec_config.caps.v}; + rgb_t rgb_caps_indicator_color = hsv_to_rgb(hsv_caps_indicator_color); if (host_keyboard_led_state().caps_lock) rgb_matrix_set_color(CAPS_INDICATOR_INDEX, rgb_caps_indicator_color.r, rgb_caps_indicator_color.g, rgb_caps_indicator_color.b); else rgb_matrix_set_color(CAPS_INDICATOR_INDEX, 0, 0, 0); } if (eeprom_ec_config.scroll.enabled) { - HSV hsv_scroll_indicator_color = {eeprom_ec_config.scroll.h, eeprom_ec_config.scroll.s, eeprom_ec_config.scroll.v}; - RGB rgb_scroll_indicator_color = hsv_to_rgb(hsv_scroll_indicator_color); + hsv_t hsv_scroll_indicator_color = {eeprom_ec_config.scroll.h, eeprom_ec_config.scroll.s, eeprom_ec_config.scroll.v}; + rgb_t rgb_scroll_indicator_color = hsv_to_rgb(hsv_scroll_indicator_color); if (host_keyboard_led_state().scroll_lock) rgb_matrix_set_color(SCROLL_INDICATOR_INDEX, rgb_scroll_indicator_color.r, rgb_scroll_indicator_color.g, rgb_scroll_indicator_color.b); else diff --git a/keyboards/gopolar/gg86/gg86.c b/keyboards/gopolar/gg86/gg86.c index 8664b234c7..52e1434f00 100644 --- a/keyboards/gopolar/gg86/gg86.c +++ b/keyboards/gopolar/gg86/gg86.c @@ -93,10 +93,10 @@ bool rgb_matrix_indicators_kb(void) { return false; } - HSV hsv = rgb_matrix_config.hsv; + hsv_t hsv = rgb_matrix_config.hsv; uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1)); hsv.h = time; - RGB rgb = hsv_to_rgb(hsv); + rgb_t rgb = hsv_to_rgb(hsv); if (host_keyboard_led_state().caps_lock) { rgb_matrix_set_color(25, rgb.r, rgb.g, rgb.b); diff --git a/keyboards/horrortroll/chinese_pcb/devil68_pro/keymaps/default/keymap.c b/keyboards/horrortroll/chinese_pcb/devil68_pro/keymaps/default/keymap.c index 0413ffe808..4ad4bcd5cc 100644 --- a/keyboards/horrortroll/chinese_pcb/devil68_pro/keymaps/default/keymap.c +++ b/keyboards/horrortroll/chinese_pcb/devil68_pro/keymaps/default/keymap.c @@ -124,10 +124,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } bool rgb_matrix_indicators_user(void) { - HSV hsv = rgb_matrix_config.hsv; + hsv_t hsv = rgb_matrix_config.hsv; uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1)); hsv.h = time; - RGB rgb = hsv_to_rgb(hsv); + rgb_t rgb = hsv_to_rgb(hsv); if ((rgb_matrix_get_flags() & LED_FLAG_KEYLIGHT)) { if (host_keyboard_led_state().caps_lock) { diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/keymap_stuff.h b/keyboards/horrortroll/handwired_k552/keymaps/default/keymap_stuff.h index fa6f070ed2..b68f9fa634 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/keymap_stuff.h +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/keymap_stuff.h @@ -33,14 +33,14 @@ enum layer_names { }; // For CUSTOM_GRADIENT -HSV gradient_0 = {205, 250, 255}; -HSV gradient_100 = {140, 215, 125}; +hsv_t gradient_0 = {205, 250, 255}; +hsv_t gradient_100 = {140, 215, 125}; bool reflected_gradient = false; uint8_t gp_i = 0; typedef struct { - HSV gradient_0; - HSV gradient_1; + hsv_t gradient_0; + hsv_t gradient_1; bool reflected; } CUSTOM_PRESETS; @@ -203,7 +203,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; case G_FLIP: if (record->event.pressed) { - HSV temp_color = gradient_0; + hsv_t temp_color = gradient_0; gradient_0 = gradient_100; gradient_100 = temp_color; } @@ -255,10 +255,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool rgb_matrix_indicators_user(void) { uint8_t side_leds_left[3] = {17, 18, 19}; uint8_t side_leds_right[3] = { 4, 5, 6}; - HSV hsv = rgb_matrix_config.hsv; + hsv_t hsv = rgb_matrix_config.hsv; uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1)); hsv.h = time; - RGB rgb = hsv_to_rgb(hsv); + rgb_t rgb = hsv_to_rgb(hsv); if ((rgb_matrix_get_flags() & LED_FLAG_ALL)) { if (host_keyboard_led_state().caps_lock) { diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/led/cool_diagonal.c b/keyboards/horrortroll/handwired_k552/keymaps/default/led/cool_diagonal.c index a5bf960d45..d1cb624570 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/led/cool_diagonal.c +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/led/cool_diagonal.c @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -static HSV COOL_DIAGONAL_math(HSV hsv, uint8_t i, uint8_t time) { +static hsv_t COOL_DIAGONAL_math(hsv_t hsv, uint8_t i, uint8_t time) { hsv.h = (g_led_config.point[i].x / 4) - g_led_config.point[i].y - time; return hsv; } diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/led/custom_gradient.c b/keyboards/horrortroll/handwired_k552/keymaps/default/led/custom_gradient.c index af6173d250..346d079a0d 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/led/custom_gradient.c +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/led/custom_gradient.c @@ -14,13 +14,13 @@ * along with this program. If not, see . */ -extern HSV gradient_0; -extern HSV gradient_100; +extern hsv_t gradient_0; +extern hsv_t gradient_100; extern bool reflected_gradient; -static HSV INTERPOLATE_HSV(float step, HSV gradient_0, HSV gradient_100) { +static hsv_t INTERPOLATE_HSV(float step, hsv_t gradient_0, hsv_t gradient_100) { uint8_t cw, ccw; - HSV color; + hsv_t color; cw = (gradient_0.h >= gradient_100.h) ? 255 + gradient_100.h - gradient_0.h : gradient_100.h - gradient_0.h; // Hue range is 0 to 255. ccw = (gradient_0.h >= gradient_100.h) ? gradient_0.h - gradient_100.h : 255 + gradient_0.h - gradient_100.h; @@ -39,7 +39,7 @@ static HSV INTERPOLATE_HSV(float step, HSV gradient_0, HSV gradient_100) { return color; } -static HSV CUSTOM_GRADIENT_math(uint8_t led_x, uint8_t min_x, uint8_t max_x) { +static hsv_t CUSTOM_GRADIENT_math(uint8_t led_x, uint8_t min_x, uint8_t max_x) { float step = (float)led_x / (max_x - min_x); float mid_gradient_pos = 0.5; @@ -64,8 +64,8 @@ static bool CUSTOM_GRADIENT(effect_params_t* params) { for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - HSV hsv_orig = CUSTOM_GRADIENT_math(g_led_config.point[i].x, min_x, max_x); - RGB rgb = hsv_to_rgb(hsv_orig); + hsv_t hsv_orig = CUSTOM_GRADIENT_math(g_led_config.point[i].x, min_x, max_x); + rgb_t rgb = hsv_to_rgb(hsv_orig); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/led/flower_blooming/flower_blooming.c b/keyboards/horrortroll/handwired_k552/keymaps/default/led/flower_blooming/flower_blooming.c index add83149cc..33205438e8 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/led/flower_blooming/flower_blooming.c +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/led/flower_blooming/flower_blooming.c @@ -16,7 +16,7 @@ #include "led/flower_blooming/flower_blooming.h" -static HSV FLOWER_BLOOMING_math(HSV hsv, uint8_t i, uint8_t time) { +static hsv_t FLOWER_BLOOMING_math(hsv_t hsv, uint8_t i, uint8_t time) { if (g_led_config.point[i].y > k_rgb_matrix_center.y) hsv.h = g_led_config.point[i].x * 3 - g_led_config.point[i].y * 3 + time; else diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/led/flower_blooming/flower_blooming.h b/keyboards/horrortroll/handwired_k552/keymaps/default/led/flower_blooming/flower_blooming.h index 941dab975a..e699011922 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/led/flower_blooming/flower_blooming.h +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/led/flower_blooming/flower_blooming.h @@ -1,6 +1,6 @@ #pragma once -typedef HSV (*flower_blooming_f)(HSV hsv, uint8_t i, uint8_t time); +typedef hsv_t (*flower_blooming_f)(hsv_t hsv, uint8_t i, uint8_t time); bool effect_runner_bloom(effect_params_t* params, flower_blooming_f effect_func) { RGB_MATRIX_USE_LIMITS(led_min, led_max); @@ -9,10 +9,10 @@ bool effect_runner_bloom(effect_params_t* params, flower_blooming_f effect_func) for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); if (g_led_config.point[i].y > k_rgb_matrix_center.y) { - RGB bgr = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_t bgr = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); rgb_matrix_set_color(i, bgr.b, bgr.g, bgr.r); } else { - RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } } diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/led/kitt.c b/keyboards/horrortroll/handwired_k552/keymaps/default/led/kitt.c index dadbe48223..e4e1637005 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/led/kitt.c +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/led/kitt.c @@ -35,7 +35,7 @@ static uint8_t time_to_led(uint8_t time, uint8_t led_behind) { return led; } -static HSV KITT_math(HSV hsv, uint8_t i, uint8_t time) { +static hsv_t KITT_math(hsv_t hsv, uint8_t i, uint8_t time) { // reset base effect startup if (i == 0) { diff --git a/keyboards/horrortroll/handwired_k552/keymaps/default/led/random_breath_rainbow.c b/keyboards/horrortroll/handwired_k552/keymaps/default/led/random_breath_rainbow.c index ba1ca55faf..5550f3ee3f 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/default/led/random_breath_rainbow.c +++ b/keyboards/horrortroll/handwired_k552/keymaps/default/led/random_breath_rainbow.c @@ -30,10 +30,10 @@ static void doRandom_breath_rainbow(int i, effect_params_t* params) { } //float val = (((float)sin8(time + offset[i]) / 256)/2.1) + .05; - HSV hsv = {0, 255, 255}; + hsv_t hsv = {0, 255, 255}; hsv.h = scale16by8(g_rgb_timer + offset[i], rgb_matrix_config.speed / 4) + (offset[i]*2); hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } diff --git a/keyboards/horrortroll/nyx/rev1/lib/startup_swirl_anim.h b/keyboards/horrortroll/nyx/rev1/lib/startup_swirl_anim.h index 0cd0a54a8b..c3cb316349 100644 --- a/keyboards/horrortroll/nyx/rev1/lib/startup_swirl_anim.h +++ b/keyboards/horrortroll/nyx/rev1/lib/startup_swirl_anim.h @@ -82,7 +82,7 @@ static void traverse_matrix(void) { } } -static void swirl_set_color(HSV hsv) { +static void swirl_set_color(hsv_t hsv) { uint8_t index = g_led_config.matrix_co[j][i]; if(index != NO_LED){ @@ -97,8 +97,8 @@ static void swirl_set_color(HSV hsv) { else v_values[v] = 0; } - hsv.v = v_values[v]; - RGB rgb = hsv_to_rgb(hsv); + hsv.v = v_values[v]; + hsv_t rgb = hsv_to_rgb(hsv); rgb_matrix_set_color(v, rgb.r, rgb.g, rgb.b); } @@ -112,10 +112,10 @@ static void swirl_set_color(HSV hsv) { } static bool STARTUP_SWIRL_ANIM(effect_params_t* params) { - HSV hsv = rgb_matrix_config.hsv; + hsv_t hsv = rgb_matrix_config.hsv; uint8_t time = scale16by8(g_rgb_timer, qadd8(24, 1)); hsv.h = time; - RGB rgb = hsv_to_rgb(hsv); + rgb_t rgb = hsv_to_rgb(hsv); if (traverse) { swirl_set_color(hsv); diff --git a/keyboards/hs60/v1/v1.c b/keyboards/hs60/v1/v1.c index ecb78c70d0..7c685f76b8 100644 --- a/keyboards/hs60/v1/v1.c +++ b/keyboards/hs60/v1/v1.c @@ -71,7 +71,7 @@ void matrix_init_kb(void) { // Clear the LED colors stored in EEPROM for ( int row=0; row < MATRIX_ROWS; row++ ) { - HSV hsv; + hsv_t hsv; for ( int column=0; column < MATRIX_COLS; column++ ) { hsv.h = rand() & 0xFF; diff --git a/keyboards/inland/kb83/kb83.c b/keyboards/inland/kb83/kb83.c index ace575259d..1052131a91 100644 --- a/keyboards/inland/kb83/kb83.c +++ b/keyboards/inland/kb83/kb83.c @@ -302,7 +302,7 @@ static uint16_t scancode = 0; static uint8_t alarm_cnt = 0; static uint8_t RGB_HSV_level; -HSV hsv; +hsv_t hsv; void led_test(uint8_t color); void clear_eeprom(void); diff --git a/keyboards/matrix/m20add/rgb_ring.c b/keyboards/matrix/m20add/rgb_ring.c index 032745af6e..45cc6013fd 100644 --- a/keyboards/matrix/m20add/rgb_ring.c +++ b/keyboards/matrix/m20add/rgb_ring.c @@ -137,8 +137,8 @@ extern rgblight_config_t rgblight_config; static void testing_mode(void) { if (timer_elapsed(animation_status.last_timer) > EFFECT_TEST_INTERVAL) { - HSV h = {rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; - RGB c = hsv_to_rgb(h); + hsv_t h = {rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; + rgb_t c = hsv_to_rgb(h); //is31fl3731_set_color_all(c.r, c.g, c.b); is31fl3731_set_color_all(0, 0, 0); is31fl3731_set_color(rgb_ring.outer_index+RING_OUTER_BEGIN, c.r, c.g, c.b); @@ -184,9 +184,9 @@ static void update_effect(uint32_t max_count) static void ring_effect_no_1(void) { if (need_update(EFFECT_1_INTERVAL)) { - HSV h = {rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; + hsv_t h = {rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; for (uint8_t i = RING_OUTER_BEGIN; i <= RING_OUTER_END; i++) { - RGB c = hsv_to_rgb(h); + rgb_t c = hsv_to_rgb(h); is31fl3731_set_color(i, c.r, c.g, c.b); } rgblight_config.hue += EFFECT_1_HUE_STEP; @@ -205,8 +205,8 @@ static void ring_effect_no_2(void) { if (need_update(EFFECT_2_INTERVAL)) { is31fl3731_set_color_all(0, 0, 0); - HSV h = {rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; - RGB c = hsv_to_rgb(h); + hsv_t h = {rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; + rgb_t c = hsv_to_rgb(h); is31fl3731_set_color(rgb_ring.led_begin, c.r, c.g, c.b); is31fl3731_set_color(rgb_ring.led_end, c.r, c.g, c.b); @@ -233,13 +233,13 @@ static void ring_effect_no_3(void) } if (need_update(EFFECT_3_INTERVAL)) { - HSV h = {rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; + hsv_t h = {rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; if (rgb_ring.led_clear) { is31fl3731_set_color(rgb_ring.led_begin, 0, 0, 0); is31fl3731_set_color(rgb_ring.led_end, 0, 0, 0); } else { - RGB c = hsv_to_rgb(h); + rgb_t c = hsv_to_rgb(h); is31fl3731_set_color(rgb_ring.led_begin, c.r, c.g, c.b); is31fl3731_set_color(rgb_ring.led_end, c.r, c.g, c.b); } @@ -278,8 +278,8 @@ static void ring_effect_no_4(void) { if (need_update(EFFECT_4_INTERVAL)) { is31fl3731_set_color_all(0, 0, 0); - HSV h = {rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; - RGB c = hsv_to_rgb(h); + hsv_t h = {rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; + rgb_t c = hsv_to_rgb(h); is31fl3731_set_color(rgb_ring.led_begin, c.r, c.g, c.b); is31fl3731_set_color(rgb_ring.led_end, c.r, c.g, c.b); @@ -303,13 +303,13 @@ static void ring_effect_no_5(void) if (need_update(EFFECT_5_INTERVAL)) { is31fl3731_set_color_all(0, 0, 0); for (uint8_t i = RING_INNER_BEGIN; i <= RING_INNER_END; i++) { - HSV h = {rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; - RGB c = hsv_to_rgb(h); + hsv_t h = {rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; + rgb_t c = hsv_to_rgb(h); is31fl3731_set_color(i, c.r, c.g, c.b); } for (uint8_t i = RING_OUTER_BEGIN; i <= RING_OUTER_END; i++) { - HSV h = {rgblight_config.hue+EFFECT_5_HUE_STEP, rgblight_config.sat, rgblight_config.val}; - RGB c = hsv_to_rgb(h); + hsv_t h = {rgblight_config.hue+EFFECT_5_HUE_STEP, rgblight_config.sat, rgblight_config.val}; + rgb_t c = hsv_to_rgb(h); is31fl3731_set_color(i, c.r, c.g, c.b); } rgblight_config.hue += EFFECT_5_HUE_STEP; @@ -329,13 +329,13 @@ static void ring_effect_no_6(void) if (need_update(EFFECT_6_INTERVAL)) { is31fl3731_set_color_all(0, 0, 0); for (uint8_t i = RING_INNER_BEGIN; i <= RING_INNER_END; i++) { - HSV h = {rgblight_config.hue+i*EFFECT_I_HUE_STEP, rgblight_config.sat, rgblight_config.val}; - RGB c = hsv_to_rgb(h); + hsv_t h = {rgblight_config.hue+i*EFFECT_I_HUE_STEP, rgblight_config.sat, rgblight_config.val}; + rgb_t c = hsv_to_rgb(h); is31fl3731_set_color(i, c.r, c.g, c.b); } for (uint8_t i = RING_OUTER_BEGIN; i <= RING_OUTER_END; i++) { - HSV h = {rgblight_config.hue+i*EFFECT_O_HUE_STEP, rgblight_config.sat, rgblight_config.val}; - RGB c = hsv_to_rgb(h); + hsv_t h = {rgblight_config.hue+i*EFFECT_O_HUE_STEP, rgblight_config.sat, rgblight_config.val}; + rgb_t c = hsv_to_rgb(h); is31fl3731_set_color(i, c.r, c.g, c.b); } rgblight_config.hue += EFFECT_I_HUE_STEP; diff --git a/keyboards/mechlovin/infinity875/keymaps/default/rgb_matrix_user.inc b/keyboards/mechlovin/infinity875/keymaps/default/rgb_matrix_user.inc index 627d12bd3c..9c44fde9cc 100644 --- a/keyboards/mechlovin/infinity875/keymaps/default/rgb_matrix_user.inc +++ b/keyboards/mechlovin/infinity875/keymaps/default/rgb_matrix_user.inc @@ -59,7 +59,7 @@ bool effect_runner_all(effect_params_t* params, i_f effect_func) { uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 4, 1)); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } return led_max < RGB_MATRIX_LED_COUNT; @@ -71,7 +71,7 @@ bool effect_runner_esc(effect_params_t* params, i_f effect_func) { uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 4, 1)); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } for (uint8_t i = 1; i < 18; i++) { @@ -85,7 +85,7 @@ bool effect_runner_f13(effect_params_t* params, i_f effect_func) { uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 4, 1)); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); rgb_matrix_set_color(15, 0x00, 0x00, 0x00); rgb_matrix_set_color(16, 0x00, 0x00, 0x00); @@ -103,7 +103,7 @@ bool effect_runner_clus(effect_params_t* params, i_f effect_func) { uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 4, 1)); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } for (uint8_t i = 0; i < 15; i++) { @@ -120,7 +120,7 @@ bool effect_runner_dx_dy_all(effect_params_t* params, dx_dy_f effect_func) { RGB_MATRIX_TEST_LED_FLAGS(); int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y; - RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time)); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } return led_max < RGB_MATRIX_LED_COUNT; @@ -134,7 +134,7 @@ bool effect_runner_dx_dy_esc(effect_params_t* params, dx_dy_f effect_func) { RGB_MATRIX_TEST_LED_FLAGS(); int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y; - RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time)); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } for (uint8_t i = 1; i < 18; i++) { @@ -151,7 +151,7 @@ bool effect_runner_dx_dy_f13(effect_params_t* params, dx_dy_f effect_func) { RGB_MATRIX_TEST_LED_FLAGS(); int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y; - RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time)); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); rgb_matrix_set_color(15, 0x00, 0x00, 0x00); rgb_matrix_set_color(16, 0x00, 0x00, 0x00); @@ -171,7 +171,7 @@ bool effect_runner_dx_dy_clus(effect_params_t* params, dx_dy_f effect_func) { RGB_MATRIX_TEST_LED_FLAGS(); int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x; int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y; - RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time)); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } for (uint8_t i = 0; i < 15; i++) { @@ -188,7 +188,7 @@ bool effect_runner_sin_cos_all(effect_params_t* params, sin_cos_i_f effect_func) int8_t sin_value = sin8(time) - 128; for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time)); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } return led_max < RGB_MATRIX_LED_COUNT; @@ -202,7 +202,7 @@ bool effect_runner_sin_cos_esc(effect_params_t* params, sin_cos_i_f effect_func) int8_t sin_value = sin8(time) - 128; for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time)); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } for (uint8_t i = 1; i < 18; i++) { @@ -219,7 +219,7 @@ bool effect_runner_sin_cos_f13(effect_params_t* params, sin_cos_i_f effect_func) int8_t sin_value = sin8(time) - 128; for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time)); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); rgb_matrix_set_color(15, 0x00, 0x00, 0x00); rgb_matrix_set_color(16, 0x00, 0x00, 0x00); @@ -239,7 +239,7 @@ bool effect_runner_sin_cos_clus(effect_params_t* params, sin_cos_i_f effect_func int8_t sin_value = sin8(time) - 128; for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time)); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } for (uint8_t i = 0; i < 15; i++) { @@ -250,7 +250,7 @@ bool effect_runner_sin_cos_clus(effect_params_t* params, sin_cos_i_f effect_func static void raindrops_set_color_all(int i, effect_params_t* params) { if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; - HSV hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; + hsv_t hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; // Take the shortest path between hues int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4; @@ -260,14 +260,14 @@ static void raindrops_set_color_all(int i, effect_params_t* params) { deltaH += 256; } - hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03)); - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } static void raindrops_set_color_esc(int i, effect_params_t* params) { if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; - HSV hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; + hsv_t hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; // Take the shortest path between hues int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4; @@ -277,8 +277,8 @@ static void raindrops_set_color_esc(int i, effect_params_t* params) { deltaH += 256; } - hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03)); - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); for (uint8_t i = 1; i < 18; i++) { rgb_matrix_set_color(i, 0x00, 0x00, 0x00); @@ -287,7 +287,7 @@ static void raindrops_set_color_esc(int i, effect_params_t* params) { static void raindrops_set_color_f13(int i, effect_params_t* params) { if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; - HSV hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; + hsv_t hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; // Take the shortest path between hues int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4; @@ -297,8 +297,8 @@ static void raindrops_set_color_f13(int i, effect_params_t* params) { deltaH += 256; } - hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03)); - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); rgb_matrix_set_color(15, 0x00, 0x00, 0x00); rgb_matrix_set_color(16, 0x00, 0x00, 0x00); @@ -310,7 +310,7 @@ static void raindrops_set_color_f13(int i, effect_params_t* params) { static void raindrops_set_color_clus(int i, effect_params_t* params) { if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; - HSV hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; + hsv_t hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v}; // Take the shortest path between hues int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4; @@ -320,43 +320,43 @@ static void raindrops_set_color_clus(int i, effect_params_t* params) { deltaH += 256; } - hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03)); - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03)); + rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); for (uint8_t i = 0; i < 15; i++) { rgb_matrix_set_color(i, 0x00, 0x00, 0x00); } } -static HSV BAND_VAL_CUSTOM(HSV hsv, uint8_t i, uint8_t time) { +static hsv_t BAND_VAL_CUSTOM(hsv_t hsv, uint8_t i, uint8_t time) { int16_t v = hsv.v - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8; hsv.v = scale8(v < 0 ? 0 : v, hsv.v); return hsv; } -static HSV CYCLE_UP_DOWN_CUSTOM(HSV hsv, uint8_t i, uint8_t time) { +static hsv_t CYCLE_UP_DOWN_CUSTOM(hsv_t hsv, uint8_t i, uint8_t time) { hsv.h = g_led_config.point[i].y - time; return hsv; } -static HSV CYCLE_OUT_IN_DUAL_CUSTOM(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { +static hsv_t CYCLE_OUT_IN_DUAL_CUSTOM(hsv_t hsv, int16_t dx, int16_t dy, uint8_t time) { dx = (k_rgb_matrix_center.x / 2) - abs8(dx); uint8_t dist = sqrt16(dx * dx + dy * dy); hsv.h = 3 * dist + time; return hsv; } -static HSV RAINBOW_MOVING_CHEVRON_CUSTOM(HSV hsv, uint8_t i, uint8_t time) { +static hsv_t RAINBOW_MOVING_CHEVRON_CUSTOM(hsv_t hsv, uint8_t i, uint8_t time) { hsv.h += abs8(g_led_config.point[i].y - k_rgb_matrix_center.y) + (g_led_config.point[i].x - time); return hsv; } -static HSV CYCLE_PINWHEEL_CUSTOM(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { +static hsv_t CYCLE_PINWHEEL_CUSTOM(hsv_t hsv, int16_t dx, int16_t dy, uint8_t time) { hsv.h = atan2_8(dy, dx) + time; return hsv; } -static HSV RAINBOW_BEACON_CUSTOM(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { +static hsv_t RAINBOW_BEACON_CUSTOM(hsv_t hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { 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; return hsv; } @@ -365,8 +365,8 @@ static HSV RAINBOW_BEACON_CUSTOM(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uin // Solid ESC static bool solid_esc(effect_params_t* params) { - HSV hsv = rgb_matrix_config.hsv; - RGB rgb = hsv_to_rgb(hsv); + hsv_t hsv = rgb_matrix_config.hsv; + rgb_t rgb = hsv_to_rgb(hsv); RGB_MATRIX_USE_LIMITS(led_min, led_max); for (uint8_t i = led_min ; i < led_max; i++) { rgb_matrix_set_color(i, 0x00, 0x00, 0x00); @@ -380,8 +380,8 @@ static bool solid_esc(effect_params_t* params) { // Solid F13 static bool solid_f13(effect_params_t* params) { - HSV hsv = rgb_matrix_config.hsv; - RGB rgb = hsv_to_rgb(hsv); + hsv_t hsv = rgb_matrix_config.hsv; + rgb_t rgb = hsv_to_rgb(hsv); RGB_MATRIX_USE_LIMITS(led_min, led_max); for (uint8_t i = led_min ; i < led_max; i++) { rgb_matrix_set_color(i, 0x00, 0x00, 0x00); @@ -395,8 +395,8 @@ static bool solid_f13(effect_params_t* params) { // Solid cluster static bool solid_clus(effect_params_t* params) { - HSV hsv = rgb_matrix_config.hsv; - RGB rgb = hsv_to_rgb(hsv); + hsv_t hsv = rgb_matrix_config.hsv; + rgb_t rgb = hsv_to_rgb(hsv); RGB_MATRIX_USE_LIMITS(led_min, led_max); for (uint8_t i = led_min ; i < led_max; i++) { rgb_matrix_set_color(i, 0x00, 0x00, 0x00); @@ -412,10 +412,10 @@ static bool solid_clus(effect_params_t* params) { bool breathing_all(effect_params_t* params) { RGB_MATRIX_USE_LIMITS(led_min, led_max); - HSV hsv = rgb_matrix_config.hsv; + hsv_t hsv = rgb_matrix_config.hsv; uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); @@ -427,10 +427,10 @@ bool breathing_all(effect_params_t* params) { static bool breathing_esc(effect_params_t* params) { RGB_MATRIX_USE_LIMITS(led_min, led_max); - HSV hsv = rgb_matrix_config.hsv; + hsv_t hsv = rgb_matrix_config.hsv; uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); for (uint8_t i = led_min ; i < led_max; i++) { rgb_matrix_set_color(i, 0x00, 0x00, 0x00); } @@ -446,10 +446,10 @@ static bool breathing_esc(effect_params_t* params) { static bool breathing_f13(effect_params_t* params) { RGB_MATRIX_USE_LIMITS(led_min, led_max); - HSV hsv = rgb_matrix_config.hsv; + hsv_t hsv = rgb_matrix_config.hsv; uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); for (uint8_t i = led_min ; i < led_max; i++) { rgb_matrix_set_color(i, 0x00, 0x00, 0x00); } @@ -465,10 +465,10 @@ static bool breathing_f13(effect_params_t* params) { static bool breathing_clus(effect_params_t* params) { RGB_MATRIX_USE_LIMITS(led_min, led_max); - HSV hsv = rgb_matrix_config.hsv; + hsv_t hsv = rgb_matrix_config.hsv; uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); for (uint8_t i = led_min ; i < led_max; i++) { rgb_matrix_set_color(i, 0x00, 0x00, 0x00); } diff --git a/keyboards/ml/gas75/keymaps/default/keymap.c b/keyboards/ml/gas75/keymaps/default/keymap.c index 085c61f2ec..8e61e104ed 100644 --- a/keyboards/ml/gas75/keymaps/default/keymap.c +++ b/keyboards/ml/gas75/keymaps/default/keymap.c @@ -168,10 +168,10 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { bool rgb_matrix_indicators_user(void) { rgb_matrix_set_color(2, 0, 0, 0); - HSV hsv = rgb_matrix_config.hsv; + hsv_t hsv = rgb_matrix_config.hsv; uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1)); hsv.h = time; - RGB rgb = hsv_to_rgb(hsv); + rgb_t rgb = hsv_to_rgb(hsv); if ((rgb_matrix_get_flags() & LED_FLAG_KEYLIGHT)) { if (host_keyboard_led_state().caps_lock) { diff --git a/keyboards/mss_studio/m63_rgb/keymaps/default/keymap.c b/keyboards/mss_studio/m63_rgb/keymaps/default/keymap.c index df2f0d924c..8a59f2ec9f 100644 --- a/keyboards/mss_studio/m63_rgb/keymaps/default/keymap.c +++ b/keyboards/mss_studio/m63_rgb/keymaps/default/keymap.c @@ -169,10 +169,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } bool rgb_matrix_indicators_user(void) { - HSV hsv = rgb_matrix_config.hsv; + hsv_t hsv = rgb_matrix_config.hsv; uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1)); hsv.h = time; - RGB rgb = hsv_to_rgb(hsv); + rgb_t rgb = hsv_to_rgb(hsv); if ((rgb_matrix_get_flags() & LED_FLAG_KEYLIGHT)) { if (host_keyboard_led_state().caps_lock) { diff --git a/keyboards/mss_studio/m64_rgb/keymaps/default/keymap.c b/keyboards/mss_studio/m64_rgb/keymaps/default/keymap.c index 95a30994ae..c3879b2b61 100644 --- a/keyboards/mss_studio/m64_rgb/keymaps/default/keymap.c +++ b/keyboards/mss_studio/m64_rgb/keymaps/default/keymap.c @@ -165,10 +165,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } bool rgb_matrix_indicators_user(void) { - HSV hsv = rgb_matrix_config.hsv; + hsv_t hsv = rgb_matrix_config.hsv; uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1)); hsv.h = time; - RGB rgb = hsv_to_rgb(hsv); + rgb_t rgb = hsv_to_rgb(hsv); if ((rgb_matrix_get_flags() & LED_FLAG_KEYLIGHT)) { if (host_keyboard_led_state().caps_lock) { diff --git a/keyboards/neson_design/700e/700e.c b/keyboards/neson_design/700e/700e.c index cee22cf78d..810e311b28 100644 --- a/keyboards/neson_design/700e/700e.c +++ b/keyboards/neson_design/700e/700e.c @@ -103,9 +103,9 @@ static void update_ticks(void) static void self_testing(void) { if (timer_elapsed(rgb_state.ticks) < ST_INTERVAL) return; - HSV hsv = rgblight_get_hsv(); + hsv_t hsv = rgblight_get_hsv(); - RGB led = hsv_to_rgb(hsv); + rgb_t led = hsv_to_rgb(hsv); switch(rgb_state.testing) { case ST_STAGE_1: if (rgb_state.index !=0 ) { diff --git a/keyboards/neson_design/n6/n6.c b/keyboards/neson_design/n6/n6.c index 03bb88c40b..e4538257f1 100644 --- a/keyboards/neson_design/n6/n6.c +++ b/keyboards/neson_design/n6/n6.c @@ -104,12 +104,12 @@ static void update_ticks(void) static void self_testing(void) { if (timer_elapsed(rgb_state.ticks) < ST_INTERVAL) return; - HSV hsv; + hsv_t hsv; hsv.h = rgblight_config.hue; hsv.s = rgblight_config.sat; hsv.v = rgblight_config.val; - RGB led = hsv_to_rgb(hsv); + rgb_t led = hsv_to_rgb(hsv); switch(rgb_state.testing) { case ST_STAGE_1: if (rgb_state.index !=0 ) { diff --git a/keyboards/percent/canoe_gen2/rgb_matrix_kb.inc b/keyboards/percent/canoe_gen2/rgb_matrix_kb.inc index 94ff62b3a8..3839fbfe4f 100644 --- a/keyboards/percent/canoe_gen2/rgb_matrix_kb.inc +++ b/keyboards/percent/canoe_gen2/rgb_matrix_kb.inc @@ -22,8 +22,8 @@ RGB_MATRIX_EFFECT(indicator_static) #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS static bool indicator_static(effect_params_t* params) { - HSV hsv = rgb_matrix_config.hsv; - RGB rgb = hsv_to_rgb(hsv); + hsv_t hsv = rgb_matrix_config.hsv; + rgb_t rgb = hsv_to_rgb(hsv); RGB_MATRIX_USE_LIMITS(led_min, led_max); for (uint8_t i = led_min; i < 74; i++) { rgb_matrix_set_color(i, 0x00, 0x00, 0x00); @@ -43,21 +43,21 @@ bool effect_runner_indicator(effect_params_t* params, i_f effect_func) { rgb_matrix_set_color(i, 0x00, 0x00, 0x00); } else { RGB_MATRIX_TEST_LED_FLAGS(); - RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, (i - 74), time)); + rgb_t rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, (i - 74), time)); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } } return rgb_matrix_check_finished_leds(led_max); } -static HSV indicator_gradient_math(HSV hsv, uint8_t i, uint8_t time) { +static hsv_t indicator_gradient_math(hsv_t hsv, uint8_t i, uint8_t time) { hsv.h = g_led_config.point[i].x - time; return hsv; } bool indicator_gradient(effect_params_t* params) { return effect_runner_indicator(params, &indicator_gradient_math); } -static HSV indicator_cycle_all_math(HSV hsv, uint8_t i, uint8_t time) { +static hsv_t indicator_cycle_all_math(hsv_t hsv, uint8_t i, uint8_t time) { hsv.h = time; return hsv; } diff --git a/keyboards/phage_studio/pila87/pila87.c b/keyboards/phage_studio/pila87/pila87.c index 8e72fb4e85..619623cc09 100644 --- a/keyboards/phage_studio/pila87/pila87.c +++ b/keyboards/phage_studio/pila87/pila87.c @@ -73,10 +73,10 @@ bool rgb_matrix_indicators_kb(void) { return false; } - HSV hsv = rgb_matrix_config.hsv; + hsv_t hsv = rgb_matrix_config.hsv; uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1)); hsv.h = time; - RGB rgb = hsv_to_rgb(hsv); + rgb_t rgb = hsv_to_rgb(hsv); if (host_keyboard_led_state().caps_lock) { rgb_matrix_set_color(40, rgb.r, rgb.g, rgb.b); diff --git a/keyboards/rgbkb/sol3/rev1/rev1.c b/keyboards/rgbkb/sol3/rev1/rev1.c index 89ec391f66..086ce0af01 100644 --- a/keyboards/rgbkb/sol3/rev1/rev1.c +++ b/keyboards/rgbkb/sol3/rev1/rev1.c @@ -27,7 +27,7 @@ const encodermap_t touch_encoder_map[NUMBER_OF_TOUCH_ENCODERS][TOUCH_ENCODER_OPT static bool limit_lightning = true; -RGB rgb_matrix_hsv_to_rgb(HSV hsv) { +RGB rgb_matrix_hsv_to_rgb(hsv_t hsv) { if (limit_lightning) hsv.v /= 2; return hsv_to_rgb(hsv); } diff --git a/keyboards/s_ol/0xc_pad/keymaps/default/rgb_matrix_user.inc b/keyboards/s_ol/0xc_pad/keymaps/default/rgb_matrix_user.inc index 8acb4934bc..2c635c913c 100644 --- a/keyboards/s_ol/0xc_pad/keymaps/default/rgb_matrix_user.inc +++ b/keyboards/s_ol/0xc_pad/keymaps/default/rgb_matrix_user.inc @@ -16,7 +16,7 @@ RGB_MATRIX_EFFECT(RGB_TESTING) #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS -static HSV RGB_TESTING_math(HSV hsv, uint8_t i, uint8_t time) { +static hsv_t RGB_TESTING_math(hsv_t hsv, uint8_t i, uint8_t time) { hsv.v = 255; hsv.s = 255; diff --git a/keyboards/steelseries/prime_plus/rgblight_custom.c b/keyboards/steelseries/prime_plus/rgblight_custom.c index d2be789203..2736052587 100644 --- a/keyboards/steelseries/prime_plus/rgblight_custom.c +++ b/keyboards/steelseries/prime_plus/rgblight_custom.c @@ -12,7 +12,7 @@ static PWMConfig pwmCFG = { .period = 256, }; -rgb_led_t prime_leds[RGBLIGHT_LED_COUNT]; +rgb_t prime_leds[RGBLIGHT_LED_COUNT]; void init_custom(void) { palSetPadMode(PAL_PORT(RGB_RED_PIN), PAL_PAD(RGB_RED_PIN), PAL_MODE_ALTERNATE_PUSHPULL); diff --git a/keyboards/system76/launch_1/rgb_matrix_kb.inc b/keyboards/system76/launch_1/rgb_matrix_kb.inc index f29183dde0..abde7aae19 100644 --- a/keyboards/system76/launch_1/rgb_matrix_kb.inc +++ b/keyboards/system76/launch_1/rgb_matrix_kb.inc @@ -46,7 +46,7 @@ static bool active_keys(effect_params_t* params) { RGB_MATRIX_USE_LIMITS(led_min, led_max); uint8_t layer = get_highest_layer(layer_state); - RGB rgb = hsv_to_rgb(rgb_matrix_config.hsv); + rgb_t rgb = hsv_to_rgb(rgb_matrix_config.hsv); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); @@ -69,7 +69,7 @@ static bool active_keys(effect_params_t* params) { return led_max < RGB_MATRIX_LED_COUNT; } -RGB raw_rgb_data[RGB_MATRIX_LED_COUNT] = {0}; +rgb_t raw_rgb_data[RGB_MATRIX_LED_COUNT] = {0}; static uint8_t normalize_component(uint8_t component) { uint16_t x = (uint16_t)component; @@ -78,9 +78,9 @@ static uint8_t normalize_component(uint8_t component) { return (uint8_t)x; } -static RGB normalize_index(uint8_t i) { - RGB raw = raw_rgb_data[i]; - RGB rgb = { +static rgb_t normalize_index(uint8_t i) { + rgb_t raw = raw_rgb_data[i]; + rgb_t rgb = { .r = normalize_component(raw.r), .g = normalize_component(raw.g), .b = normalize_component(raw.b), @@ -92,7 +92,7 @@ static bool raw_rgb(effect_params_t* params) { RGB_MATRIX_USE_LIMITS(led_min, led_max); for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - RGB rgb = normalize_index(i); + rgb_t rgb = normalize_index(i); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } return led_max < RGB_MATRIX_LED_COUNT; @@ -137,7 +137,7 @@ static bool unlocked(effect_params_t* params) { for (uint8_t i = led_min; i < led_max; i++) { RGB_MATRIX_TEST_LED_FLAGS(); - HSV hsv = { + hsv_t hsv = { .h = i + unlocked_ticks, .s = 0xFF, .v = 0x70, @@ -149,7 +149,7 @@ static bool unlocked(effect_params_t* params) { } } - RGB rgb = hsv_to_rgb(hsv); + rgb_t rgb = hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } return led_max < RGB_MATRIX_LED_COUNT; diff --git a/keyboards/system76/system76_ec.c b/keyboards/system76/system76_ec.c index 1b7955e19b..cce60a5dea 100644 --- a/keyboards/system76/system76_ec.c +++ b/keyboards/system76/system76_ec.c @@ -135,7 +135,7 @@ static enum rgb_matrix_effects mode_map[] = { _Static_assert(sizeof(mode_map) == MODE_LAST, "mode_map_length"); -RGB raw_rgb_data[RGB_MATRIX_LED_COUNT]; +rgb_t raw_rgb_data[RGB_MATRIX_LED_COUNT]; // clang-format off rgb_config_t layer_rgb[DYNAMIC_KEYMAP_LAYER_COUNT] = { @@ -322,7 +322,7 @@ void raw_hid_receive(uint8_t *data, uint8_t length) { if (!bootloader_unlocked) { uint8_t index = data[2]; - RGB rgb = { + rgb_t rgb = { .r = data[3], .g = data[4], .b = data[5], diff --git a/keyboards/teleport/native/ansi/keymaps/default/keymap.c b/keyboards/teleport/native/ansi/keymaps/default/keymap.c index 60983df435..692aa49359 100644 --- a/keyboards/teleport/native/ansi/keymaps/default/keymap.c +++ b/keyboards/teleport/native/ansi/keymaps/default/keymap.c @@ -57,8 +57,8 @@ and sets val to RGB_MATRIX_MAXIMUM_BRIGHTNESS (by default, 255) This is applied to both caps lock, and other indicator keys for layer 1 */ bool rgb_matrix_indicators_user(void) { - HSV hsv_ind = {rgb_matrix_get_hue()+30,255,RGB_MATRIX_MAXIMUM_BRIGHTNESS}; - RGB rgb_ind = hsv_to_rgb(hsv_ind); + hsv_t hsv_ind = {rgb_matrix_get_hue()+30,255,RGB_MATRIX_MAXIMUM_BRIGHTNESS}; + rgb_t rgb_ind = hsv_to_rgb(hsv_ind); /* Sets Caps to different color as indicator. If RGB mode is rain, and caps indicator is off, the LED will always be off. This is to avoid having the LED persist on until the animation randomly refreshes it. */ @@ -70,8 +70,8 @@ bool rgb_matrix_indicators_user(void) { /* Sets W, A, S, D, LGUI to a different color as layer indicator */ if(IS_LAYER_ON(1)) { - HSV hsv_ind = {rgb_matrix_get_hue()+30,255,RGB_MATRIX_MAXIMUM_BRIGHTNESS}; - RGB rgb_ind = hsv_to_rgb(hsv_ind); + hsv_t hsv_ind = {rgb_matrix_get_hue()+30,255,RGB_MATRIX_MAXIMUM_BRIGHTNESS}; + rgb_t rgb_ind = hsv_to_rgb(hsv_ind); rgb_matrix_set_color(W_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); rgb_matrix_set_color(A_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); @@ -85,8 +85,8 @@ bool rgb_matrix_indicators_user(void) { layer_state_t layer_state_set_user(layer_state_t state) { /* If reverting to base layer (no special LED effects) and rain animation is on, set "layer 1" mods back to matrix color to avoid single key persistence*/ if(!IS_LAYER_ON_STATE(state, 1) && rgb_matrix_get_mode() == 10) { - HSV hsv_mat = rgb_matrix_get_hsv(); - RGB rgb_mat = hsv_to_rgb(hsv_mat); + hsv_t hsv_mat = rgb_matrix_get_hsv(); + rgb_t rgb_mat = hsv_to_rgb(hsv_mat); rgb_matrix_set_color(W_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); rgb_matrix_set_color(A_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); diff --git a/keyboards/teleport/native/iso/keymaps/default/keymap.c b/keyboards/teleport/native/iso/keymaps/default/keymap.c index 68105f0a02..1f226c6358 100644 --- a/keyboards/teleport/native/iso/keymaps/default/keymap.c +++ b/keyboards/teleport/native/iso/keymaps/default/keymap.c @@ -57,8 +57,8 @@ and sets val to RGB_MATRIX_MAXIMUM_BRIGHTNESS (by default, 255) This is applied to both caps lock, and other indicator keys for layer 1 */ bool rgb_matrix_indicators_user(void) { - HSV hsv_ind = {rgb_matrix_get_hue()+30,255,RGB_MATRIX_MAXIMUM_BRIGHTNESS}; - RGB rgb_ind = hsv_to_rgb(hsv_ind); + hsv_t hsv_ind = {rgb_matrix_get_hue()+30,255,RGB_MATRIX_MAXIMUM_BRIGHTNESS}; + rgb_t rgb_ind = hsv_to_rgb(hsv_ind); /* Sets Caps to different color as indicator. If RGB mode is rain, and caps indicator is off, the LED will always be off. This is to avoid having the LED persist on until the animation randomly refreshes it. */ @@ -70,8 +70,8 @@ bool rgb_matrix_indicators_user(void) { /* Sets W, A, S, D, LGUI to a different color as layer indicator */ if(IS_LAYER_ON(1)) { - HSV hsv_ind = {rgb_matrix_get_hue()+30,255,RGB_MATRIX_MAXIMUM_BRIGHTNESS}; - RGB rgb_ind = hsv_to_rgb(hsv_ind); + hsv_t hsv_ind = {rgb_matrix_get_hue()+30,255,RGB_MATRIX_MAXIMUM_BRIGHTNESS}; + rgb_t rgb_ind = hsv_to_rgb(hsv_ind); rgb_matrix_set_color(W_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); rgb_matrix_set_color(A_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); @@ -85,8 +85,8 @@ bool rgb_matrix_indicators_user(void) { layer_state_t layer_state_set_user(layer_state_t state) { /* If reverting to base layer (no special LED effects) and rain animation is on, set "layer 1" mods back to matrix color to avoid single key persistence*/ if(!IS_LAYER_ON_STATE(state, 1) && rgb_matrix_get_mode() == 10) { - HSV hsv_mat = rgb_matrix_get_hsv(); - RGB rgb_mat = hsv_to_rgb(hsv_mat); + hsv_t hsv_mat = rgb_matrix_get_hsv(); + rgb_t rgb_mat = hsv_to_rgb(hsv_mat); rgb_matrix_set_color(W_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); rgb_matrix_set_color(A_LED_INDEX, rgb_mat.r, rgb_mat.g, rgb_mat.b); diff --git a/keyboards/teleport/native/rgb_matrix_kb.inc b/keyboards/teleport/native/rgb_matrix_kb.inc index 5df5312a42..383a751ee1 100644 --- a/keyboards/teleport/native/rgb_matrix_kb.inc +++ b/keyboards/teleport/native/rgb_matrix_kb.inc @@ -18,13 +18,13 @@ static bool SINGLE_COLOR_RAINDROPS(effect_params_t* params) { } // Take matrix color, add between -5 and +5 to hue, random brightness between 0 and val, set to 0 if val between 0 and 5, then write to LED - HSV hsv = rgb_matrix_get_hsv(); + hsv_t hsv = rgb_matrix_get_hsv(); hsv.h = rgb_matrix_get_hue() - 2 + random8() % 5; hsv.v = random8() % rgb_matrix_get_val(); if (hsv.v < 5) { hsv.v = 0; } - RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); wait_timer = g_rgb_timer + interval(); } @@ -51,7 +51,7 @@ bool STATIC_GAME_MODE(effect_params_t* params) { return; } - HSV hsv = rgb_matrix_get_hsv(); + hsv_t hsv = rgb_matrix_get_hsv(); switch (i) { case W_LED_INDEX: @@ -92,7 +92,7 @@ bool STATIC_GAME_MODE(effect_params_t* params) { break; } - RGB rgb = hsv_to_rgb(hsv); + rgb_t rgb = hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } diff --git a/keyboards/tzarc/djinn/djinn.c b/keyboards/tzarc/djinn/djinn.c index a104710b03..9723a31a60 100644 --- a/keyboards/tzarc/djinn/djinn.c +++ b/keyboards/tzarc/djinn/djinn.c @@ -87,7 +87,7 @@ void keyboard_post_init_kb(void) { // RGB brightness scaling dependent on USBPD state #if defined(RGB_MATRIX_ENABLE) -RGB rgb_matrix_hsv_to_rgb(HSV hsv) { +rgb_t rgb_matrix_hsv_to_rgb(hsv_t hsv) { float scale; # ifdef DJINN_SUPPORTS_3A_FUSE diff --git a/keyboards/wekey/we27/rgb_matrix_kb.inc b/keyboards/wekey/we27/rgb_matrix_kb.inc index a7eeffbbe9..167a60fb57 100644 --- a/keyboards/wekey/we27/rgb_matrix_kb.inc +++ b/keyboards/wekey/we27/rgb_matrix_kb.inc @@ -6,13 +6,13 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE2) #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS -static HSV SOLID_REACTIVE_WIDE_math2(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { +static hsv_t SOLID_REACTIVE_WIDE_math2(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { uint16_t effect = tick - dist > 255 || dist > 32 ? 255 : tick - dist; hsv.v = qadd8(hsv.v, 255 - effect); return hsv; } -static HSV SOLID_REACTIVE_NEXUS_math2(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { +static hsv_t SOLID_REACTIVE_NEXUS_math2(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { uint16_t effect = tick - dist > 255 || ((dx > 8 || dx < -8) && (dy > 8 || dy < -8)) ? 255 : tick - dist; hsv.v = qadd8(hsv.v, 255 - effect); hsv.h = rgb_matrix_config.hsv.h + dy / 4; diff --git a/keyboards/wilba_tech/wt_mono_backlight.c b/keyboards/wilba_tech/wt_mono_backlight.c index 1426e09fc6..01fefc8ecc 100644 --- a/keyboards/wilba_tech/wt_mono_backlight.c +++ b/keyboards/wilba_tech/wt_mono_backlight.c @@ -150,8 +150,8 @@ void backlight_effect_cycle_all(void) void backlight_effect_indicators(void) { #if defined(MONO_BACKLIGHT_WT75_A) - HSV hsv = { .h = g_config.color_1.h, .s = g_config.color_1.s, .v = g_config.brightness }; - RGB rgb = hsv_to_rgb( hsv ); + hsv_t hsv = { .h = g_config.color_1.h, .s = g_config.color_1.s, .v = g_config.brightness }; + rgb_t rgb = hsv_to_rgb( hsv ); // SW7,CS8 = (6*8+7) = 55 // SW8,CS8 = (7*8+7) = 63 // SW9,CS8 = (8*8+7) = 71 diff --git a/keyboards/wilba_tech/wt_rgb_backlight.c b/keyboards/wilba_tech/wt_rgb_backlight.c index 645ee2b32a..e52d002060 100644 --- a/keyboards/wilba_tech/wt_rgb_backlight.c +++ b/keyboards/wilba_tech/wt_rgb_backlight.c @@ -1258,16 +1258,16 @@ void backlight_effect_all_off(void) // Solid color void backlight_effect_solid_color(void) { - HSV hsv = { .h = g_config.color_1.h, .s = g_config.color_1.s, .v = g_config.brightness }; - RGB rgb = hsv_to_rgb( hsv ); + hsv_t hsv = { .h = g_config.color_1.h, .s = g_config.color_1.s, .v = g_config.brightness }; + rgb_t rgb = hsv_to_rgb( hsv ); backlight_set_color_all( rgb.r, rgb.g, rgb.b ); } // alphas = color1, mods = color2 void backlight_effect_alphas_mods(void) { - RGB rgb1 = hsv_to_rgb( (HSV){ .h = g_config.color_1.h, .s = g_config.color_1.s, .v = g_config.brightness } ); - RGB rgb2 = hsv_to_rgb( (HSV){ .h = g_config.color_2.h, .s = g_config.color_2.s, .v = g_config.brightness } ); + rgb_t rgb1 = hsv_to_rgb( (hsv_t){ .h = g_config.color_1.h, .s = g_config.color_1.s, .v = g_config.brightness } ); + rgb_t rgb2 = hsv_to_rgb( (hsv_t){ .h = g_config.color_2.h, .s = g_config.color_2.s, .v = g_config.brightness } ); bool is_alpha = false; for ( int row = 0; row < MATRIX_ROWS; row++ ) { @@ -1352,8 +1352,8 @@ void backlight_effect_gradient_up_down(void) int16_t s2 = g_config.color_2.s; int16_t deltaS = ( s2 - s1 ) / 4; - HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; - RGB rgb; + hsv_t hsv = { .h = 0, .s = 255, .v = g_config.brightness }; + rgb_t rgb; Point point; for ( int i=0; i