commit
a90a78c265
@ -1,6 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define RGB_MATRIX_KEYPRESSES
|
#define RGB_MATRIX_KEYPRESSES
|
||||||
|
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
|
||||||
|
|
||||||
#define DISABLE_RGB_MATRIX_DIGITAL_RAIN
|
#define DISABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||||
#define DISABLE_RGB_MATRIX_ALPHAS_MODS
|
#define DISABLE_RGB_MATRIX_ALPHAS_MODS
|
||||||
|
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
|
||||||
|
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
|
||||||
|
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
|
||||||
|
#define DISABLE_RGB_MATRIX_SPLASH
|
||||||
|
#define DISABLE_RGB_MATRIX_SOLID_SPLASH
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
|
||||||
|
RGB_MATRIX_EFFECT(BAND_PINWHEEL_SAT)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
|
static void BAND_PINWHEEL_SAT_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||||
|
hsv->s = rgb_matrix_config.sat - time - atan2_8(dy, dx) * 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BAND_PINWHEEL_SAT(effect_params_t* params) {
|
||||||
|
return effect_runner_dx_dy(params, &BAND_PINWHEEL_SAT_math);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
#endif // DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
|
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
|
||||||
|
RGB_MATRIX_EFFECT(BAND_PINWHEEL_VAL)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
|
static void BAND_PINWHEEL_VAL_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||||
|
hsv->v = rgb_matrix_config.val - time - atan2_8(dy, dx) * 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BAND_PINWHEEL_VAL(effect_params_t* params) {
|
||||||
|
return effect_runner_dx_dy(params, &BAND_PINWHEEL_VAL_math);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
#endif // DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
|
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef DISABLE_RGB_MATRIX_BAND_SAT
|
||||||
|
RGB_MATRIX_EFFECT(BAND_SAT)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
|
static void BAND_SAT_math(HSV* hsv, uint8_t i, uint8_t time) {
|
||||||
|
int16_t s = rgb_matrix_config.sat - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8;
|
||||||
|
hsv->s = s < 0 ? 0 : s;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BAND_SAT(effect_params_t* params) {
|
||||||
|
return effect_runner_i(params, &BAND_SAT_math);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
#endif // DISABLE_RGB_MATRIX_BAND_SAT
|
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
|
||||||
|
RGB_MATRIX_EFFECT(BAND_SPIRAL_SAT)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
|
static void BAND_SPIRAL_SAT_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||||
|
hsv->s = rgb_matrix_config.sat + dist - time - atan2_8(dy, dx);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BAND_SPIRAL_SAT(effect_params_t* params) {
|
||||||
|
return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_SAT_math);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
#endif // DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
|
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL
|
||||||
|
RGB_MATRIX_EFFECT(BAND_SPIRAL_VAL)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
|
static void BAND_SPIRAL_VAL_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||||
|
hsv->v = rgb_matrix_config.val + dist - time - atan2_8(dy, dx);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BAND_SPIRAL_VAL(effect_params_t* params) {
|
||||||
|
return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_VAL_math);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
#endif // DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL
|
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef DISABLE_RGB_MATRIX_BAND_VAL
|
||||||
|
RGB_MATRIX_EFFECT(BAND_VAL)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
|
static void BAND_VAL_math(HSV* hsv, uint8_t i, uint8_t time) {
|
||||||
|
int16_t v = rgb_matrix_config.val - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8;
|
||||||
|
hsv->v = v < 0 ? 0 : v;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BAND_VAL(effect_params_t* params) {
|
||||||
|
return effect_runner_i(params, &BAND_VAL_math);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
#endif // DISABLE_RGB_MATRIX_BAND_VAL
|
@ -1,21 +1,15 @@
|
|||||||
#pragma once
|
|
||||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
|
#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
|
||||||
|
RGB_MATRIX_EFFECT(CYCLE_ALL)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
static void CYCLE_ALL_math(HSV* hsv, uint8_t i, uint8_t time)
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
{
|
||||||
extern rgb_config_t rgb_matrix_config;
|
hsv->h = time;
|
||||||
|
|
||||||
bool rgb_matrix_cycle_all(effect_params_t* params) {
|
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
|
||||||
|
|
||||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
|
||||||
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
|
||||||
hsv.h = time;
|
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
|
||||||
}
|
}
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
|
||||||
|
bool CYCLE_ALL(effect_params_t* params) {
|
||||||
|
return effect_runner_i(params, &CYCLE_ALL_math);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // DISABLE_RGB_MATRIX_CYCLE_ALL
|
#endif // DISABLE_RGB_MATRIX_CYCLE_ALL
|
||||||
|
@ -1,22 +1,14 @@
|
|||||||
#pragma once
|
|
||||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||||
|
RGB_MATRIX_EFFECT(CYCLE_LEFT_RIGHT)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
static void CYCLE_LEFT_RIGHT_math(HSV* hsv, uint8_t i, uint8_t time) {
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
hsv->h = g_led_config.point[i].x - time;
|
||||||
extern rgb_config_t rgb_matrix_config;
|
|
||||||
|
|
||||||
bool rgb_matrix_cycle_left_right(effect_params_t* params) {
|
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
|
||||||
|
|
||||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
|
||||||
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
|
||||||
point_t point = g_rgb_leds[i].point;
|
|
||||||
hsv.h = point.x - time;
|
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
|
||||||
}
|
}
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
|
||||||
|
bool CYCLE_LEFT_RIGHT(effect_params_t* params) {
|
||||||
|
return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
#endif // DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN
|
||||||
|
RGB_MATRIX_EFFECT(CYCLE_OUT_IN)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
|
static void CYCLE_OUT_IN_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||||
|
hsv->h = 3 * dist / 2 + time;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CYCLE_OUT_IN(effect_params_t* params) {
|
||||||
|
return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
#endif // DISABLE_RGB_MATRIX_CYCLE_OUT_IN
|
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
|
||||||
|
RGB_MATRIX_EFFECT(CYCLE_OUT_IN_DUAL)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
|
static void CYCLE_OUT_IN_DUAL_math(HSV* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CYCLE_OUT_IN_DUAL(effect_params_t* params) {
|
||||||
|
return effect_runner_dx_dy(params, &CYCLE_OUT_IN_DUAL_math);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
#endif // DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
|
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
|
||||||
|
RGB_MATRIX_EFFECT(CYCLE_PINWHEEL)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
|
static void CYCLE_PINWHEEL_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||||
|
hsv->h = atan2_8(dy, dx) + time;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CYCLE_PINWHEEL(effect_params_t* params) {
|
||||||
|
return effect_runner_dx_dy(params, &CYCLE_PINWHEEL_math);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
#endif // DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
|
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef DISABLE_RGB_MATRIX_CYCLE_SPIRAL
|
||||||
|
RGB_MATRIX_EFFECT(CYCLE_SPIRAL)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
|
static void CYCLE_SPIRAL_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||||
|
hsv->h = dist - time - atan2_8(dy, dx);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CYCLE_SPIRAL(effect_params_t* params) {
|
||||||
|
return effect_runner_dx_dy_dist(params, &CYCLE_SPIRAL_math);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
#endif // DISABLE_RGB_MATRIX_CYCLE_SPIRAL
|
@ -1,22 +1,14 @@
|
|||||||
#pragma once
|
|
||||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||||
|
RGB_MATRIX_EFFECT(CYCLE_UP_DOWN)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
static void CYCLE_UP_DOWN_math(HSV* hsv, uint8_t i, uint8_t time) {
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
hsv->h = g_led_config.point[i].y - time;
|
||||||
extern rgb_config_t rgb_matrix_config;
|
|
||||||
|
|
||||||
bool rgb_matrix_cycle_up_down(effect_params_t* params) {
|
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
|
||||||
|
|
||||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
|
||||||
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
|
||||||
point_t point = g_rgb_leds[i].point;
|
|
||||||
hsv.h = point.y - time;
|
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
|
||||||
}
|
}
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
|
||||||
|
bool CYCLE_UP_DOWN(effect_params_t* params) {
|
||||||
|
return effect_runner_i(params, &CYCLE_UP_DOWN_math);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
#endif // DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||||
|
@ -1,24 +1,14 @@
|
|||||||
#pragma once
|
|
||||||
#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
|
#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
|
||||||
|
RGB_MATRIX_EFFECT(DUAL_BEACON)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
static void DUAL_BEACON_math(HSV* hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
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 + rgb_matrix_config.hue;
|
||||||
extern rgb_config_t rgb_matrix_config;
|
|
||||||
|
|
||||||
bool rgb_matrix_dual_beacon(effect_params_t* params) {
|
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
|
||||||
|
|
||||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
|
||||||
uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
|
||||||
int8_t cos_value = cos8(time) - 128;
|
|
||||||
int8_t sin_value = sin8(time) - 128;
|
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
|
||||||
point_t point = g_rgb_leds[i].point;
|
|
||||||
hsv.h = ((point.y - 32) * cos_value + (point.x - 112) * sin_value) / 128 + rgb_matrix_config.hue;
|
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
|
||||||
}
|
}
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
|
||||||
|
bool DUAL_BEACON(effect_params_t* params) {
|
||||||
|
return effect_runner_sin_cos_i(params, &DUAL_BEACON_math);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // DISABLE_RGB_MATRIX_DUAL_BEACON
|
#endif // DISABLE_RGB_MATRIX_DUAL_BEACON
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
#pragma once
|
|
||||||
#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||||
|
RGB_MATRIX_EFFECT(GRADIENT_UP_DOWN)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
bool GRADIENT_UP_DOWN(effect_params_t* params) {
|
||||||
extern rgb_config_t rgb_matrix_config;
|
|
||||||
|
|
||||||
bool rgb_matrix_gradient_up_down(effect_params_t* params) {
|
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||||
|
|
||||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||||
uint8_t scale = scale8(64, rgb_matrix_config.speed);
|
uint8_t scale = scale8(64, rgb_matrix_config.speed);
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
point_t point = g_rgb_leds[i].point;
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
// The y range will be 0..64, map this to 0..4
|
// The y range will be 0..64, map this to 0..4
|
||||||
// Relies on hue being 8-bit and wrapping
|
// Relies on hue being 8-bit and wrapping
|
||||||
hsv.h = rgb_matrix_config.hue + scale * (point.y >> 4);
|
hsv.h = rgb_matrix_config.hue + scale * (g_led_config.point[i].y >> 4);
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||||
}
|
}
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
return led_max < DRIVER_LED_TOTAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
#endif // DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||||
|
@ -1,30 +1,29 @@
|
|||||||
#pragma once
|
|
||||||
#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||||
|
RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
static void jellybean_raindrops_set_color(int i, effect_params_t* params) {
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
|
||||||
extern rgb_config_t rgb_matrix_config;
|
|
||||||
|
|
||||||
static void jellybean_raindrops_set_color(int i) {
|
|
||||||
HSV hsv = { rand() & 0xFF , rand() & 0xFF, rgb_matrix_config.val };
|
HSV hsv = { rand() & 0xFF , rand() & 0xFF, rgb_matrix_config.val };
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rgb_matrix_jellybean_raindrops(effect_params_t* params) {
|
bool JELLYBEAN_RAINDROPS(effect_params_t* params) {
|
||||||
if (!params->init) {
|
if (!params->init) {
|
||||||
// Change one LED every tick, make sure speed is not 0
|
// Change one LED every tick, make sure speed is not 0
|
||||||
if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) {
|
if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) {
|
||||||
jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL);
|
jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||||
for (int i = led_min; i < led_max; i++) {
|
for (int i = led_min; i < led_max; i++) {
|
||||||
jellybean_raindrops_set_color(i);
|
jellybean_raindrops_set_color(i, params);
|
||||||
}
|
}
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
return led_max < DRIVER_LED_TOTAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
#endif // DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||||
|
@ -1,24 +1,14 @@
|
|||||||
#pragma once
|
|
||||||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
|
#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||||
|
RGB_MATRIX_EFFECT(RAINBOW_BEACON)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
static void RAINBOW_BEACON_math(HSV* hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
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 + rgb_matrix_config.hue;
|
||||||
extern rgb_config_t rgb_matrix_config;
|
|
||||||
|
|
||||||
bool rgb_matrix_rainbow_beacon(effect_params_t* params) {
|
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
|
||||||
|
|
||||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
|
||||||
uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
|
||||||
int16_t cos_value = 2 * (cos8(time) - 128);
|
|
||||||
int16_t sin_value = 2 * (sin8(time) - 128);
|
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
|
||||||
point_t point = g_rgb_leds[i].point;
|
|
||||||
hsv.h = ((point.y - 32) * cos_value + (point.x - 112) * sin_value) / 128 + rgb_matrix_config.hue;
|
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
|
||||||
}
|
}
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
|
||||||
|
bool RAINBOW_BEACON(effect_params_t* params) {
|
||||||
|
return effect_runner_sin_cos_i(params, &RAINBOW_BEACON_math);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_BEACON
|
#endif // DISABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||||
|
@ -1,22 +1,14 @@
|
|||||||
#pragma once
|
|
||||||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||||
|
RGB_MATRIX_EFFECT(RAINBOW_MOVING_CHEVRON)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
static void RAINBOW_MOVING_CHEVRON_math(HSV* hsv, uint8_t i, uint8_t time) {
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
hsv->h = abs8(g_led_config.point[i].y - k_rgb_matrix_center.y) + (g_led_config.point[i].x - time) + rgb_matrix_config.hue;
|
||||||
extern rgb_config_t rgb_matrix_config;
|
|
||||||
|
|
||||||
bool rgb_matrix_rainbow_moving_chevron(effect_params_t* params) {
|
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
|
||||||
|
|
||||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
|
||||||
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
|
||||||
point_t point = g_rgb_leds[i].point;
|
|
||||||
hsv.h = abs8(point.y - 32) + (point.x - time) + rgb_matrix_config.hue;
|
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
|
||||||
}
|
}
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
|
||||||
|
bool RAINBOW_MOVING_CHEVRON(effect_params_t* params) {
|
||||||
|
return effect_runner_i(params, &RAINBOW_MOVING_CHEVRON_math);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
#endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||||
|
@ -1,24 +1,14 @@
|
|||||||
#pragma once
|
|
||||||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||||
|
RGB_MATRIX_EFFECT(PINWHEELS)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
static void PINWHEELS_math(HSV* hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
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 + rgb_matrix_config.hue;
|
||||||
extern rgb_config_t rgb_matrix_config;
|
|
||||||
|
|
||||||
bool rgb_matrix_rainbow_pinwheels(effect_params_t* params) {
|
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
|
||||||
|
|
||||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
|
||||||
uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
|
||||||
int16_t cos_value = 3 * (cos8(time) - 128);
|
|
||||||
int16_t sin_value = 3 * (sin8(time) - 128);
|
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
|
||||||
point_t point = g_rgb_leds[i].point;
|
|
||||||
hsv.h = ((point.y - 32) * cos_value + (56 - abs8(point.x - 112)) * sin_value) / 128 + rgb_matrix_config.hue;
|
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
|
||||||
}
|
}
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
|
||||||
|
bool PINWHEELS(effect_params_t* params) {
|
||||||
|
return effect_runner_sin_cos_i(params, &PINWHEELS_math);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
#endif // DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
// Add your new core rgb matrix effect here, order determins enum order, requires "rgb_matrix_animations/ directory
|
||||||
|
#include "rgb_matrix_animations/solid_color_anim.h"
|
||||||
|
#include "rgb_matrix_animations/alpha_mods_anim.h"
|
||||||
|
#include "rgb_matrix_animations/gradient_up_down_anim.h"
|
||||||
|
#include "rgb_matrix_animations/breathing_anim.h"
|
||||||
|
#include "rgb_matrix_animations/colorband_sat_anim.h"
|
||||||
|
#include "rgb_matrix_animations/colorband_val_anim.h"
|
||||||
|
#include "rgb_matrix_animations/colorband_pinwheel_sat_anim.h"
|
||||||
|
#include "rgb_matrix_animations/colorband_pinwheel_val_anim.h"
|
||||||
|
#include "rgb_matrix_animations/colorband_spiral_sat_anim.h"
|
||||||
|
#include "rgb_matrix_animations/colorband_spiral_val_anim.h"
|
||||||
|
#include "rgb_matrix_animations/cycle_all_anim.h"
|
||||||
|
#include "rgb_matrix_animations/cycle_left_right_anim.h"
|
||||||
|
#include "rgb_matrix_animations/cycle_up_down_anim.h"
|
||||||
|
#include "rgb_matrix_animations/rainbow_moving_chevron_anim.h"
|
||||||
|
#include "rgb_matrix_animations/cycle_out_in_anim.h"
|
||||||
|
#include "rgb_matrix_animations/cycle_out_in_dual_anim.h"
|
||||||
|
#include "rgb_matrix_animations/cycle_pinwheel_anim.h"
|
||||||
|
#include "rgb_matrix_animations/cycle_spiral_anim.h"
|
||||||
|
#include "rgb_matrix_animations/dual_beacon_anim.h"
|
||||||
|
#include "rgb_matrix_animations/rainbow_beacon_anim.h"
|
||||||
|
#include "rgb_matrix_animations/rainbow_pinwheels_anim.h"
|
||||||
|
#include "rgb_matrix_animations/raindrops_anim.h"
|
||||||
|
#include "rgb_matrix_animations/jellybean_raindrops_anim.h"
|
||||||
|
#include "rgb_matrix_animations/typing_heatmap_anim.h"
|
||||||
|
#include "rgb_matrix_animations/digital_rain_anim.h"
|
||||||
|
#include "rgb_matrix_animations/solid_reactive_simple_anim.h"
|
||||||
|
#include "rgb_matrix_animations/solid_reactive_anim.h"
|
||||||
|
#include "rgb_matrix_animations/solid_reactive_wide.h"
|
||||||
|
#include "rgb_matrix_animations/solid_reactive_cross.h"
|
||||||
|
#include "rgb_matrix_animations/solid_reactive_nexus.h"
|
||||||
|
#include "rgb_matrix_animations/splash_anim.h"
|
||||||
|
#include "rgb_matrix_animations/solid_splash_anim.h"
|
@ -1,14 +1,16 @@
|
|||||||
#pragma once
|
RGB_MATRIX_EFFECT(SOLID_COLOR)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
extern rgb_config_t rgb_matrix_config;
|
bool SOLID_COLOR(effect_params_t* params) {
|
||||||
|
|
||||||
bool rgb_matrix_solid_color(effect_params_t* params) {
|
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||||
|
|
||||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
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);
|
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||||
}
|
}
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
return led_max < DRIVER_LED_TOTAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
@ -1,34 +1,16 @@
|
|||||||
#pragma once
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED)
|
|
||||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE
|
||||||
|
RGB_MATRIX_EFFECT(SOLID_REACTIVE)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
extern rgb_config_t rgb_matrix_config;
|
static void SOLID_REACTIVE_math(HSV* hsv, uint16_t offset) {
|
||||||
extern last_hit_t g_last_hit_tracker;
|
hsv->h = rgb_matrix_config.hue + qsub8(130, offset);
|
||||||
|
|
||||||
bool rgb_matrix_solid_reactive(effect_params_t* params) {
|
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
|
||||||
|
|
||||||
HSV hsv = { rgb_matrix_config.hue, 255, rgb_matrix_config.val };
|
|
||||||
// Max tick based on speed scale ensures results from scale16by8 with rgb_matrix_config.speed are no greater than 255
|
|
||||||
uint16_t max_tick = 65535 / rgb_matrix_config.speed;
|
|
||||||
// Relies on hue being 8-bit and wrapping
|
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
|
||||||
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--) {
|
|
||||||
if (g_last_hit_tracker.index[j] == i && g_last_hit_tracker.tick[j] < tick) {
|
|
||||||
tick = g_last_hit_tracker.tick[j];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t offset = scale16by8(tick, rgb_matrix_config.speed);
|
bool SOLID_REACTIVE(effect_params_t* params) {
|
||||||
hsv.h = rgb_matrix_config.hue + qsub8(130, offset);
|
return effect_runner_reactive(params, &SOLID_REACTIVE_math);
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
|
||||||
}
|
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED)
|
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE
|
||||||
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
@ -1,50 +1,40 @@
|
|||||||
#pragma once
|
|
||||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS)
|
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS)
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
|
||||||
extern rgb_config_t rgb_matrix_config;
|
RGB_MATRIX_EFFECT(SOLID_REACTIVE_CROSS)
|
||||||
extern last_hit_t g_last_hit_tracker;
|
#endif
|
||||||
|
|
||||||
static bool rgb_matrix_solid_reactive_multicross_range(uint8_t start, effect_params_t* params) {
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS)
|
||||||
|
#endif
|
||||||
|
|
||||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 };
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
uint8_t count = g_last_hit_tracker.count;
|
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
static void SOLID_REACTIVE_CROSS_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||||
hsv.v = 0;
|
uint16_t effect = tick + dist;
|
||||||
point_t point = g_rgb_leds[i].point;
|
|
||||||
for (uint8_t j = start; j < count; j++) {
|
|
||||||
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
|
||||||
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
|
||||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
|
||||||
int16_t dist2 = 16;
|
|
||||||
uint8_t dist3;
|
|
||||||
uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) + dist;
|
|
||||||
dx = dx < 0 ? dx * -1 : dx;
|
dx = dx < 0 ? dx * -1 : dx;
|
||||||
dy = dy < 0 ? dy * -1 : dy;
|
dy = dy < 0 ? dy * -1 : dy;
|
||||||
dx = dx * dist2 > 255 ? 255 : dx * dist2;
|
dx = dx * 16 > 255 ? 255 : dx * 16;
|
||||||
dy = dy * dist2 > 255 ? 255 : dy * dist2;
|
dy = dy * 16 > 255 ? 255 : dy * 16;
|
||||||
dist3 = dx > dy ? dy : dx;
|
effect += dx > dy ? dy : dx;
|
||||||
effect += dist3;
|
|
||||||
if (effect > 255)
|
if (effect > 255)
|
||||||
effect = 255;
|
effect = 255;
|
||||||
hsv.v = qadd8(hsv.v, 255 - effect);
|
hsv->v = qadd8(hsv->v, 255 - effect);
|
||||||
}
|
|
||||||
hsv.v = scale8(hsv.v, rgb_matrix_config.val);
|
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
|
||||||
}
|
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rgb_matrix_solid_reactive_multicross(effect_params_t* params) {
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
|
||||||
return rgb_matrix_solid_reactive_multicross_range(0, params);
|
bool SOLID_REACTIVE_CROSS(effect_params_t* params) {
|
||||||
|
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool rgb_matrix_solid_reactive_cross(effect_params_t* params) {
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
|
||||||
return rgb_matrix_solid_reactive_multicross_range(qsub8(g_last_hit_tracker.count, 1), params);
|
bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) {
|
||||||
|
return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS)
|
#endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS)
|
||||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
@ -1,48 +1,40 @@
|
|||||||
#pragma once
|
|
||||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS)
|
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS)
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
|
||||||
extern rgb_config_t rgb_matrix_config;
|
RGB_MATRIX_EFFECT(SOLID_REACTIVE_NEXUS)
|
||||||
extern last_hit_t g_last_hit_tracker;
|
#endif
|
||||||
|
|
||||||
static bool rgb_matrix_solid_reactive_multinexus_range(uint8_t start, effect_params_t* params) {
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS)
|
||||||
|
#endif
|
||||||
|
|
||||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 };
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
uint8_t count = g_last_hit_tracker.count;
|
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
static void SOLID_REACTIVE_NEXUS_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||||
hsv.v = 0;
|
uint16_t effect = tick - dist;
|
||||||
point_t point = g_rgb_leds[i].point;
|
|
||||||
for (uint8_t j = start; j < count; j++) {
|
|
||||||
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
|
||||||
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
|
||||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
|
||||||
int16_t dist2 = 8;
|
|
||||||
uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist;
|
|
||||||
if (effect > 255)
|
if (effect > 255)
|
||||||
effect = 255;
|
effect = 255;
|
||||||
if (dist > 72)
|
if (dist > 72)
|
||||||
effect = 255;
|
effect = 255;
|
||||||
if ((dx > dist2 || dx < -dist2) && (dy > dist2 || dy < -dist2))
|
if ((dx > 8 || dx < -8) && (dy > 8 || dy < -8))
|
||||||
effect = 255;
|
effect = 255;
|
||||||
hsv.v = qadd8(hsv.v, 255 - effect);
|
hsv->v = qadd8(hsv->v, 255 - effect);
|
||||||
hsv.h = rgb_matrix_config.hue + dy / 4;
|
hsv->h = rgb_matrix_config.hue + dy / 4;
|
||||||
}
|
|
||||||
hsv.v = scale8(hsv.v, rgb_matrix_config.val);
|
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
|
||||||
}
|
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rgb_matrix_solid_reactive_multinexus(effect_params_t* params) {
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
|
||||||
return rgb_matrix_solid_reactive_multinexus_range(0, params);
|
bool SOLID_REACTIVE_NEXUS(effect_params_t* params) {
|
||||||
|
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool rgb_matrix_solid_reactive_nexus(effect_params_t* params) {
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
|
||||||
return rgb_matrix_solid_reactive_multinexus_range(qsub8(g_last_hit_tracker.count, 1), params);
|
bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) {
|
||||||
|
return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS)
|
#endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS)
|
||||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
@ -1,33 +1,16 @@
|
|||||||
#pragma once
|
|
||||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||||
|
RGB_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
extern rgb_config_t rgb_matrix_config;
|
static void SOLID_REACTIVE_SIMPLE_math(HSV* hsv, uint16_t offset) {
|
||||||
extern last_hit_t g_last_hit_tracker;
|
hsv->v = scale8(255 - offset, rgb_matrix_config.val);
|
||||||
|
|
||||||
bool rgb_matrix_solid_reactive_simple(effect_params_t* params) {
|
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
|
||||||
|
|
||||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 };
|
|
||||||
// Max tick based on speed scale ensures results from scale16by8 with rgb_matrix_config.speed are no greater than 255
|
|
||||||
uint16_t max_tick = 65535 / rgb_matrix_config.speed;
|
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
|
||||||
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--) {
|
|
||||||
if (g_last_hit_tracker.index[j] == i && g_last_hit_tracker.tick[j] < tick) {
|
|
||||||
tick = g_last_hit_tracker.tick[j];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t offset = scale16by8(tick, rgb_matrix_config.speed);
|
bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) {
|
||||||
hsv.v = scale8(255 - offset, rgb_matrix_config.val);
|
return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math);
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
|
||||||
}
|
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
@ -1,42 +1,35 @@
|
|||||||
#pragma once
|
|
||||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE)
|
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE)
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
|
||||||
extern rgb_config_t rgb_matrix_config;
|
RGB_MATRIX_EFFECT(SOLID_REACTIVE_WIDE)
|
||||||
extern last_hit_t g_last_hit_tracker;
|
#endif
|
||||||
|
|
||||||
static bool rgb_matrix_solid_reactive_multiwide_range(uint8_t start, effect_params_t* params) {
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE)
|
||||||
|
#endif
|
||||||
|
|
||||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 };
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
uint8_t count = g_last_hit_tracker.count;
|
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
static void SOLID_REACTIVE_WIDE_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||||
hsv.v = 0;
|
uint16_t effect = tick + dist * 5;
|
||||||
point_t point = g_rgb_leds[i].point;
|
|
||||||
for (uint8_t j = start; j < count; j++) {
|
|
||||||
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
|
||||||
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
|
||||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
|
||||||
uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) + dist * 5;
|
|
||||||
if (effect > 255)
|
if (effect > 255)
|
||||||
effect = 255;
|
effect = 255;
|
||||||
hsv.v = qadd8(hsv.v, 255 - effect);
|
hsv->v = qadd8(hsv->v, 255 - effect);
|
||||||
}
|
|
||||||
hsv.v = scale8(hsv.v, rgb_matrix_config.val);
|
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
|
||||||
}
|
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rgb_matrix_solid_reactive_multiwide(effect_params_t* params) {
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
|
||||||
return rgb_matrix_solid_reactive_multiwide_range(0, params);
|
bool SOLID_REACTIVE_WIDE(effect_params_t* params) {
|
||||||
|
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool rgb_matrix_solid_reactive_wide(effect_params_t* params) {
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
|
||||||
return rgb_matrix_solid_reactive_multiwide_range(qsub8(g_last_hit_tracker.count, 1), params);
|
bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) {
|
||||||
|
return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE)
|
#endif // !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE)
|
||||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
@ -1,42 +1,35 @@
|
|||||||
#pragma once
|
|
||||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH)
|
#if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH)
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
#ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH
|
||||||
extern rgb_config_t rgb_matrix_config;
|
RGB_MATRIX_EFFECT(SOLID_SPLASH)
|
||||||
extern last_hit_t g_last_hit_tracker;
|
#endif
|
||||||
|
|
||||||
static bool rgb_matrix_solid_multisplash_range(uint8_t start, effect_params_t* params) {
|
#ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
RGB_MATRIX_EFFECT(SOLID_MULTISPLASH)
|
||||||
|
#endif
|
||||||
|
|
||||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 };
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
uint8_t count = g_last_hit_tracker.count;
|
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
void SOLID_SPLASH_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||||
hsv.v = 0;
|
uint16_t effect = tick - dist;
|
||||||
point_t point = g_rgb_leds[i].point;
|
|
||||||
for (uint8_t j = start; j < count; j++) {
|
|
||||||
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
|
||||||
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
|
||||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
|
||||||
uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist;
|
|
||||||
if (effect > 255)
|
if (effect > 255)
|
||||||
effect = 255;
|
effect = 255;
|
||||||
hsv.v = qadd8(hsv.v, 255 - effect);
|
hsv->v = qadd8(hsv->v, 255 - effect);
|
||||||
}
|
|
||||||
hsv.v = scale8(hsv.v, rgb_matrix_config.val);
|
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
|
||||||
}
|
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rgb_matrix_solid_multisplash(effect_params_t* params) {
|
#ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH
|
||||||
return rgb_matrix_solid_multisplash_range(0, params);
|
bool SOLID_SPLASH(effect_params_t* params) {
|
||||||
|
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool rgb_matrix_solid_splash(effect_params_t* params) {
|
#ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||||
return rgb_matrix_solid_multisplash_range(qsub8(g_last_hit_tracker.count, 1), params);
|
bool SOLID_MULTISPLASH(effect_params_t* params) {
|
||||||
|
return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // !defined(DISABLE_RGB_MATRIX_SPLASH) && !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
#endif // !defined(DISABLE_RGB_MATRIX_SPLASH) && !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
||||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
@ -1,44 +1,36 @@
|
|||||||
#pragma once
|
|
||||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
#if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
#ifndef DISABLE_RGB_MATRIX_SPLASH
|
||||||
extern rgb_config_t rgb_matrix_config;
|
RGB_MATRIX_EFFECT(SPLASH)
|
||||||
extern last_hit_t g_last_hit_tracker;
|
#endif
|
||||||
|
|
||||||
static bool rgb_matrix_multisplash_range(uint8_t start, effect_params_t* params) {
|
#ifndef DISABLE_RGB_MATRIX_MULTISPLASH
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
RGB_MATRIX_EFFECT(MULTISPLASH)
|
||||||
|
#endif
|
||||||
|
|
||||||
HSV hsv = { 0, rgb_matrix_config.sat, 0 };
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
uint8_t count = g_last_hit_tracker.count;
|
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
void SPLASH_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
|
||||||
hsv.h = rgb_matrix_config.hue;
|
uint16_t effect = tick - dist;
|
||||||
hsv.v = 0;
|
|
||||||
point_t point = g_rgb_leds[i].point;
|
|
||||||
for (uint8_t j = start; j < count; j++) {
|
|
||||||
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
|
||||||
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
|
||||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
|
||||||
uint16_t effect = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed) - dist;
|
|
||||||
if (effect > 255)
|
if (effect > 255)
|
||||||
effect = 255;
|
effect = 255;
|
||||||
hsv.h += effect;
|
hsv->h += effect;
|
||||||
hsv.v = qadd8(hsv.v, 255 - effect);
|
hsv->v = qadd8(hsv->v, 255 - effect);
|
||||||
}
|
|
||||||
hsv.v = scale8(hsv.v, rgb_matrix_config.val);
|
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
|
||||||
}
|
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rgb_matrix_multisplash(effect_params_t* params) {
|
#ifndef DISABLE_RGB_MATRIX_SPLASH
|
||||||
return rgb_matrix_multisplash_range(0, params);
|
bool SPLASH(effect_params_t* params) {
|
||||||
|
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SPLASH_math);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool rgb_matrix_splash(effect_params_t* params) {
|
#ifndef DISABLE_RGB_MATRIX_MULTISPLASH
|
||||||
return rgb_matrix_multisplash_range(qsub8(g_last_hit_tracker.count, 1), params);
|
bool MULTISPLASH(effect_params_t* params) {
|
||||||
|
return effect_runner_reactive_splash(0, params, &SPLASH_math);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
#endif // !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
#endif // !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
||||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
|
||||||
|
RGB_MATRIX_EFFECT(TYPING_HEATMAP)
|
||||||
|
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
|
||||||
|
void process_rgb_matrix_typing_heatmap(keyrecord_t *record) {
|
||||||
|
uint8_t row = record->event.key.row;
|
||||||
|
uint8_t col = record->event.key.col;
|
||||||
|
uint8_t m_row = row - 1;
|
||||||
|
uint8_t p_row = row + 1;
|
||||||
|
uint8_t m_col = col - 1;
|
||||||
|
uint8_t p_col = col + 1;
|
||||||
|
|
||||||
|
if (m_col < col)
|
||||||
|
rgb_frame_buffer[row][m_col] = qadd8(rgb_frame_buffer[row][m_col], 16);
|
||||||
|
rgb_frame_buffer[row][col] = qadd8(rgb_frame_buffer[row][col], 32);
|
||||||
|
if (p_col < MATRIX_COLS)
|
||||||
|
rgb_frame_buffer[row][p_col] = qadd8(rgb_frame_buffer[row][p_col], 16);
|
||||||
|
|
||||||
|
if (p_row < MATRIX_ROWS) {
|
||||||
|
if (m_col < col)
|
||||||
|
rgb_frame_buffer[p_row][m_col] = qadd8(rgb_frame_buffer[p_row][m_col], 13);
|
||||||
|
rgb_frame_buffer[p_row][col] = qadd8(rgb_frame_buffer[p_row][col], 16);
|
||||||
|
if (p_col < MATRIX_COLS)
|
||||||
|
rgb_frame_buffer[p_row][p_col] = qadd8(rgb_frame_buffer[p_row][p_col], 13);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_row < row) {
|
||||||
|
if (m_col < col)
|
||||||
|
rgb_frame_buffer[m_row][m_col] = qadd8(rgb_frame_buffer[m_row][m_col], 13);
|
||||||
|
rgb_frame_buffer[m_row][col] = qadd8(rgb_frame_buffer[m_row][col], 16);
|
||||||
|
if (p_col < MATRIX_COLS)
|
||||||
|
rgb_frame_buffer[m_row][p_col] = qadd8(rgb_frame_buffer[m_row][p_col], 13);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TYPING_HEATMAP(effect_params_t* params) {
|
||||||
|
// Modified version of RGB_MATRIX_USE_LIMITS to work off of matrix row / col size
|
||||||
|
uint8_t led_min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter;
|
||||||
|
uint8_t led_max = led_min + RGB_MATRIX_LED_PROCESS_LIMIT;
|
||||||
|
if (led_max > sizeof(rgb_frame_buffer))
|
||||||
|
led_max = sizeof(rgb_frame_buffer);
|
||||||
|
|
||||||
|
if (params->init) {
|
||||||
|
rgb_matrix_set_color_all(0, 0, 0);
|
||||||
|
memset(rgb_frame_buffer, 0, sizeof rgb_frame_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render heatmap & decrease
|
||||||
|
for (int i = led_min; i < led_max; i++) {
|
||||||
|
uint8_t row = i % MATRIX_ROWS;
|
||||||
|
uint8_t col = i / MATRIX_ROWS;
|
||||||
|
uint8_t val = rgb_frame_buffer[row][col];
|
||||||
|
|
||||||
|
// set the pixel colour
|
||||||
|
uint8_t led[LED_HITS_TO_REMEMBER];
|
||||||
|
uint8_t led_count = rgb_matrix_map_row_column_to_led(row, col, led);
|
||||||
|
for (uint8_t j = 0; j < led_count; ++j)
|
||||||
|
{
|
||||||
|
if (!HAS_ANY_FLAGS(g_led_config.flags[led[j]], params->flags))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
HSV hsv = { 170 - qsub8(val, 85), rgb_matrix_config.sat, scale8((qadd8(170, val) - 170) * 3, rgb_matrix_config.val) };
|
||||||
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
|
rgb_matrix_set_color(led[j], rgb.r, rgb.g, rgb.b);
|
||||||
|
}
|
||||||
|
|
||||||
|
rgb_frame_buffer[row][col] = qsub8(val, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return led_max < sizeof(rgb_frame_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||||
|
#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
|
@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
typedef void (*dx_dy_f)(HSV* 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);
|
||||||
|
|
||||||
|
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||||
|
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2);
|
||||||
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
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;
|
||||||
|
effect_func(&hsv, dx, dy, time);
|
||||||
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
|
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||||
|
}
|
||||||
|
return led_max < DRIVER_LED_TOTAL;
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
typedef void (*dx_dy_dist_f)(HSV* 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);
|
||||||
|
|
||||||
|
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||||
|
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2);
|
||||||
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
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;
|
||||||
|
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
||||||
|
effect_func(&hsv, dx, dy, dist, time);
|
||||||
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
|
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||||
|
}
|
||||||
|
return led_max < DRIVER_LED_TOTAL;
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
typedef void (*i_f)(HSV* 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);
|
||||||
|
|
||||||
|
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||||
|
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
||||||
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
|
effect_func(&hsv, i, time);
|
||||||
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
|
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||||
|
}
|
||||||
|
return led_max < DRIVER_LED_TOTAL;
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
|
||||||
|
typedef void (*reactive_f)(HSV* hsv, uint16_t offset);
|
||||||
|
|
||||||
|
bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) {
|
||||||
|
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||||
|
|
||||||
|
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||||
|
uint16_t max_tick = 65535 / rgb_matrix_config.speed;
|
||||||
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
|
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--) {
|
||||||
|
if (g_last_hit_tracker.index[j] == i && g_last_hit_tracker.tick[j] < tick) {
|
||||||
|
tick = g_last_hit_tracker.tick[j];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t offset = scale16by8(tick, rgb_matrix_config.speed);
|
||||||
|
effect_func(&hsv, offset);
|
||||||
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
|
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||||
|
}
|
||||||
|
return led_max < DRIVER_LED_TOTAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
@ -0,0 +1,30 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
|
||||||
|
typedef void (*reactive_splash_f)(HSV* 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);
|
||||||
|
|
||||||
|
HSV hsv = { 0, rgb_matrix_config.sat, 0 };
|
||||||
|
uint8_t count = g_last_hit_tracker.count;
|
||||||
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
|
hsv.h = rgb_matrix_config.hue;
|
||||||
|
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];
|
||||||
|
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
||||||
|
uint16_t tick = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed);
|
||||||
|
effect_func(&hsv, dx, dy, dist, tick);
|
||||||
|
}
|
||||||
|
hsv.v = scale8(hsv.v, rgb_matrix_config.val);
|
||||||
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
|
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||||
|
}
|
||||||
|
return led_max < DRIVER_LED_TOTAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
typedef void (*sin_cos_i_f)(HSV* 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);
|
||||||
|
|
||||||
|
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||||
|
uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
||||||
|
int8_t cos_value = cos8(time) - 128;
|
||||||
|
int8_t sin_value = sin8(time) - 128;
|
||||||
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
|
effect_func(&hsv, cos_value, sin_value, i, time);
|
||||||
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
|
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||||
|
}
|
||||||
|
return led_max < DRIVER_LED_TOTAL;
|
||||||
|
}
|
Loading…
Reference in new issue