Rename RGB/HSV structs: keyboard-level code (#24476)

This commit is contained in:
Ryan 2024-10-13 05:00:56 +11:00 committed by GitHub
parent 5478051d74
commit 9884e4982b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
43 changed files with 215 additions and 215 deletions

View File

@ -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.
---

View File

@ -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;

View File

@ -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);

View File

@ -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)) {

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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) {

View File

@ -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) {

View File

@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

View File

@ -14,13 +14,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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);
}

View File

@ -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

View File

@ -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);
}
}

View File

@ -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) {

View File

@ -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);
}

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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 ) {

View File

@ -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 ) {

View File

@ -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;
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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],

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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<BACKLIGHT_LED_COUNT; i++ )
{
@ -1390,8 +1390,8 @@ void backlight_effect_raindrops(bool initialize)
int16_t s2 = g_config.color_2.s;
int16_t deltaS = ( s2 - s1 ) / 4;
HSV hsv;
RGB rgb;
hsv_t hsv;
rgb_t rgb;
// Change one LED every tick
uint8_t led_to_change = ( g_tick & 0x000 ) == 0 ? rand() % BACKLIGHT_LED_COUNT : 255;
@ -1431,8 +1431,8 @@ void backlight_effect_cycle_all(void)
#endif
offset2 = (offset2<=63) ? (63-offset2) : 0;
HSV hsv = { .h = offset+offset2, .s = 255, .v = g_config.brightness };
RGB rgb = hsv_to_rgb( hsv );
hsv_t hsv = { .h = offset+offset2, .s = 255, .v = g_config.brightness };
rgb_t rgb = hsv_to_rgb( hsv );
backlight_set_color( i, rgb.r, rgb.g, rgb.b );
}
}
@ -1440,8 +1440,8 @@ void backlight_effect_cycle_all(void)
void backlight_effect_cycle_left_right(void)
{
uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF;
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<BACKLIGHT_LED_COUNT; i++ )
{
@ -1467,8 +1467,8 @@ void backlight_effect_cycle_left_right(void)
void backlight_effect_cycle_up_down(void)
{
uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF;
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<BACKLIGHT_LED_COUNT; i++ )
{
@ -1493,8 +1493,8 @@ void backlight_effect_cycle_up_down(void)
void backlight_effect_jellybean_raindrops( bool initialize )
{
HSV hsv;
RGB rgb;
hsv_t hsv;
rgb_t rgb;
// Change one LED every tick
uint8_t led_to_change = ( g_tick & 0x000 ) == 0 ? rand() % BACKLIGHT_LED_COUNT : 255;
@ -1519,8 +1519,8 @@ void backlight_effect_jellybean_raindrops( bool initialize )
void backlight_effect_cycle_radial1(void)
{
uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF;
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<BACKLIGHT_LED_COUNT; i++ )
{
@ -1537,8 +1537,8 @@ void backlight_effect_cycle_radial2(void)
{
uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF;
HSV hsv = { .h = 0, .s = g_config.color_1.s, .v = g_config.brightness };
RGB rgb;
hsv_t hsv = { .h = 0, .s = g_config.color_1.s, .v = g_config.brightness };
rgb_t rgb;
Point point;
for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ )
{
@ -1559,10 +1559,10 @@ void backlight_effect_cycle_radial2(void)
#if defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_M10_C)
void backlight_effect_custom_colors(void)
{
RGB rgb;
rgb_t rgb;
for ( uint8_t i = 0; i < RGB_BACKLIGHT_CUSTOM_COLORS_COUNT; i++ )
{
HSV hsv = { .h = g_config.custom_color[i].h, .s = g_config.custom_color[i].s, .v = g_config.brightness };
hsv_t hsv = { .h = g_config.custom_color[i].h, .s = g_config.custom_color[i].s, .v = g_config.brightness };
rgb = hsv_to_rgb( hsv );
uint8_t led;
map_row_column_to_led( 0, i, &led );
@ -1580,8 +1580,8 @@ void backlight_effect_custom_colors(void)
void backlight_effect_indicators_set_colors( uint8_t index, HS color )
{
HSV hsv = { .h = color.h, .s = color.s, .v = g_config.brightness };
RGB rgb = hsv_to_rgb( hsv );
hsv_t hsv = { .h = color.h, .s = color.s, .v = g_config.brightness };
rgb_t rgb = hsv_to_rgb( hsv );
if ( index == 254 )
{
backlight_set_color_all( rgb.r, rgb.g, rgb.b );

View File

@ -13,8 +13,8 @@ RGB_MATRIX_EFFECT(startup_animation_solid)
static void startup_animation_setleds(effect_params_t* params, bool dots) {
uint8_t factor = 5;
HSV hsv = rgb_matrix_config.hsv;
RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
hsv_t hsv = rgb_matrix_config.hsv;
rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
if (dots) {
rgb_matrix_set_color_all(0, 0, 0);
}

View File

@ -8,6 +8,6 @@ static inline void rgblite_init(void) {
}
static inline void rgblite_setrgb(uint8_t _r, uint8_t _g, uint8_t _b) {
rgb_led_t leds[RGBLIGHT_LED_COUNT] = {{.r = _r, .g = _g, .b = _b}, {.r = _r, .g = _g, .b = _b}};
rgb_t leds[RGBLIGHT_LED_COUNT] = {{.r = _r, .g = _g, .b = _b}, {.r = _r, .g = _g, .b = _b}};
ws2812_setleds(leds, RGBLIGHT_LED_COUNT);
}

View File

@ -27,7 +27,7 @@ enum layer_names {
_FN
};
#define _HSV(H, S, V) (HSV){ .h = H, .s = S, .v = V }
#define _HSV(H, S, V) (hsv_t){ .h = H, .s = S, .v = V }
#define _RGB(rgb) rgb.r, rgb.g, rgb.b
bool input_mode(void);

View File

@ -52,17 +52,17 @@ const uint8_t rgb_keymaps [][RGB_MATRIX_LED_COUNT] = {
};
static void led_color_set(uint8_t index, uint8_t color_patterns) {
HSV hsv = rgb_matrix_config.hsv; // 'quantum/color.h'
RGB rgb_white = hsv_to_rgb(_HSV( 0, 0, hsv.v)); // HSV_WHITE
RGB rgb_indc1 = hsv_to_rgb(_HSV(128, 255, hsv.v)); // HSV_TEAL
RGB rgb_indc2 = hsv_to_rgb(_HSV(191, 255, hsv.v)); // HSV_PURPLE
RGB rgb_indc3 = hsv_to_rgb(_HSV( 64, 255, hsv.v)); // HSV_CHARTREUSE
RGB rgb_indc4 = hsv_to_rgb(_HSV(106, 255, hsv.v)); // HSV_SPRINGGREEN
RGB rgb_indc5 = hsv_to_rgb(_HSV(234, 128, hsv.v)); // HSV_PINK
RGB rgb_indc6 = hsv_to_rgb(_HSV(213, 255, hsv.v)); // HSV_MAGENTA
RGB rgb_indc_ja = hsv_to_rgb(_HSV( 0, 255, hsv.v)); // HSV_RED
RGB rgb_indc_en = hsv_to_rgb(_HSV( 85, 255, hsv.v)); // HSV_GREEN
RGB rgb_indc_win = hsv_to_rgb(_HSV(170, 255, hsv.v)); // HSV_BLUE
hsv_t hsv = rgb_matrix_config.hsv; // 'quantum/color.h'
rgb_t rgb_white = hsv_to_rgb(_HSV( 0, 0, hsv.v)); // HSV_WHITE
rgb_t rgb_indc1 = hsv_to_rgb(_HSV(128, 255, hsv.v)); // HSV_TEAL
rgb_t rgb_indc2 = hsv_to_rgb(_HSV(191, 255, hsv.v)); // HSV_PURPLE
rgb_t rgb_indc3 = hsv_to_rgb(_HSV( 64, 255, hsv.v)); // HSV_CHARTREUSE
rgb_t rgb_indc4 = hsv_to_rgb(_HSV(106, 255, hsv.v)); // HSV_SPRINGGREEN
rgb_t rgb_indc5 = hsv_to_rgb(_HSV(234, 128, hsv.v)); // HSV_PINK
rgb_t rgb_indc6 = hsv_to_rgb(_HSV(213, 255, hsv.v)); // HSV_MAGENTA
rgb_t rgb_indc_ja = hsv_to_rgb(_HSV( 0, 255, hsv.v)); // HSV_RED
rgb_t rgb_indc_en = hsv_to_rgb(_HSV( 85, 255, hsv.v)); // HSV_GREEN
rgb_t rgb_indc_win = hsv_to_rgb(_HSV(170, 255, hsv.v)); // HSV_BLUE
switch(color_patterns){
case BOUT: rgb_matrix_set_color(index, RGB_BLACK); break;
case _____: rgb_matrix_set_color(index, _RGB(rgb_white)); break;