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

Some files were not shown because too many files have changed in this diff Show More