Rename RGB and HSV structs (#24471)
This commit is contained in:
parent
a10e7cc858
commit
6129af93f4
59 changed files with 122 additions and 117 deletions
|
@ -6,10 +6,10 @@ RGB_MATRIX_EFFECT(ALPHAS_MODS)
|
|||
bool ALPHAS_MODS(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = rgb_matrix_config.hsv;
|
||||
RGB rgb1 = rgb_matrix_hsv_to_rgb(hsv);
|
||||
hsv_t hsv = rgb_matrix_config.hsv;
|
||||
rgb_t rgb1 = rgb_matrix_hsv_to_rgb(hsv);
|
||||
hsv.h += rgb_matrix_config.speed;
|
||||
RGB rgb2 = rgb_matrix_hsv_to_rgb(hsv);
|
||||
rgb_t rgb2 = rgb_matrix_hsv_to_rgb(hsv);
|
||||
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
|
|
|
@ -5,10 +5,10 @@ RGB_MATRIX_EFFECT(BREATHING)
|
|||
bool BREATHING(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);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(BAND_PINWHEEL_SAT)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV BAND_PINWHEEL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||
static hsv_t BAND_PINWHEEL_SAT_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||
hsv.s = scale8(hsv.s - time - atan2_8(dy, dx) * 3, hsv.s);
|
||||
return hsv;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(BAND_PINWHEEL_VAL)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV BAND_PINWHEEL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||
static hsv_t BAND_PINWHEEL_VAL_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||
hsv.v = scale8(hsv.v - time - atan2_8(dy, dx) * 3, hsv.v);
|
||||
return hsv;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(BAND_SAT)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV BAND_SAT_math(HSV hsv, uint8_t i, uint8_t time) {
|
||||
static hsv_t BAND_SAT_math(hsv_t hsv, uint8_t i, uint8_t time) {
|
||||
int16_t s = hsv.s - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8;
|
||||
hsv.s = scale8(s < 0 ? 0 : s, hsv.s);
|
||||
return hsv;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(BAND_SPIRAL_SAT)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV BAND_SPIRAL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
static hsv_t BAND_SPIRAL_SAT_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
hsv.s = scale8(hsv.s + dist - time - atan2_8(dy, dx), hsv.s);
|
||||
return hsv;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(BAND_SPIRAL_VAL)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV BAND_SPIRAL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
static hsv_t BAND_SPIRAL_VAL_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
hsv.v = scale8(hsv.v + dist - time - atan2_8(dy, dx), hsv.v);
|
||||
return hsv;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(BAND_VAL)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV BAND_VAL_math(HSV hsv, uint8_t i, uint8_t time) {
|
||||
static hsv_t BAND_VAL_math(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;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(CYCLE_ALL)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV CYCLE_ALL_math(HSV hsv, uint8_t i, uint8_t time) {
|
||||
static hsv_t CYCLE_ALL_math(hsv_t hsv, uint8_t i, uint8_t time) {
|
||||
hsv.h = time;
|
||||
return hsv;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(CYCLE_LEFT_RIGHT)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV CYCLE_LEFT_RIGHT_math(HSV hsv, uint8_t i, uint8_t time) {
|
||||
static hsv_t CYCLE_LEFT_RIGHT_math(hsv_t hsv, uint8_t i, uint8_t time) {
|
||||
hsv.h = g_led_config.point[i].x - time;
|
||||
return hsv;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(CYCLE_OUT_IN)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV CYCLE_OUT_IN_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
static hsv_t CYCLE_OUT_IN_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
hsv.h = 3 * dist / 2 + time;
|
||||
return hsv;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(CYCLE_OUT_IN_DUAL)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV CYCLE_OUT_IN_DUAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||
static hsv_t CYCLE_OUT_IN_DUAL_math(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;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(CYCLE_PINWHEEL)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV CYCLE_PINWHEEL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||
static hsv_t CYCLE_PINWHEEL_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||
hsv.h = atan2_8(dy, dx) + time;
|
||||
return hsv;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(CYCLE_SPIRAL)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV CYCLE_SPIRAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
static hsv_t CYCLE_SPIRAL_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
hsv.h = dist - time - atan2_8(dy, dx);
|
||||
return hsv;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(CYCLE_UP_DOWN)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV CYCLE_UP_DOWN_math(HSV hsv, uint8_t i, uint8_t time) {
|
||||
static hsv_t CYCLE_UP_DOWN_math(hsv_t hsv, uint8_t i, uint8_t time) {
|
||||
hsv.h = g_led_config.point[i].y - time;
|
||||
return hsv;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(DUAL_BEACON)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV DUAL_BEACON_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
|
||||
static hsv_t DUAL_BEACON_math(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) * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * sin) / 128;
|
||||
return hsv;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
RGB_MATRIX_EFFECT(FLOWER_BLOOMING)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
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);
|
||||
|
@ -27,17 +27,17 @@ 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);
|
||||
}
|
||||
}
|
||||
return rgb_matrix_check_finished_leds(led_max);
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -5,14 +5,14 @@ RGB_MATRIX_EFFECT(GRADIENT_LEFT_RIGHT)
|
|||
bool GRADIENT_LEFT_RIGHT(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;
|
||||
uint8_t scale = scale8(64, rgb_matrix_config.speed);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
// The x range will be 0..224, map this to 0..7
|
||||
// Relies on hue being 8-bit and wrapping
|
||||
hsv.h = rgb_matrix_config.hsv.h + (scale * g_led_config.point[i].x >> 5);
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
hsv.h = rgb_matrix_config.hsv.h + (scale * g_led_config.point[i].x >> 5);
|
||||
rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return rgb_matrix_check_finished_leds(led_max);
|
||||
|
|
|
@ -5,14 +5,14 @@ RGB_MATRIX_EFFECT(GRADIENT_UP_DOWN)
|
|||
bool GRADIENT_UP_DOWN(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;
|
||||
uint8_t scale = scale8(64, rgb_matrix_config.speed);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
// The y range will be 0..64, map this to 0..4
|
||||
// Relies on hue being 8-bit and wrapping
|
||||
hsv.h = rgb_matrix_config.hsv.h + scale * (g_led_config.point[i].y >> 4);
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
hsv.h = rgb_matrix_config.hsv.h + scale * (g_led_config.point[i].y >> 4);
|
||||
rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return rgb_matrix_check_finished_leds(led_max);
|
||||
|
|
|
@ -7,10 +7,10 @@ RGB_MATRIX_EFFECT(HUE_BREATHING)
|
|||
bool HUE_BREATHING(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
uint8_t huedelta = 12;
|
||||
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.h = hsv.h + scale8(abs8(sin8(time) - 128) * 2, huedelta);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_t rgb = 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);
|
||||
|
|
|
@ -5,7 +5,7 @@ RGB_MATRIX_EFFECT(HUE_PENDULUM)
|
|||
// Change huedelta to adjust range of hue change. 0-255.
|
||||
// Looks better with a low value and slow speed for subtle change.
|
||||
// Hue Pendulum - color changes in a wave to the right before reversing direction
|
||||
static HSV HUE_PENDULUM_math(HSV hsv, uint8_t i, uint8_t time) {
|
||||
static hsv_t HUE_PENDULUM_math(hsv_t hsv, uint8_t i, uint8_t time) {
|
||||
uint8_t huedelta = 12;
|
||||
hsv.h = hsv.h + scale8(abs8(sin8(time) + (g_led_config.point[i].x) - 128) * 2, huedelta);
|
||||
return hsv;
|
||||
|
|
|
@ -5,7 +5,7 @@ RGB_MATRIX_EFFECT(HUE_WAVE)
|
|||
// Change huedelta to adjust range of hue change. 0-255.
|
||||
// Looks better with a low value and slow speed for subtle change.
|
||||
// Hue Wave - color changes in a wave to the right
|
||||
static HSV HUE_WAVE_math(HSV hsv, uint8_t i, uint8_t time) {
|
||||
static hsv_t HUE_WAVE_math(hsv_t hsv, uint8_t i, uint8_t time) {
|
||||
uint8_t huedelta = 24;
|
||||
hsv.h = hsv.h + scale8(abs8(g_led_config.point[i].x - time), huedelta);
|
||||
return hsv;
|
||||
|
|
|
@ -4,8 +4,8 @@ RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS)
|
|||
|
||||
static void jellybean_raindrops_set_color(int i, effect_params_t* params) {
|
||||
if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
|
||||
HSV hsv = {random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v};
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
hsv_t hsv = {random8(), random8_min_max(127, 255), 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ RGB_MATRIX_EFFECT(PIXEL_FLOW)
|
|||
|
||||
static bool PIXEL_FLOW(effect_params_t* params) {
|
||||
// LED state array
|
||||
static RGB led[RGB_MATRIX_LED_COUNT];
|
||||
static rgb_t led[RGB_MATRIX_LED_COUNT];
|
||||
|
||||
static uint32_t wait_timer = 0;
|
||||
if (wait_timer > g_rgb_timer) {
|
||||
|
@ -22,7 +22,7 @@ static bool PIXEL_FLOW(effect_params_t* params) {
|
|||
// Clear LEDs and fill the state array
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
for (uint8_t j = 0; j < RGB_MATRIX_LED_COUNT; ++j) {
|
||||
led[j] = (random8() & 2) ? (RGB){0, 0, 0} : hsv_to_rgb((HSV){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v});
|
||||
led[j] = (random8() & 2) ? (rgb_t){0, 0, 0} : hsv_to_rgb((hsv_t){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ static bool PIXEL_FLOW(effect_params_t* params) {
|
|||
led[j] = led[j + 1];
|
||||
}
|
||||
// Fill last LED
|
||||
led[led_max - 1] = (random8() & 2) ? (RGB){0, 0, 0} : hsv_to_rgb((HSV){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v});
|
||||
led[led_max - 1] = (random8() & 2) ? (rgb_t){0, 0, 0} : hsv_to_rgb((hsv_t){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v});
|
||||
// Set pulse timer
|
||||
wait_timer = g_rgb_timer + interval();
|
||||
}
|
||||
|
|
|
@ -26,11 +26,11 @@ static bool PIXEL_FRACTAL(effect_params_t* params) {
|
|||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
if (g_rgb_timer > wait_timer) {
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(rgb_matrix_config.hsv);
|
||||
rgb_t rgb = rgb_matrix_hsv_to_rgb(rgb_matrix_config.hsv);
|
||||
for (uint8_t h = 0; h < MATRIX_ROWS; ++h) {
|
||||
// Light and copy columns outward
|
||||
for (uint8_t l = 0; l < MID_COL - 1; ++l) {
|
||||
RGB index_rgb = led[h][l] ? (RGB){rgb.r, rgb.g, rgb.b} : (RGB){0, 0, 0};
|
||||
rgb_t index_rgb = led[h][l] ? (rgb_t){rgb.r, rgb.g, rgb.b} : (rgb_t){0, 0, 0};
|
||||
if (HAS_ANY_FLAGS(g_led_config.flags[g_led_config.matrix_co[h][l]], params->flags)) {
|
||||
rgb_matrix_set_color(g_led_config.matrix_co[h][l], index_rgb.r, index_rgb.g, index_rgb.b);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ static bool PIXEL_FRACTAL(effect_params_t* params) {
|
|||
}
|
||||
|
||||
// Light both middle columns
|
||||
RGB index_rgb = led[h][MID_COL - 1] ? (RGB){rgb.r, rgb.g, rgb.b} : (RGB){0, 0, 0};
|
||||
rgb_t index_rgb = led[h][MID_COL - 1] ? (rgb_t){rgb.r, rgb.g, rgb.b} : (rgb_t){0, 0, 0};
|
||||
if (HAS_ANY_FLAGS(g_led_config.flags[g_led_config.matrix_co[h][MID_COL - 1]], params->flags)) {
|
||||
rgb_matrix_set_color(g_led_config.matrix_co[h][MID_COL - 1], index_rgb.r, index_rgb.g, index_rgb.b);
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ static bool PIXEL_RAIN(effect_params_t* params) {
|
|||
if (!HAS_ANY_FLAGS(g_led_config.flags[led_index], params->flags)) {
|
||||
return;
|
||||
}
|
||||
HSV hsv = (random8() & 2) ? (HSV){0, 0, 0} : (HSV){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v};
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
hsv_t hsv = (random8() & 2) ? (hsv_t){0, 0, 0} : (hsv_t){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v};
|
||||
rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(led_index, rgb.r, rgb.g, rgb.b);
|
||||
wait_timer = g_rgb_timer + interval();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(RAINBOW_BEACON)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV RAINBOW_BEACON_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
|
||||
static hsv_t RAINBOW_BEACON_math(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;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(RAINBOW_MOVING_CHEVRON)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV RAINBOW_MOVING_CHEVRON_math(HSV hsv, uint8_t i, uint8_t time) {
|
||||
static hsv_t RAINBOW_MOVING_CHEVRON_math(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;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
RGB_MATRIX_EFFECT(RAINBOW_PINWHEELS)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV RAINBOW_PINWHEELS_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
|
||||
static hsv_t RAINBOW_PINWHEELS_math(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) * 3 * cos + (56 - abs8(g_led_config.point[i].x - k_rgb_matrix_center.x)) * 3 * sin) / 128;
|
||||
return hsv;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ RGB_MATRIX_EFFECT(RAINDROPS)
|
|||
|
||||
static void raindrops_set_color(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;
|
||||
|
@ -14,8 +14,8 @@ static void raindrops_set_color(int i, effect_params_t* params) {
|
|||
deltaH += 256;
|
||||
}
|
||||
|
||||
hsv.h = rgb_matrix_config.hsv.h + (deltaH * (random8() & 0x03));
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
hsv.h = rgb_matrix_config.hsv.h + (deltaH * (random8() & 0x03));
|
||||
rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ bool RIVERFLOW(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();
|
||||
HSV hsv = rgb_matrix_config.hsv;
|
||||
hsv_t hsv = rgb_matrix_config.hsv;
|
||||
uint16_t time = scale16by8(g_rgb_timer + (i * 315), 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);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
typedef HSV (*dx_dy_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t time);
|
||||
typedef hsv_t (*dx_dy_f)(hsv_t hsv, int16_t dx, int16_t dy, uint8_t time);
|
||||
|
||||
bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
@ -10,7 +10,7 @@ bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) {
|
|||
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 rgb_matrix_check_finished_leds(led_max);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
typedef HSV (*dx_dy_dist_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time);
|
||||
typedef hsv_t (*dx_dy_dist_f)(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time);
|
||||
|
||||
bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
@ -11,7 +11,7 @@ bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func)
|
|||
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;
|
||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, dist, time));
|
||||
rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, dist, time));
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return rgb_matrix_check_finished_leds(led_max);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
typedef HSV (*i_f)(HSV hsv, uint8_t i, uint8_t time);
|
||||
typedef hsv_t (*i_f)(hsv_t hsv, uint8_t i, uint8_t time);
|
||||
|
||||
bool effect_runner_i(effect_params_t* params, i_f effect_func) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
@ -8,7 +8,7 @@ bool effect_runner_i(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 rgb_matrix_check_finished_leds(led_max);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
||||
typedef HSV (*reactive_f)(HSV hsv, uint16_t offset);
|
||||
typedef hsv_t (*reactive_f)(hsv_t hsv, uint16_t offset);
|
||||
|
||||
bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
@ -20,7 +20,7 @@ bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) {
|
|||
}
|
||||
|
||||
uint16_t offset = scale16by8(tick, qadd8(rgb_matrix_config.speed, 1));
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, offset));
|
||||
rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, offset));
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return rgb_matrix_check_finished_leds(led_max);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
||||
typedef HSV (*reactive_splash_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick);
|
||||
typedef hsv_t (*reactive_splash_f)(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick);
|
||||
|
||||
bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, reactive_splash_f effect_func) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
@ -10,8 +10,8 @@ bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, react
|
|||
uint8_t count = g_last_hit_tracker.count;
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
HSV hsv = rgb_matrix_config.hsv;
|
||||
hsv.v = 0;
|
||||
hsv_t hsv = rgb_matrix_config.hsv;
|
||||
hsv.v = 0;
|
||||
for (uint8_t j = start; j < count; j++) {
|
||||
int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j];
|
||||
int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j];
|
||||
|
@ -19,8 +19,8 @@ bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, react
|
|||
uint16_t tick = scale16by8(g_last_hit_tracker.tick[j], qadd8(rgb_matrix_config.speed, 1));
|
||||
hsv = effect_func(hsv, dx, dy, dist, tick);
|
||||
}
|
||||
hsv.v = scale8(hsv.v, rgb_matrix_config.hsv.v);
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
hsv.v = scale8(hsv.v, 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);
|
||||
}
|
||||
return rgb_matrix_check_finished_leds(led_max);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
typedef HSV (*sin_cos_i_f)(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time);
|
||||
typedef hsv_t (*sin_cos_i_f)(hsv_t hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time);
|
||||
|
||||
bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
@ -10,7 +10,7 @@ bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) {
|
|||
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 rgb_matrix_check_finished_leds(led_max);
|
||||
|
|
|
@ -4,7 +4,7 @@ RGB_MATRIX_EFFECT(SOLID_COLOR)
|
|||
bool SOLID_COLOR(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(rgb_matrix_config.hsv);
|
||||
rgb_t rgb = rgb_matrix_hsv_to_rgb(rgb_matrix_config.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);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
RGB_MATRIX_EFFECT(SOLID_REACTIVE)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV SOLID_REACTIVE_math(HSV hsv, uint16_t offset) {
|
||||
static hsv_t SOLID_REACTIVE_math(hsv_t hsv, uint16_t offset) {
|
||||
# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE
|
||||
hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4);
|
||||
# endif
|
||||
|
|
|
@ -11,7 +11,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS)
|
|||
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV SOLID_REACTIVE_CROSS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||
static hsv_t SOLID_REACTIVE_CROSS_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;
|
||||
dy = dy < 0 ? dy * -1 : dy;
|
||||
|
|
|
@ -11,7 +11,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS)
|
|||
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV SOLID_REACTIVE_NEXUS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||
static hsv_t SOLID_REACTIVE_NEXUS_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||
uint16_t effect = tick - dist;
|
||||
if (effect > 255) effect = 255;
|
||||
if (dist > 72) effect = 255;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
RGB_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV SOLID_REACTIVE_SIMPLE_math(HSV hsv, uint16_t offset) {
|
||||
static hsv_t SOLID_REACTIVE_SIMPLE_math(hsv_t hsv, uint16_t offset) {
|
||||
# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE
|
||||
hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4);
|
||||
# endif
|
||||
|
|
|
@ -11,7 +11,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE)
|
|||
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV SOLID_REACTIVE_WIDE_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||
static hsv_t SOLID_REACTIVE_WIDE_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||
uint16_t effect = tick + dist * 5;
|
||||
if (effect > 255) effect = 255;
|
||||
# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE
|
||||
|
|
|
@ -11,7 +11,7 @@ RGB_MATRIX_EFFECT(SOLID_MULTISPLASH)
|
|||
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
HSV SOLID_SPLASH_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||
hsv_t SOLID_SPLASH_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||
uint16_t effect = tick - dist;
|
||||
if (effect > 255) effect = 255;
|
||||
hsv.v = qadd8(hsv.v, 255 - effect);
|
||||
|
|
|
@ -11,7 +11,7 @@ RGB_MATRIX_EFFECT(MULTISPLASH)
|
|||
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
HSV SPLASH_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||
hsv_t SPLASH_math(hsv_t hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||
uint16_t effect = tick - dist;
|
||||
if (effect > 255) effect = 255;
|
||||
hsv.h += effect;
|
||||
|
|
|
@ -4,9 +4,9 @@ RGB_MATRIX_EFFECT(STARLIGHT)
|
|||
|
||||
void set_starlight_color(uint8_t i, effect_params_t* params) {
|
||||
uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8);
|
||||
HSV hsv = rgb_matrix_config.hsv;
|
||||
hsv_t hsv = rgb_matrix_config.hsv;
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ RGB_MATRIX_EFFECT(STARLIGHT_DUAL_HUE)
|
|||
|
||||
void set_starlight_dual_hue_color(uint8_t i, effect_params_t* params) {
|
||||
uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8);
|
||||
HSV hsv = rgb_matrix_config.hsv;
|
||||
hsv_t hsv = rgb_matrix_config.hsv;
|
||||
hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
|
||||
hsv.h = hsv.h + random8_max((30 + 1 - -30) + -30);
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ RGB_MATRIX_EFFECT(STARLIGHT_DUAL_SAT)
|
|||
|
||||
void set_starlight_dual_sat_color(uint8_t i, effect_params_t* params) {
|
||||
uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8);
|
||||
HSV hsv = rgb_matrix_config.hsv;
|
||||
hsv_t hsv = rgb_matrix_config.hsv;
|
||||
hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
|
||||
hsv.s = hsv.s + random8_max((30 + 1 - -30) + -30);
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -82,8 +82,8 @@ bool TYPING_HEATMAP(effect_params_t* params) {
|
|||
uint8_t val = g_rgb_frame_buffer[row][col];
|
||||
if (!HAS_ANY_FLAGS(g_led_config.flags[g_led_config.matrix_co[row][col]], params->flags)) continue;
|
||||
|
||||
HSV hsv = {170 - qsub8(val, 85), rgb_matrix_config.hsv.s, scale8((qadd8(170, val) - 170) * 3, rgb_matrix_config.hsv.v)};
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
hsv_t hsv = {170 - qsub8(val, 85), rgb_matrix_config.hsv.s, scale8((qadd8(170, val) - 170) * 3, rgb_matrix_config.hsv.v)};
|
||||
rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(g_led_config.matrix_co[row][col], rgb.r, rgb.g, rgb.b);
|
||||
|
||||
if (decrease_heatmap_values) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue