Rename RGB and HSV structs (#24471)
This commit is contained in:
parent
a10e7cc858
commit
6129af93f4
@ -53,8 +53,8 @@
|
||||
io_wait; \
|
||||
} while (0)
|
||||
|
||||
rgb_led_t apa102_leds[APA102_LED_COUNT];
|
||||
uint8_t apa102_led_brightness = APA102_DEFAULT_BRIGHTNESS;
|
||||
rgb_t apa102_leds[APA102_LED_COUNT];
|
||||
uint8_t apa102_led_brightness = APA102_DEFAULT_BRIGHTNESS;
|
||||
|
||||
static void apa102_send_byte(uint8_t byte) {
|
||||
APA102_SEND_BIT(byte, 7);
|
||||
|
@ -52,7 +52,7 @@ static bool qp_surface_pixdata_rgb565(painter_device_t device, const void *pixel
|
||||
// Pixel colour conversion
|
||||
static bool qp_surface_palette_convert_rgb565_swapped(painter_device_t device, int16_t palette_size, qp_pixel_t *palette) {
|
||||
for (int16_t i = 0; i < palette_size; ++i) {
|
||||
RGB rgb = hsv_to_rgb_nocie((HSV){palette[i].hsv888.h, palette[i].hsv888.s, palette[i].hsv888.v});
|
||||
rgb_t rgb = hsv_to_rgb_nocie((hsv_t){palette[i].hsv888.h, palette[i].hsv888.s, palette[i].hsv888.v});
|
||||
uint16_t rgb565 = (((uint16_t)rgb.r) >> 3) << 11 | (((uint16_t)rgb.g) >> 2) << 5 | (((uint16_t)rgb.b) >> 3);
|
||||
palette[i].rgb565 = __builtin_bswap16(rgb565);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ bool qp_tft_panel_pixdata(painter_device_t device, const void *pixel_data, uint3
|
||||
|
||||
bool qp_tft_panel_palette_convert_rgb565_swapped(painter_device_t device, int16_t palette_size, qp_pixel_t *palette) {
|
||||
for (int16_t i = 0; i < palette_size; ++i) {
|
||||
RGB rgb = hsv_to_rgb_nocie((HSV){palette[i].hsv888.h, palette[i].hsv888.s, palette[i].hsv888.v});
|
||||
rgb_t rgb = hsv_to_rgb_nocie((hsv_t){palette[i].hsv888.h, palette[i].hsv888.s, palette[i].hsv888.v});
|
||||
uint16_t rgb565 = (((uint16_t)rgb.r) >> 3) << 11 | (((uint16_t)rgb.g) >> 2) << 5 | (((uint16_t)rgb.b) >> 3);
|
||||
palette[i].rgb565 = __builtin_bswap16(rgb565);
|
||||
}
|
||||
@ -99,7 +99,7 @@ bool qp_tft_panel_palette_convert_rgb565_swapped(painter_device_t device, int16_
|
||||
|
||||
bool qp_tft_panel_palette_convert_rgb888(painter_device_t device, int16_t palette_size, qp_pixel_t *palette) {
|
||||
for (int16_t i = 0; i < palette_size; ++i) {
|
||||
RGB rgb = hsv_to_rgb_nocie((HSV){palette[i].hsv888.h, palette[i].hsv888.s, palette[i].hsv888.v});
|
||||
rgb_t rgb = hsv_to_rgb_nocie((hsv_t){palette[i].hsv888.h, palette[i].hsv888.s, palette[i].hsv888.v});
|
||||
palette[i].rgb888.r = rgb.r;
|
||||
palette[i].rgb888.g = rgb.g;
|
||||
palette[i].rgb888.b = rgb.b;
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include "progmem.h"
|
||||
#include "util.h"
|
||||
|
||||
RGB hsv_to_rgb_impl(HSV hsv, bool use_cie) {
|
||||
RGB rgb;
|
||||
rgb_t hsv_to_rgb_impl(hsv_t hsv, bool use_cie) {
|
||||
rgb_t rgb;
|
||||
uint8_t region, remainder, p, q, t;
|
||||
uint16_t h, s, v;
|
||||
|
||||
@ -97,7 +97,7 @@ RGB hsv_to_rgb_impl(HSV hsv, bool use_cie) {
|
||||
return rgb;
|
||||
}
|
||||
|
||||
RGB hsv_to_rgb(HSV hsv) {
|
||||
rgb_t hsv_to_rgb(hsv_t hsv) {
|
||||
#ifdef USE_CIE1931_CURVE
|
||||
return hsv_to_rgb_impl(hsv, true);
|
||||
#else
|
||||
@ -105,6 +105,6 @@ RGB hsv_to_rgb(HSV hsv) {
|
||||
#endif
|
||||
}
|
||||
|
||||
RGB hsv_to_rgb_nocie(HSV hsv) {
|
||||
rgb_t hsv_to_rgb_nocie(hsv_t hsv) {
|
||||
return hsv_to_rgb_impl(hsv, false);
|
||||
}
|
||||
|
@ -74,19 +74,24 @@
|
||||
|
||||
// clang-format on
|
||||
|
||||
typedef struct PACKED rgb_led_t {
|
||||
typedef struct PACKED rgb_t {
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
} rgb_led_t;
|
||||
} rgb_t;
|
||||
|
||||
typedef rgb_led_t RGB;
|
||||
// DEPRECATED
|
||||
typedef rgb_t RGB;
|
||||
typedef rgb_t rgb_led_t;
|
||||
|
||||
typedef struct PACKED HSV {
|
||||
typedef struct PACKED hsv_t {
|
||||
uint8_t h;
|
||||
uint8_t s;
|
||||
uint8_t v;
|
||||
} HSV;
|
||||
} hsv_t;
|
||||
|
||||
RGB hsv_to_rgb(HSV hsv);
|
||||
RGB hsv_to_rgb_nocie(HSV hsv);
|
||||
// DEPRECATED
|
||||
typedef hsv_t HSV;
|
||||
|
||||
rgb_t hsv_to_rgb(hsv_t hsv);
|
||||
rgb_t hsv_to_rgb_nocie(hsv_t hsv);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user