From d61e5c0027e289ccf48652afa4c442342e7ccf04 Mon Sep 17 00:00:00 2001
From: Ryan
Date: Tue, 22 Jun 2021 18:26:23 +1000
Subject: Move LED/RGB Matrix code into their own directories (#13257)
---
quantum/led_matrix/animations/alpha_mods_anim.h | 24 +
quantum/led_matrix/animations/band_anim.h | 13 +
quantum/led_matrix/animations/band_pinwheel_anim.h | 10 +
quantum/led_matrix/animations/band_spiral_anim.h | 10 +
quantum/led_matrix/animations/breathing_anim.h | 19 +
.../led_matrix/animations/cycle_left_right_anim.h | 10 +
quantum/led_matrix/animations/cycle_out_in_anim.h | 10 +
quantum/led_matrix/animations/cycle_up_down_anim.h | 10 +
quantum/led_matrix/animations/dual_beacon_anim.h | 10 +
.../led_matrix/animations/led_matrix_effects.inc | 18 +
.../animations/runners/effect_runner_dx_dy.h | 16 +
.../animations/runners/effect_runner_dx_dy_dist.h | 17 +
.../animations/runners/effect_runner_i.h | 14 +
.../animations/runners/effect_runner_reactive.h | 28 +
.../runners/effect_runner_reactive_splash.h | 26 +
.../animations/runners/effect_runner_sin_cos_i.h | 16 +
.../animations/runners/led_matrix_runners.inc | 6 +
quantum/led_matrix/animations/solid_anim.h | 15 +
.../led_matrix/animations/solid_reactive_cross.h | 35 ++
.../led_matrix/animations/solid_reactive_nexus.h | 32 ++
.../animations/solid_reactive_simple_anim.h | 12 +
.../led_matrix/animations/solid_reactive_wide.h | 30 ++
quantum/led_matrix/animations/solid_splash_anim.h | 30 ++
.../led_matrix/animations/wave_left_right_anim.h | 10 +
quantum/led_matrix/animations/wave_up_down_anim.h | 10 +
quantum/led_matrix/led_matrix.c | 577 +++++++++++++++++++++
quantum/led_matrix/led_matrix.h | 160 ++++++
quantum/led_matrix/led_matrix_drivers.c | 153 ++++++
quantum/led_matrix/led_matrix_types.h | 97 ++++
29 files changed, 1418 insertions(+)
create mode 100644 quantum/led_matrix/animations/alpha_mods_anim.h
create mode 100644 quantum/led_matrix/animations/band_anim.h
create mode 100644 quantum/led_matrix/animations/band_pinwheel_anim.h
create mode 100644 quantum/led_matrix/animations/band_spiral_anim.h
create mode 100644 quantum/led_matrix/animations/breathing_anim.h
create mode 100644 quantum/led_matrix/animations/cycle_left_right_anim.h
create mode 100644 quantum/led_matrix/animations/cycle_out_in_anim.h
create mode 100644 quantum/led_matrix/animations/cycle_up_down_anim.h
create mode 100644 quantum/led_matrix/animations/dual_beacon_anim.h
create mode 100644 quantum/led_matrix/animations/led_matrix_effects.inc
create mode 100644 quantum/led_matrix/animations/runners/effect_runner_dx_dy.h
create mode 100644 quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h
create mode 100644 quantum/led_matrix/animations/runners/effect_runner_i.h
create mode 100644 quantum/led_matrix/animations/runners/effect_runner_reactive.h
create mode 100644 quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h
create mode 100644 quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h
create mode 100644 quantum/led_matrix/animations/runners/led_matrix_runners.inc
create mode 100644 quantum/led_matrix/animations/solid_anim.h
create mode 100644 quantum/led_matrix/animations/solid_reactive_cross.h
create mode 100644 quantum/led_matrix/animations/solid_reactive_nexus.h
create mode 100644 quantum/led_matrix/animations/solid_reactive_simple_anim.h
create mode 100644 quantum/led_matrix/animations/solid_reactive_wide.h
create mode 100644 quantum/led_matrix/animations/solid_splash_anim.h
create mode 100644 quantum/led_matrix/animations/wave_left_right_anim.h
create mode 100644 quantum/led_matrix/animations/wave_up_down_anim.h
create mode 100644 quantum/led_matrix/led_matrix.c
create mode 100644 quantum/led_matrix/led_matrix.h
create mode 100644 quantum/led_matrix/led_matrix_drivers.c
create mode 100644 quantum/led_matrix/led_matrix_types.h
(limited to 'quantum/led_matrix')
diff --git a/quantum/led_matrix/animations/alpha_mods_anim.h b/quantum/led_matrix/animations/alpha_mods_anim.h
new file mode 100644
index 0000000000..a4638fde69
--- /dev/null
+++ b/quantum/led_matrix/animations/alpha_mods_anim.h
@@ -0,0 +1,24 @@
+#ifndef DISABLE_LED_MATRIX_ALPHAS_MODS
+LED_MATRIX_EFFECT(ALPHAS_MODS)
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+// alphas = val1, mods = val2
+bool ALPHAS_MODS(effect_params_t* params) {
+ LED_MATRIX_USE_LIMITS(led_min, led_max);
+
+ uint8_t val1 = led_matrix_eeconfig.val;
+ uint8_t val2 = val1 + led_matrix_eeconfig.speed;
+
+ for (uint8_t i = led_min; i < led_max; i++) {
+ LED_MATRIX_TEST_LED_FLAGS();
+ if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {
+ led_matrix_set_value(i, val2);
+ } else {
+ led_matrix_set_value(i, val1);
+ }
+ }
+ return led_max < DRIVER_LED_TOTAL;
+}
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+#endif // DISABLE_LED_MATRIX_ALPHAS_MODS
diff --git a/quantum/led_matrix/animations/band_anim.h b/quantum/led_matrix/animations/band_anim.h
new file mode 100644
index 0000000000..f9cb85dc4f
--- /dev/null
+++ b/quantum/led_matrix/animations/band_anim.h
@@ -0,0 +1,13 @@
+#ifndef DISABLE_LED_MATRIX_BAND
+LED_MATRIX_EFFECT(BAND)
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+static uint8_t BAND_math(uint8_t val, uint8_t i, uint8_t time) {
+ int16_t v = val - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8;
+ return scale8(v < 0 ? 0 : v, val);
+}
+
+bool BAND(effect_params_t* params) { return effect_runner_i(params, &BAND_math); }
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+#endif // DISABLE_LED_MATRIX_BAND
diff --git a/quantum/led_matrix/animations/band_pinwheel_anim.h b/quantum/led_matrix/animations/band_pinwheel_anim.h
new file mode 100644
index 0000000000..d3144bffbf
--- /dev/null
+++ b/quantum/led_matrix/animations/band_pinwheel_anim.h
@@ -0,0 +1,10 @@
+#ifndef DISABLE_LED_MATRIX_BAND_PINWHEEL
+LED_MATRIX_EFFECT(BAND_PINWHEEL)
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+static uint8_t BAND_PINWHEEL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t time) { return scale8(val - time - atan2_8(dy, dx) * 3, val); }
+
+bool BAND_PINWHEEL(effect_params_t* params) { return effect_runner_dx_dy(params, &BAND_PINWHEEL_math); }
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+#endif // DISABLE_LED_MATRIX_BAND_PINWHEEL
diff --git a/quantum/led_matrix/animations/band_spiral_anim.h b/quantum/led_matrix/animations/band_spiral_anim.h
new file mode 100644
index 0000000000..defbe69676
--- /dev/null
+++ b/quantum/led_matrix/animations/band_spiral_anim.h
@@ -0,0 +1,10 @@
+#ifndef DISABLE_LED_MATRIX_BAND_SPIRAL
+LED_MATRIX_EFFECT(BAND_SPIRAL)
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+static uint8_t BAND_SPIRAL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { return scale8(val + dist - time - atan2_8(dy, dx), val); }
+
+bool BAND_SPIRAL(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_math); }
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+#endif // DISABLE_LED_MATRIX_BAND_SPIRAL
diff --git a/quantum/led_matrix/animations/breathing_anim.h b/quantum/led_matrix/animations/breathing_anim.h
new file mode 100644
index 0000000000..4f49f50690
--- /dev/null
+++ b/quantum/led_matrix/animations/breathing_anim.h
@@ -0,0 +1,19 @@
+#ifndef DISABLE_LED_MATRIX_BREATHING
+LED_MATRIX_EFFECT(BREATHING)
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+bool BREATHING(effect_params_t* params) {
+ LED_MATRIX_USE_LIMITS(led_min, led_max);
+
+ uint8_t val = led_matrix_eeconfig.val;
+ uint16_t time = scale16by8(g_led_timer, led_matrix_eeconfig.speed / 8);
+ val = scale8(abs8(sin8(time) - 128) * 2, val);
+ for (uint8_t i = led_min; i < led_max; i++) {
+ LED_MATRIX_TEST_LED_FLAGS();
+ led_matrix_set_value(i, val);
+ }
+ return led_max < DRIVER_LED_TOTAL;
+}
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+#endif // DISABLE_LED_MATRIX_BREATHING
diff --git a/quantum/led_matrix/animations/cycle_left_right_anim.h b/quantum/led_matrix/animations/cycle_left_right_anim.h
new file mode 100644
index 0000000000..c426d02fd5
--- /dev/null
+++ b/quantum/led_matrix/animations/cycle_left_right_anim.h
@@ -0,0 +1,10 @@
+#ifndef DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT
+LED_MATRIX_EFFECT(CYCLE_LEFT_RIGHT)
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+static uint8_t CYCLE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(g_led_config.point[i].x - time, val); }
+
+bool CYCLE_LEFT_RIGHT(effect_params_t* params) { return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math); }
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+#endif // DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT
diff --git a/quantum/led_matrix/animations/cycle_out_in_anim.h b/quantum/led_matrix/animations/cycle_out_in_anim.h
new file mode 100644
index 0000000000..55527556fd
--- /dev/null
+++ b/quantum/led_matrix/animations/cycle_out_in_anim.h
@@ -0,0 +1,10 @@
+#ifndef DISABLE_LED_MATRIX_CYCLE_OUT_IN
+LED_MATRIX_EFFECT(CYCLE_OUT_IN)
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+static uint8_t CYCLE_OUT_IN_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { return scale8(3 * dist / 2 + time, val); }
+
+bool CYCLE_OUT_IN(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math); }
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+#endif // DISABLE_LED_MATRIX_CYCLE_OUT_IN
diff --git a/quantum/led_matrix/animations/cycle_up_down_anim.h b/quantum/led_matrix/animations/cycle_up_down_anim.h
new file mode 100644
index 0000000000..d97de0d1ec
--- /dev/null
+++ b/quantum/led_matrix/animations/cycle_up_down_anim.h
@@ -0,0 +1,10 @@
+#ifndef DISABLE_LED_MATRIX_CYCLE_UP_DOWN
+LED_MATRIX_EFFECT(CYCLE_UP_DOWN)
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+static uint8_t CYCLE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(g_led_config.point[i].y - time, val); }
+
+bool CYCLE_UP_DOWN(effect_params_t* params) { return effect_runner_i(params, &CYCLE_UP_DOWN_math); }
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+#endif // DISABLE_LED_MATRIX_CYCLE_UP_DOWN
diff --git a/quantum/led_matrix/animations/dual_beacon_anim.h b/quantum/led_matrix/animations/dual_beacon_anim.h
new file mode 100644
index 0000000000..e1bc5ae464
--- /dev/null
+++ b/quantum/led_matrix/animations/dual_beacon_anim.h
@@ -0,0 +1,10 @@
+#ifndef DISABLE_LED_MATRIX_DUAL_BEACON
+LED_MATRIX_EFFECT(DUAL_BEACON)
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+static uint8_t DUAL_BEACON_math(uint8_t val, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { return scale8(((g_led_config.point[i].y - k_led_matrix_center.y) * cos + (g_led_config.point[i].x - k_led_matrix_center.x) * sin) / 128, val); }
+
+bool DUAL_BEACON(effect_params_t* params) { return effect_runner_sin_cos_i(params, &DUAL_BEACON_math); }
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+#endif // DISABLE_LED_MATRIX_DUAL_BEACON
diff --git a/quantum/led_matrix/animations/led_matrix_effects.inc b/quantum/led_matrix/animations/led_matrix_effects.inc
new file mode 100644
index 0000000000..ad1f46b242
--- /dev/null
+++ b/quantum/led_matrix/animations/led_matrix_effects.inc
@@ -0,0 +1,18 @@
+// Add your new core led matrix effect here, order determines enum order
+#include "solid_anim.h"
+#include "alpha_mods_anim.h"
+#include "breathing_anim.h"
+#include "band_anim.h"
+#include "band_pinwheel_anim.h"
+#include "band_spiral_anim.h"
+#include "cycle_left_right_anim.h"
+#include "cycle_up_down_anim.h"
+#include "cycle_out_in_anim.h"
+#include "dual_beacon_anim.h"
+#include "solid_reactive_simple_anim.h"
+#include "solid_reactive_wide.h"
+#include "solid_reactive_cross.h"
+#include "solid_reactive_nexus.h"
+#include "solid_splash_anim.h"
+#include "wave_left_right_anim.h"
+#include "wave_up_down_anim.h"
diff --git a/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h b/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h
new file mode 100644
index 0000000000..ef97631b90
--- /dev/null
+++ b/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h
@@ -0,0 +1,16 @@
+#pragma once
+
+typedef uint8_t (*dx_dy_f)(uint8_t val, int16_t dx, int16_t dy, uint8_t time);
+
+bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) {
+ LED_MATRIX_USE_LIMITS(led_min, led_max);
+
+ uint8_t time = scale16by8(g_led_timer, led_matrix_eeconfig.speed / 2);
+ for (uint8_t i = led_min; i < led_max; i++) {
+ LED_MATRIX_TEST_LED_FLAGS();
+ int16_t dx = g_led_config.point[i].x - k_led_matrix_center.x;
+ int16_t dy = g_led_config.point[i].y - k_led_matrix_center.y;
+ led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, dx, dy, time));
+ }
+ return led_max < DRIVER_LED_TOTAL;
+}
diff --git a/quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h b/quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h
new file mode 100644
index 0000000000..5ef5938be0
--- /dev/null
+++ b/quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h
@@ -0,0 +1,17 @@
+#pragma once
+
+typedef uint8_t (*dx_dy_dist_f)(uint8_t val, 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) {
+ LED_MATRIX_USE_LIMITS(led_min, led_max);
+
+ uint8_t time = scale16by8(g_led_timer, led_matrix_eeconfig.speed / 2);
+ for (uint8_t i = led_min; i < led_max; i++) {
+ LED_MATRIX_TEST_LED_FLAGS();
+ int16_t dx = g_led_config.point[i].x - k_led_matrix_center.x;
+ int16_t dy = g_led_config.point[i].y - k_led_matrix_center.y;
+ uint8_t dist = sqrt16(dx * dx + dy * dy);
+ led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, dx, dy, dist, time));
+ }
+ return led_max < DRIVER_LED_TOTAL;
+}
diff --git a/quantum/led_matrix/animations/runners/effect_runner_i.h b/quantum/led_matrix/animations/runners/effect_runner_i.h
new file mode 100644
index 0000000000..b3015759be
--- /dev/null
+++ b/quantum/led_matrix/animations/runners/effect_runner_i.h
@@ -0,0 +1,14 @@
+#pragma once
+
+typedef uint8_t (*i_f)(uint8_t val, uint8_t i, uint8_t time);
+
+bool effect_runner_i(effect_params_t* params, i_f effect_func) {
+ LED_MATRIX_USE_LIMITS(led_min, led_max);
+
+ uint8_t time = scale16by8(g_led_timer, led_matrix_eeconfig.speed / 4);
+ for (uint8_t i = led_min; i < led_max; i++) {
+ LED_MATRIX_TEST_LED_FLAGS();
+ led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, i, time));
+ }
+ return led_max < DRIVER_LED_TOTAL;
+}
diff --git a/quantum/led_matrix/animations/runners/effect_runner_reactive.h b/quantum/led_matrix/animations/runners/effect_runner_reactive.h
new file mode 100644
index 0000000000..4369ea8c49
--- /dev/null
+++ b/quantum/led_matrix/animations/runners/effect_runner_reactive.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
+
+typedef uint8_t (*reactive_f)(uint8_t val, uint16_t offset);
+
+bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) {
+ LED_MATRIX_USE_LIMITS(led_min, led_max);
+
+ uint16_t max_tick = 65535 / led_matrix_eeconfig.speed;
+ for (uint8_t i = led_min; i < led_max; i++) {
+ LED_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, led_matrix_eeconfig.speed);
+ led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, offset));
+ }
+ return led_max < DRIVER_LED_TOTAL;
+}
+
+#endif // LED_MATRIX_KEYREACTIVE_ENABLED
diff --git a/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h b/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h
new file mode 100644
index 0000000000..d6eb9731ee
--- /dev/null
+++ b/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
+
+typedef uint8_t (*reactive_splash_f)(uint8_t val, 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) {
+ LED_MATRIX_USE_LIMITS(led_min, led_max);
+
+ uint8_t count = g_last_hit_tracker.count;
+ for (uint8_t i = led_min; i < led_max; i++) {
+ LED_MATRIX_TEST_LED_FLAGS();
+ uint8_t val = 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], led_matrix_eeconfig.speed);
+ val = effect_func(val, dx, dy, dist, tick);
+ }
+ led_matrix_set_value(i, scale8(val, led_matrix_eeconfig.val));
+ }
+ return led_max < DRIVER_LED_TOTAL;
+}
+
+#endif // LED_MATRIX_KEYREACTIVE_ENABLED
diff --git a/quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h b/quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h
new file mode 100644
index 0000000000..4a5219abd1
--- /dev/null
+++ b/quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h
@@ -0,0 +1,16 @@
+#pragma once
+
+typedef uint8_t (*sin_cos_i_f)(uint8_t val, 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) {
+ LED_MATRIX_USE_LIMITS(led_min, led_max);
+
+ uint16_t time = scale16by8(g_led_timer, led_matrix_eeconfig.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++) {
+ LED_MATRIX_TEST_LED_FLAGS();
+ led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, cos_value, sin_value, i, time));
+ }
+ return led_max < DRIVER_LED_TOTAL;
+}
diff --git a/quantum/led_matrix/animations/runners/led_matrix_runners.inc b/quantum/led_matrix/animations/runners/led_matrix_runners.inc
new file mode 100644
index 0000000000..c09022bb0f
--- /dev/null
+++ b/quantum/led_matrix/animations/runners/led_matrix_runners.inc
@@ -0,0 +1,6 @@
+#include "effect_runner_dx_dy_dist.h"
+#include "effect_runner_dx_dy.h"
+#include "effect_runner_i.h"
+#include "effect_runner_sin_cos_i.h"
+#include "effect_runner_reactive.h"
+#include "effect_runner_reactive_splash.h"
diff --git a/quantum/led_matrix/animations/solid_anim.h b/quantum/led_matrix/animations/solid_anim.h
new file mode 100644
index 0000000000..4c9e43c581
--- /dev/null
+++ b/quantum/led_matrix/animations/solid_anim.h
@@ -0,0 +1,15 @@
+LED_MATRIX_EFFECT(SOLID)
+#ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+bool SOLID(effect_params_t* params) {
+ LED_MATRIX_USE_LIMITS(led_min, led_max);
+
+ uint8_t val = led_matrix_eeconfig.val;
+ for (uint8_t i = led_min; i < led_max; i++) {
+ LED_MATRIX_TEST_LED_FLAGS();
+ led_matrix_set_value(i, val);
+ }
+ return led_max < DRIVER_LED_TOTAL;
+}
+
+#endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/solid_reactive_cross.h b/quantum/led_matrix/animations/solid_reactive_cross.h
new file mode 100644
index 0000000000..94425c959f
--- /dev/null
+++ b/quantum/led_matrix/animations/solid_reactive_cross.h
@@ -0,0 +1,35 @@
+#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
+# if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS)
+
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
+LED_MATRIX_EFFECT(SOLID_REACTIVE_CROSS)
+# endif
+
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
+LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS)
+# endif
+
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+static uint8_t SOLID_REACTIVE_CROSS_math(uint8_t val, 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;
+ dx = dx * 16 > 255 ? 255 : dx * 16;
+ dy = dy * 16 > 255 ? 255 : dy * 16;
+ effect += dx > dy ? dy : dx;
+ if (effect > 255) effect = 255;
+ return qadd8(val, 255 - effect);
+}
+
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
+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
+
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
+bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); }
+# endif
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+# endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS)
+#endif // LED_MATRIX_KEYREACTIVE_ENABLED
diff --git a/quantum/led_matrix/animations/solid_reactive_nexus.h b/quantum/led_matrix/animations/solid_reactive_nexus.h
new file mode 100644
index 0000000000..504b1104f1
--- /dev/null
+++ b/quantum/led_matrix/animations/solid_reactive_nexus.h
@@ -0,0 +1,32 @@
+#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
+# if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS)
+
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
+LED_MATRIX_EFFECT(SOLID_REACTIVE_NEXUS)
+# endif
+
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
+LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS)
+# endif
+
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+static uint8_t SOLID_REACTIVE_NEXUS_math(uint8_t val, 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;
+ if ((dx > 8 || dx < -8) && (dy > 8 || dy < -8)) effect = 255;
+ return qadd8(val, 255 - effect);
+}
+
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
+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
+
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
+bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); }
+# endif
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+# endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS)
+#endif // LED_MATRIX_KEYREACTIVE_ENABLED
diff --git a/quantum/led_matrix/animations/solid_reactive_simple_anim.h b/quantum/led_matrix/animations/solid_reactive_simple_anim.h
new file mode 100644
index 0000000000..4752a84162
--- /dev/null
+++ b/quantum/led_matrix/animations/solid_reactive_simple_anim.h
@@ -0,0 +1,12 @@
+#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE
+LED_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE)
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+static uint8_t SOLID_REACTIVE_SIMPLE_math(uint8_t val, uint16_t offset) { return scale8(255 - offset, val); }
+
+bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) { return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math); }
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+# endif // DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE
+#endif // LED_MATRIX_KEYREACTIVE_ENABLED
diff --git a/quantum/led_matrix/animations/solid_reactive_wide.h b/quantum/led_matrix/animations/solid_reactive_wide.h
new file mode 100644
index 0000000000..922e32fe5f
--- /dev/null
+++ b/quantum/led_matrix/animations/solid_reactive_wide.h
@@ -0,0 +1,30 @@
+#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
+# if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE)
+
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
+LED_MATRIX_EFFECT(SOLID_REACTIVE_WIDE)
+# endif
+
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
+LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE)
+# endif
+
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+static uint8_t SOLID_REACTIVE_WIDE_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
+ uint16_t effect = tick + dist * 5;
+ if (effect > 255) effect = 255;
+ return qadd8(val, 255 - effect);
+}
+
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
+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
+
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
+bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); }
+# endif
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+# endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE)
+#endif // LED_MATRIX_KEYREACTIVE_ENABLED
diff --git a/quantum/led_matrix/animations/solid_splash_anim.h b/quantum/led_matrix/animations/solid_splash_anim.h
new file mode 100644
index 0000000000..d95889b813
--- /dev/null
+++ b/quantum/led_matrix/animations/solid_splash_anim.h
@@ -0,0 +1,30 @@
+#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
+# if !defined(DISABLE_LED_MATRIX_SOLID_SPLASH) || !defined(DISABLE_LED_MATRIX_SOLID_MULTISPLASH)
+
+# ifndef DISABLE_LED_MATRIX_SOLID_SPLASH
+LED_MATRIX_EFFECT(SOLID_SPLASH)
+# endif
+
+# ifndef DISABLE_LED_MATRIX_SOLID_MULTISPLASH
+LED_MATRIX_EFFECT(SOLID_MULTISPLASH)
+# endif
+
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+uint8_t SOLID_SPLASH_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
+ uint16_t effect = tick - dist;
+ if (effect > 255) effect = 255;
+ return qadd8(val, 255 - effect);
+}
+
+# ifndef DISABLE_LED_MATRIX_SOLID_SPLASH
+bool SOLID_SPLASH(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math); }
+# endif
+
+# ifndef DISABLE_LED_MATRIX_SOLID_MULTISPLASH
+bool SOLID_MULTISPLASH(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); }
+# endif
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+# endif // !defined(DISABLE_LED_MATRIX_SPLASH) && !defined(DISABLE_LED_MATRIX_MULTISPLASH)
+#endif // LED_MATRIX_KEYREACTIVE_ENABLED
diff --git a/quantum/led_matrix/animations/wave_left_right_anim.h b/quantum/led_matrix/animations/wave_left_right_anim.h
new file mode 100644
index 0000000000..8579f1b45f
--- /dev/null
+++ b/quantum/led_matrix/animations/wave_left_right_anim.h
@@ -0,0 +1,10 @@
+#ifndef DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT
+LED_MATRIX_EFFECT(WAVE_LEFT_RIGHT)
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+static uint8_t WAVE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(sin8(g_led_config.point[i].x - time), val); }
+
+bool WAVE_LEFT_RIGHT(effect_params_t* params) { return effect_runner_i(params, &WAVE_LEFT_RIGHT_math); }
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+#endif // DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT
diff --git a/quantum/led_matrix/animations/wave_up_down_anim.h b/quantum/led_matrix/animations/wave_up_down_anim.h
new file mode 100644
index 0000000000..635c608414
--- /dev/null
+++ b/quantum/led_matrix/animations/wave_up_down_anim.h
@@ -0,0 +1,10 @@
+#ifndef DISABLE_LED_MATRIX_WAVE_UP_DOWN
+LED_MATRIX_EFFECT(WAVE_UP_DOWN)
+# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+static uint8_t WAVE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(sin8(g_led_config.point[i].y - time), val); }
+
+bool WAVE_UP_DOWN(effect_params_t* params) { return effect_runner_i(params, &WAVE_UP_DOWN_math); }
+
+# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+#endif // DISABLE_LED_MATRIX_WAVE_UP_DOWN
diff --git a/quantum/led_matrix/led_matrix.c b/quantum/led_matrix/led_matrix.c
new file mode 100644
index 0000000000..32788866c5
--- /dev/null
+++ b/quantum/led_matrix/led_matrix.c
@@ -0,0 +1,577 @@
+/* Copyright 2017 Jason Williams
+ * Copyright 2017 Jack Humbert
+ * Copyright 2018 Yiancar
+ * Copyright 2019 Clueboard
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "led_matrix.h"
+#include "progmem.h"
+#include "config.h"
+#include "eeprom.h"
+#include
+#include
+#include "led_tables.h"
+
+#include
+
+#ifndef LED_MATRIX_CENTER
+const led_point_t k_led_matrix_center = {112, 32};
+#else
+const led_point_t k_led_matrix_center = LED_MATRIX_CENTER;
+#endif
+
+// clang-format off
+#ifndef LED_MATRIX_IMMEDIATE_EEPROM
+# define led_eeconfig_update(v) led_update_eeprom |= v
+#else
+# define led_eeconfig_update(v) if (v) eeconfig_update_led_matrix()
+#endif
+// clang-format on
+
+// Generic effect runners
+#include "led_matrix_runners.inc"
+
+// ------------------------------------------
+// -----Begin led effect includes macros-----
+#define LED_MATRIX_EFFECT(name)
+#define LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+#include "led_matrix_effects.inc"
+#ifdef LED_MATRIX_CUSTOM_KB
+# include "led_matrix_kb.inc"
+#endif
+#ifdef LED_MATRIX_CUSTOM_USER
+# include "led_matrix_user.inc"
+#endif
+
+#undef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+#undef LED_MATRIX_EFFECT
+// -----End led effect includes macros-------
+// ------------------------------------------
+
+#if defined(LED_DISABLE_AFTER_TIMEOUT) && !defined(LED_DISABLE_TIMEOUT)
+# define LED_DISABLE_TIMEOUT (LED_DISABLE_AFTER_TIMEOUT * 1200UL)
+#endif
+
+#ifndef LED_DISABLE_TIMEOUT
+# define LED_DISABLE_TIMEOUT 0
+#endif
+
+#if !defined(LED_MATRIX_MAXIMUM_BRIGHTNESS) || LED_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX
+# undef LED_MATRIX_MAXIMUM_BRIGHTNESS
+# define LED_MATRIX_MAXIMUM_BRIGHTNESS UINT8_MAX
+#endif
+
+#if !defined(LED_MATRIX_VAL_STEP)
+# define LED_MATRIX_VAL_STEP 8
+#endif
+
+#if !defined(LED_MATRIX_SPD_STEP)
+# define LED_MATRIX_SPD_STEP 16
+#endif
+
+#if !defined(LED_MATRIX_STARTUP_MODE)
+# define LED_MATRIX_STARTUP_MODE LED_MATRIX_SOLID
+#endif
+
+#if !defined(LED_MATRIX_STARTUP_VAL)
+# define LED_MATRIX_STARTUP_VAL LED_MATRIX_MAXIMUM_BRIGHTNESS
+#endif
+
+#if !defined(LED_MATRIX_STARTUP_SPD)
+# define LED_MATRIX_STARTUP_SPD UINT8_MAX / 2
+#endif
+
+// globals
+led_eeconfig_t led_matrix_eeconfig; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr
+uint32_t g_led_timer;
+#ifdef LED_MATRIX_FRAMEBUFFER_EFFECTS
+uint8_t g_led_frame_buffer[MATRIX_ROWS][MATRIX_COLS] = {{0}};
+#endif // LED_MATRIX_FRAMEBUFFER_EFFECTS
+#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
+last_hit_t g_last_hit_tracker;
+#endif // LED_MATRIX_KEYREACTIVE_ENABLED
+
+// internals
+static bool suspend_state = false;
+static bool led_update_eeprom = false;
+static uint8_t led_last_enable = UINT8_MAX;
+static uint8_t led_last_effect = UINT8_MAX;
+static effect_params_t led_effect_params = {0, LED_FLAG_ALL, false};
+static led_task_states led_task_state = SYNCING;
+#if LED_DISABLE_TIMEOUT > 0
+static uint32_t led_anykey_timer;
+#endif // LED_DISABLE_TIMEOUT > 0
+
+// double buffers
+static uint32_t led_timer_buffer;
+#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
+static last_hit_t last_hit_buffer;
+#endif // LED_MATRIX_KEYREACTIVE_ENABLED
+
+// split led matrix
+#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
+const uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT;
+#endif
+
+void eeconfig_read_led_matrix(void) { eeprom_read_block(&led_matrix_eeconfig, EECONFIG_LED_MATRIX, sizeof(led_matrix_eeconfig)); }
+
+void eeconfig_update_led_matrix(void) { eeprom_update_block(&led_matrix_eeconfig, EECONFIG_LED_MATRIX, sizeof(led_matrix_eeconfig)); }
+
+void eeconfig_update_led_matrix_default(void) {
+ dprintf("eeconfig_update_led_matrix_default\n");
+ led_matrix_eeconfig.enable = 1;
+ led_matrix_eeconfig.mode = LED_MATRIX_STARTUP_MODE;
+ led_matrix_eeconfig.val = LED_MATRIX_STARTUP_VAL;
+ led_matrix_eeconfig.speed = LED_MATRIX_STARTUP_SPD;
+ led_matrix_eeconfig.flags = LED_FLAG_ALL;
+ eeconfig_update_led_matrix();
+}
+
+void eeconfig_debug_led_matrix(void) {
+ dprintf("led_matrix_eeconfig EEPROM\n");
+ dprintf("led_matrix_eeconfig.enable = %d\n", led_matrix_eeconfig.enable);
+ dprintf("led_matrix_eeconfig.mode = %d\n", led_matrix_eeconfig.mode);
+ dprintf("led_matrix_eeconfig.val = %d\n", led_matrix_eeconfig.val);
+ dprintf("led_matrix_eeconfig.speed = %d\n", led_matrix_eeconfig.speed);
+ dprintf("led_matrix_eeconfig.flags = %d\n", led_matrix_eeconfig.flags);
+}
+
+__attribute__((weak)) uint8_t led_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { return 0; }
+
+uint8_t led_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i) {
+ uint8_t led_count = led_matrix_map_row_column_to_led_kb(row, column, led_i);
+ uint8_t led_index = g_led_config.matrix_co[row][column];
+ if (led_index != NO_LED) {
+ led_i[led_count] = led_index;
+ led_count++;
+ }
+ return led_count;
+}
+
+void led_matrix_update_pwm_buffers(void) { led_matrix_driver.flush(); }
+
+void led_matrix_set_value(int index, uint8_t value) {
+#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
+ if (!is_keyboard_left() && index >= k_led_matrix_split[0])
+# ifdef USE_CIE1931_CURVE
+ led_matrix_driver.set_value(index - k_led_matrix_split[0], pgm_read_byte(&CIE1931_CURVE[value]));
+# else
+ led_matrix_driver.set_value(index - k_led_matrix_split[0], value);
+# endif
+ else if (is_keyboard_left() && index < k_led_matrix_split[0])
+#endif
+#ifdef USE_CIE1931_CURVE
+ led_matrix_driver.set_value(index, pgm_read_byte(&CIE1931_CURVE[value]));
+#else
+ led_matrix_driver.set_value(index, value);
+#endif
+}
+
+void led_matrix_set_value_all(uint8_t value) {
+#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
+ for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) led_matrix_set_value(i, value);
+#else
+# ifdef USE_CIE1931_CURVE
+ led_matrix_driver.set_value_all(pgm_read_byte(&CIE1931_CURVE[value]));
+# else
+ led_matrix_driver.set_value_all(value);
+# endif
+#endif
+}
+
+void process_led_matrix(uint8_t row, uint8_t col, bool pressed) {
+#ifndef LED_MATRIX_SPLIT
+ if (!is_keyboard_master()) return;
+#endif
+#if LED_DISABLE_TIMEOUT > 0
+ led_anykey_timer = 0;
+#endif // LED_DISABLE_TIMEOUT > 0
+
+#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
+ uint8_t led[LED_HITS_TO_REMEMBER];
+ uint8_t led_count = 0;
+
+# if defined(LED_MATRIX_KEYRELEASES)
+ if (!pressed)
+# elif defined(LED_MATRIX_KEYPRESSES)
+ if (pressed)
+# endif // defined(LED_MATRIX_KEYRELEASES)
+ {
+ led_count = led_matrix_map_row_column_to_led(row, col, led);
+ }
+
+ if (last_hit_buffer.count + led_count > LED_HITS_TO_REMEMBER) {
+ memcpy(&last_hit_buffer.x[0], &last_hit_buffer.x[led_count], LED_HITS_TO_REMEMBER - led_count);
+ memcpy(&last_hit_buffer.y[0], &last_hit_buffer.y[led_count], LED_HITS_TO_REMEMBER - led_count);
+ memcpy(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit
+ memcpy(&last_hit_buffer.index[0], &last_hit_buffer.index[led_count], LED_HITS_TO_REMEMBER - led_count);
+ last_hit_buffer.count--;
+ }
+
+ for (uint8_t i = 0; i < led_count; i++) {
+ uint8_t index = last_hit_buffer.count;
+ last_hit_buffer.x[index] = g_led_config.point[led[i]].x;
+ last_hit_buffer.y[index] = g_led_config.point[led[i]].y;
+ last_hit_buffer.index[index] = led[i];
+ last_hit_buffer.tick[index] = 0;
+ last_hit_buffer.count++;
+ }
+#endif // LED_MATRIX_KEYREACTIVE_ENABLED
+
+#if defined(LED_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_LED_MATRIX_TYPING_HEATMAP)
+ if (led_matrix_eeconfig.mode == LED_MATRIX_TYPING_HEATMAP) {
+ process_led_matrix_typing_heatmap(row, col);
+ }
+#endif // defined(LED_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_LED_MATRIX_TYPING_HEATMAP)
+}
+
+static bool led_matrix_none(effect_params_t *params) {
+ if (!params->init) {
+ return false;
+ }
+
+ led_matrix_set_value_all(0);
+ return false;
+}
+
+static void led_task_timers(void) {
+#if defined(LED_MATRIX_KEYREACTIVE_ENABLED) || LED_DISABLE_TIMEOUT > 0
+ uint32_t deltaTime = sync_timer_elapsed32(led_timer_buffer);
+#endif // defined(LED_MATRIX_KEYREACTIVE_ENABLED) || LED_DISABLE_TIMEOUT > 0
+ led_timer_buffer = sync_timer_read32();
+
+ // Update double buffer timers
+#if LED_DISABLE_TIMEOUT > 0
+ if (led_anykey_timer < UINT32_MAX) {
+ if (UINT32_MAX - deltaTime < led_anykey_timer) {
+ led_anykey_timer = UINT32_MAX;
+ } else {
+ led_anykey_timer += deltaTime;
+ }
+ }
+#endif // LED_DISABLE_TIMEOUT > 0
+
+ // Update double buffer last hit timers
+#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
+ uint8_t count = last_hit_buffer.count;
+ for (uint8_t i = 0; i < count; ++i) {
+ if (UINT16_MAX - deltaTime < last_hit_buffer.tick[i]) {
+ last_hit_buffer.count--;
+ continue;
+ }
+ last_hit_buffer.tick[i] += deltaTime;
+ }
+#endif // LED_MATRIX_KEYREACTIVE_ENABLED
+}
+
+static void led_task_sync(void) {
+ // next task
+ if (led_update_eeprom) eeconfig_update_led_matrix();
+ led_update_eeprom = false;
+ if (sync_timer_elapsed32(g_led_timer) >= LED_MATRIX_LED_FLUSH_LIMIT) led_task_state = STARTING;
+}
+
+static void led_task_start(void) {
+ // reset iter
+ led_effect_params.iter = 0;
+
+ // update double buffers
+ g_led_timer = led_timer_buffer;
+#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
+ g_last_hit_tracker = last_hit_buffer;
+#endif // LED_MATRIX_KEYREACTIVE_ENABLED
+
+ // next task
+ led_task_state = RENDERING;
+}
+
+static void led_task_render(uint8_t effect) {
+ bool rendering = false;
+ led_effect_params.init = (effect != led_last_effect) || (led_matrix_eeconfig.enable != led_last_enable);
+ if (led_effect_params.flags != led_matrix_eeconfig.flags) {
+ led_effect_params.flags = led_matrix_eeconfig.flags;
+ led_matrix_set_value_all(0);
+ }
+
+ // each effect can opt to do calculations
+ // and/or request PWM buffer updates.
+ switch (effect) {
+ case LED_MATRIX_NONE:
+ rendering = led_matrix_none(&led_effect_params);
+ break;
+
+// ---------------------------------------------
+// -----Begin led effect switch case macros-----
+#define LED_MATRIX_EFFECT(name, ...) \
+ case LED_MATRIX_##name: \
+ rendering = name(&led_effect_params); \
+ break;
+#include "led_matrix_effects.inc"
+#undef LED_MATRIX_EFFECT
+
+#if defined(LED_MATRIX_CUSTOM_KB) || defined(LED_MATRIX_CUSTOM_USER)
+# define LED_MATRIX_EFFECT(name, ...) \
+ case LED_MATRIX_CUSTOM_##name: \
+ rendering = name(&led_effect_params); \
+ break;
+# ifdef LED_MATRIX_CUSTOM_KB
+# include "led_matrix_kb.inc"
+# endif
+# ifdef LED_MATRIX_CUSTOM_USER
+# include "led_matrix_user.inc"
+# endif
+# undef LED_MATRIX_EFFECT
+#endif
+ // -----End led effect switch case macros-------
+ // ---------------------------------------------
+ }
+
+ led_effect_params.iter++;
+
+ // next task
+ if (!rendering) {
+ led_task_state = FLUSHING;
+ if (!led_effect_params.init && effect == LED_MATRIX_NONE) {
+ // We only need to flush once if we are LED_MATRIX_NONE
+ led_task_state = SYNCING;
+ }
+ }
+}
+
+static void led_task_flush(uint8_t effect) {
+ // update last trackers after the first full render so we can init over several frames
+ led_last_effect = effect;
+ led_last_enable = led_matrix_eeconfig.enable;
+
+ // update pwm buffers
+ led_matrix_update_pwm_buffers();
+
+ // next task
+ led_task_state = SYNCING;
+}
+
+void led_matrix_task(void) {
+ led_task_timers();
+
+ // Ideally we would also stop sending zeros to the LED driver PWM buffers
+ // while suspended and just do a software shutdown. This is a cheap hack for now.
+ bool suspend_backlight = suspend_state ||
+#if LED_DISABLE_TIMEOUT > 0
+ (led_anykey_timer > (uint32_t)LED_DISABLE_TIMEOUT) ||
+#endif // LED_DISABLE_TIMEOUT > 0
+ false;
+
+ uint8_t effect = suspend_backlight || !led_matrix_eeconfig.enable ? 0 : led_matrix_eeconfig.mode;
+
+ switch (led_task_state) {
+ case STARTING:
+ led_task_start();
+ break;
+ case RENDERING:
+ led_task_render(effect);
+ if (effect) {
+ led_matrix_indicators();
+ led_matrix_indicators_advanced(&led_effect_params);
+ }
+ break;
+ case FLUSHING:
+ led_task_flush(effect);
+ break;
+ case SYNCING:
+ led_task_sync();
+ break;
+ }
+}
+
+void led_matrix_indicators(void) {
+ led_matrix_indicators_kb();
+ led_matrix_indicators_user();
+}
+
+__attribute__((weak)) void led_matrix_indicators_kb(void) {}
+
+__attribute__((weak)) void led_matrix_indicators_user(void) {}
+
+void led_matrix_indicators_advanced(effect_params_t *params) {
+ /* special handling is needed for "params->iter", since it's already been incremented.
+ * Could move the invocations to led_task_render, but then it's missing a few checks
+ * and not sure which would be better. Otherwise, this should be called from
+ * led_task_render, right before the iter++ line.
+ */
+#if defined(LED_MATRIX_LED_PROCESS_LIMIT) && LED_MATRIX_LED_PROCESS_LIMIT > 0 && LED_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL
+ uint8_t min = LED_MATRIX_LED_PROCESS_LIMIT * (params->iter - 1);
+ uint8_t max = min + LED_MATRIX_LED_PROCESS_LIMIT;
+ if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL;
+#else
+ uint8_t min = 0;
+ uint8_t max = DRIVER_LED_TOTAL;
+#endif
+ led_matrix_indicators_advanced_kb(min, max);
+ led_matrix_indicators_advanced_user(min, max);
+}
+
+__attribute__((weak)) void led_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {}
+
+__attribute__((weak)) void led_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {}
+
+void led_matrix_init(void) {
+ led_matrix_driver.init();
+
+#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
+ g_last_hit_tracker.count = 0;
+ for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) {
+ g_last_hit_tracker.tick[i] = UINT16_MAX;
+ }
+
+ last_hit_buffer.count = 0;
+ for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) {
+ last_hit_buffer.tick[i] = UINT16_MAX;
+ }
+#endif // LED_MATRIX_KEYREACTIVE_ENABLED
+
+ if (!eeconfig_is_enabled()) {
+ dprintf("led_matrix_init_drivers eeconfig is not enabled.\n");
+ eeconfig_init();
+ eeconfig_update_led_matrix_default();
+ }
+
+ eeconfig_read_led_matrix();
+ if (!led_matrix_eeconfig.mode) {
+ dprintf("led_matrix_init_drivers led_matrix_eeconfig.mode = 0. Write default values to EEPROM.\n");
+ eeconfig_update_led_matrix_default();
+ }
+ eeconfig_debug_led_matrix(); // display current eeprom values
+}
+
+void led_matrix_set_suspend_state(bool state) {
+#ifdef LED_DISABLE_WHEN_USB_SUSPENDED
+ if (state) {
+ led_matrix_set_value_all(0); // turn off all LEDs when suspending
+ }
+ suspend_state = state;
+#endif
+}
+
+bool led_matrix_get_suspend_state(void) { return suspend_state; }
+
+void led_matrix_toggle_eeprom_helper(bool write_to_eeprom) {
+ led_matrix_eeconfig.enable ^= 1;
+ led_task_state = STARTING;
+ led_eeconfig_update(write_to_eeprom);
+ dprintf("led matrix toggle [%s]: led_matrix_eeconfig.enable = %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.enable);
+}
+void led_matrix_toggle_noeeprom(void) { led_matrix_toggle_eeprom_helper(false); }
+void led_matrix_toggle(void) { led_matrix_toggle_eeprom_helper(true); }
+
+void led_matrix_enable(void) {
+ led_matrix_enable_noeeprom();
+ led_eeconfig_update(true);
+}
+
+void led_matrix_enable_noeeprom(void) {
+ if (!led_matrix_eeconfig.enable) led_task_state = STARTING;
+ led_matrix_eeconfig.enable = 1;
+}
+
+void led_matrix_disable(void) {
+ led_matrix_disable_noeeprom();
+ led_eeconfig_update(true);
+}
+
+void led_matrix_disable_noeeprom(void) {
+ if (led_matrix_eeconfig.enable) led_task_state = STARTING;
+ led_matrix_eeconfig.enable = 0;
+}
+
+uint8_t led_matrix_is_enabled(void) { return led_matrix_eeconfig.enable; }
+
+void led_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
+ if (!led_matrix_eeconfig.enable) {
+ return;
+ }
+ if (mode < 1) {
+ led_matrix_eeconfig.mode = 1;
+ } else if (mode >= LED_MATRIX_EFFECT_MAX) {
+ led_matrix_eeconfig.mode = LED_MATRIX_EFFECT_MAX - 1;
+ } else {
+ led_matrix_eeconfig.mode = mode;
+ }
+ led_task_state = STARTING;
+ led_eeconfig_update(write_to_eeprom);
+ dprintf("led matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.mode);
+}
+void led_matrix_mode_noeeprom(uint8_t mode) { led_matrix_mode_eeprom_helper(mode, false); }
+void led_matrix_mode(uint8_t mode) { led_matrix_mode_eeprom_helper(mode, true); }
+
+uint8_t led_matrix_get_mode(void) { return led_matrix_eeconfig.mode; }
+
+void led_matrix_step_helper(bool write_to_eeprom) {
+ uint8_t mode = led_matrix_eeconfig.mode + 1;
+ led_matrix_mode_eeprom_helper((mode < LED_MATRIX_EFFECT_MAX) ? mode : 1, write_to_eeprom);
+}
+void led_matrix_step_noeeprom(void) { led_matrix_step_helper(false); }
+void led_matrix_step(void) { led_matrix_step_helper(true); }
+
+void led_matrix_step_reverse_helper(bool write_to_eeprom) {
+ uint8_t mode = led_matrix_eeconfig.mode - 1;
+ led_matrix_mode_eeprom_helper((mode < 1) ? LED_MATRIX_EFFECT_MAX - 1 : mode, write_to_eeprom);
+}
+void led_matrix_step_reverse_noeeprom(void) { led_matrix_step_reverse_helper(false); }
+void led_matrix_step_reverse(void) { led_matrix_step_reverse_helper(true); }
+
+void led_matrix_set_val_eeprom_helper(uint8_t val, bool write_to_eeprom) {
+ if (!led_matrix_eeconfig.enable) {
+ return;
+ }
+ led_matrix_eeconfig.val = (val > LED_MATRIX_MAXIMUM_BRIGHTNESS) ? LED_MATRIX_MAXIMUM_BRIGHTNESS : val;
+ led_eeconfig_update(write_to_eeprom);
+ dprintf("led matrix set val [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.val);
+}
+void led_matrix_set_val_noeeprom(uint8_t val) { led_matrix_set_val_eeprom_helper(val, false); }
+void led_matrix_set_val(uint8_t val) { led_matrix_set_val_eeprom_helper(val, true); }
+
+uint8_t led_matrix_get_val(void) { return led_matrix_eeconfig.val; }
+
+void led_matrix_increase_val_helper(bool write_to_eeprom) { led_matrix_set_val_eeprom_helper(qadd8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom); }
+void led_matrix_increase_val_noeeprom(void) { led_matrix_increase_val_helper(false); }
+void led_matrix_increase_val(void) { led_matrix_increase_val_helper(true); }
+
+void led_matrix_decrease_val_helper(bool write_to_eeprom) { led_matrix_set_val_eeprom_helper(qsub8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom); }
+void led_matrix_decrease_val_noeeprom(void) { led_matrix_decrease_val_helper(false); }
+void led_matrix_decrease_val(void) { led_matrix_decrease_val_helper(true); }
+
+void led_matrix_set_speed_eeprom_helper(uint8_t speed, bool write_to_eeprom) {
+ led_matrix_eeconfig.speed = speed;
+ led_eeconfig_update(write_to_eeprom);
+ dprintf("led matrix set speed [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.speed);
+}
+void led_matrix_set_speed_noeeprom(uint8_t speed) { led_matrix_set_speed_eeprom_helper(speed, false); }
+void led_matrix_set_speed(uint8_t speed) { led_matrix_set_speed_eeprom_helper(speed, true); }
+
+uint8_t led_matrix_get_speed(void) { return led_matrix_eeconfig.speed; }
+
+void led_matrix_increase_speed_helper(bool write_to_eeprom) { led_matrix_set_speed_eeprom_helper(qadd8(led_matrix_eeconfig.speed, LED_MATRIX_SPD_STEP), write_to_eeprom); }
+void led_matrix_increase_speed_noeeprom(void) { led_matrix_increase_speed_helper(false); }
+void led_matrix_increase_speed(void) { led_matrix_increase_speed_helper(true); }
+
+void led_matrix_decrease_speed_helper(bool write_to_eeprom) { led_matrix_set_speed_eeprom_helper(qsub8(led_matrix_eeconfig.speed, LED_MATRIX_SPD_STEP), write_to_eeprom); }
+void led_matrix_decrease_speed_noeeprom(void) { led_matrix_decrease_speed_helper(false); }
+void led_matrix_decrease_speed(void) { led_matrix_decrease_speed_helper(true); }
+
+led_flags_t led_matrix_get_flags(void) { return led_matrix_eeconfig.flags; }
+
+void led_matrix_set_flags(led_flags_t flags) { led_matrix_eeconfig.flags = flags; }
diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h
new file mode 100644
index 0000000000..6f85854fbe
--- /dev/null
+++ b/quantum/led_matrix/led_matrix.h
@@ -0,0 +1,160 @@
+/* Copyright 2017 Jason Williams
+ * Copyright 2017 Jack Humbert
+ * Copyright 2018 Yiancar
+ * Copyright 2019 Clueboard
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+
+#include
+#include
+#include "led_matrix_types.h"
+#include "quantum.h"
+
+#ifdef IS31FL3731
+# include "is31fl3731-simple.h"
+#endif
+
+#ifndef LED_MATRIX_LED_FLUSH_LIMIT
+# define LED_MATRIX_LED_FLUSH_LIMIT 16
+#endif
+
+#ifndef LED_MATRIX_LED_PROCESS_LIMIT
+# define LED_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5
+#endif
+
+#if defined(LED_MATRIX_LED_PROCESS_LIMIT) && LED_MATRIX_LED_PROCESS_LIMIT > 0 && LED_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL
+# define LED_MATRIX_USE_LIMITS(min, max) \
+ uint8_t min = LED_MATRIX_LED_PROCESS_LIMIT * params->iter; \
+ uint8_t max = min + LED_MATRIX_LED_PROCESS_LIMIT; \
+ if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL;
+#else
+# define LED_MATRIX_USE_LIMITS(min, max) \
+ uint8_t min = 0; \
+ uint8_t max = DRIVER_LED_TOTAL;
+#endif
+
+#define LED_MATRIX_TEST_LED_FLAGS() \
+ if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) continue
+
+enum led_matrix_effects {
+ LED_MATRIX_NONE = 0,
+
+// --------------------------------------
+// -----Begin led effect enum macros-----
+#define LED_MATRIX_EFFECT(name, ...) LED_MATRIX_##name,
+#include "led_matrix_effects.inc"
+#undef LED_MATRIX_EFFECT
+
+#if defined(LED_MATRIX_CUSTOM_KB) || defined(LED_MATRIX_CUSTOM_USER)
+# define LED_MATRIX_EFFECT(name, ...) LED_MATRIX_CUSTOM_##name,
+# ifdef LED_MATRIX_CUSTOM_KB
+# include "led_matrix_kb.inc"
+# endif
+# ifdef LED_MATRIX_CUSTOM_USER
+# include "led_matrix_user.inc"
+# endif
+# undef LED_MATRIX_EFFECT
+#endif
+ // --------------------------------------
+ // -----End led effect enum macros-------
+
+ LED_MATRIX_EFFECT_MAX
+};
+
+void eeconfig_update_led_matrix_default(void);
+void eeconfig_update_led_matrix(void);
+void eeconfig_debug_led_matrix(void);
+
+uint8_t led_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i);
+uint8_t led_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i);
+
+void led_matrix_set_value(int index, uint8_t value);
+void led_matrix_set_value_all(uint8_t value);
+
+void process_led_matrix(uint8_t row, uint8_t col, bool pressed);
+
+void led_matrix_task(void);
+
+// This runs after another backlight effect and replaces
+// values already set
+void led_matrix_indicators(void);
+void led_matrix_indicators_kb(void);
+void led_matrix_indicators_user(void);
+
+void led_matrix_indicators_advanced(effect_params_t *params);
+void led_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max);
+void led_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max);
+
+void led_matrix_init(void);
+
+void led_matrix_set_suspend_state(bool state);
+bool led_matrix_get_suspend_state(void);
+void led_matrix_toggle(void);
+void led_matrix_toggle_noeeprom(void);
+void led_matrix_enable(void);
+void led_matrix_enable_noeeprom(void);
+void led_matrix_disable(void);
+void led_matrix_disable_noeeprom(void);
+uint8_t led_matrix_is_enabled(void);
+void led_matrix_mode(uint8_t mode);
+void led_matrix_mode_noeeprom(uint8_t mode);
+uint8_t led_matrix_get_mode(void);
+void led_matrix_step(void);
+void led_matrix_step_noeeprom(void);
+void led_matrix_step_reverse(void);
+void led_matrix_step_reverse_noeeprom(void);
+void led_matrix_set_val(uint8_t val);
+void led_matrix_set_val_noeeprom(uint8_t val);
+uint8_t led_matrix_get_val(void);
+void led_matrix_increase_val(void);
+void led_matrix_increase_val_noeeprom(void);
+void led_matrix_decrease_val(void);
+void led_matrix_decrease_val_noeeprom(void);
+void led_matrix_set_speed(uint8_t speed);
+void led_matrix_set_speed_noeeprom(uint8_t speed);
+uint8_t led_matrix_get_speed(void);
+void led_matrix_increase_speed(void);
+void led_matrix_increase_speed_noeeprom(void);
+void led_matrix_decrease_speed(void);
+void led_matrix_decrease_speed_noeeprom(void);
+led_flags_t led_matrix_get_flags(void);
+void led_matrix_set_flags(led_flags_t flags);
+
+typedef struct {
+ /* Perform any initialisation required for the other driver functions to work. */
+ void (*init)(void);
+
+ /* Set the brightness of a single LED in the buffer. */
+ void (*set_value)(int index, uint8_t value);
+ /* Set the brightness of all LEDS on the keyboard in the buffer. */
+ void (*set_value_all)(uint8_t value);
+ /* Flush any buffered changes to the hardware. */
+ void (*flush)(void);
+} led_matrix_driver_t;
+
+extern const led_matrix_driver_t led_matrix_driver;
+
+extern led_eeconfig_t led_matrix_eeconfig;
+
+extern uint32_t g_led_timer;
+extern led_config_t g_led_config;
+#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
+extern last_hit_t g_last_hit_tracker;
+#endif
+#ifdef LED_MATRIX_FRAMEBUFFER_EFFECTS
+extern uint8_t g_led_frame_buffer[MATRIX_ROWS][MATRIX_COLS];
+#endif
diff --git a/quantum/led_matrix/led_matrix_drivers.c b/quantum/led_matrix/led_matrix_drivers.c
new file mode 100644
index 0000000000..1d46b2c506
--- /dev/null
+++ b/quantum/led_matrix/led_matrix_drivers.c
@@ -0,0 +1,153 @@
+/* Copyright 2018 James Laird-Wah
+ * Copyright 2019 Clueboard
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "led_matrix.h"
+
+/* Each driver needs to define a struct:
+ *
+ * const led_matrix_driver_t led_matrix_driver;
+ *
+ * All members must be provided. Keyboard custom drivers must define this
+ * in their own files.
+ */
+
+#if defined(IS31FL3731) || defined(IS31FL3733)
+
+# include "i2c_master.h"
+
+static void init(void) {
+ i2c_init();
+# ifdef IS31FL3731
+# ifdef LED_DRIVER_ADDR_1
+ IS31FL3731_init(LED_DRIVER_ADDR_1);
+# endif
+# ifdef LED_DRIVER_ADDR_2
+ IS31FL3731_init(LED_DRIVER_ADDR_2);
+# endif
+# ifdef LED_DRIVER_ADDR_3
+ IS31FL3731_init(LED_DRIVER_ADDR_3);
+# endif
+# ifdef LED_DRIVER_ADDR_4
+ IS31FL3731_init(LED_DRIVER_ADDR_4);
+# endif
+# else
+# ifdef LED_DRIVER_ADDR_1
+# ifndef LED_DRIVER_SYNC_1
+# define LED_DRIVER_SYNC_1 0
+# endif
+ IS31FL3733_init(LED_DRIVER_ADDR_1, LED_DRIVER_SYNC_1);
+# endif
+# ifdef LED_DRIVER_ADDR_2
+# ifndef LED_DRIVER_SYNC_2
+# define LED_DRIVER_SYNC_2 0
+# endif
+ IS31FL3733_init(LED_DRIVER_ADDR_2, LED_DRIVER_SYNC_2);
+# endif
+# ifdef LED_DRIVER_ADDR_3
+# ifndef LED_DRIVER_SYNC_3
+# define LED_DRIVER_SYNC_3 0
+# endif
+ IS31FL3733_init(LED_DRIVER_ADDR_3, LED_DRIVER_SYNC_3);
+# endif
+# ifdef LED_DRIVER_ADDR_4
+# ifndef LED_DRIVER_SYNC_4
+# define LED_DRIVER_SYNC_4 0
+# endif
+ IS31FL3733_init(LED_DRIVER_ADDR_4, LED_DRIVER_SYNC_4);
+# endif
+# endif
+
+ for (int index = 0; index < DRIVER_LED_TOTAL; index++) {
+# ifdef IS31FL3731
+ IS31FL3731_set_led_control_register(index, true);
+# else
+ IS31FL3733_set_led_control_register(index, true);
+# endif
+ }
+// This actually updates the LED drivers
+# ifdef IS31FL3731
+# ifdef LED_DRIVER_ADDR_1
+ IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_1, 0);
+# endif
+# ifdef LED_DRIVER_ADDR_2
+ IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_2, 1);
+# endif
+# ifdef LED_DRIVER_ADDR_3
+ IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_3, 2);
+# endif
+# ifdef LED_DRIVER_ADDR_4
+ IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_4, 3);
+# endif
+# else
+# ifdef LED_DRIVER_ADDR_1
+ IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_1, 0);
+# endif
+# ifdef LED_DRIVER_ADDR_2
+ IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_2, 1);
+# endif
+# ifdef LED_DRIVER_ADDR_3
+ IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_3, 2);
+# endif
+# ifdef LED_DRIVER_ADDR_4
+ IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_4, 3);
+# endif
+# endif
+}
+
+static void flush(void) {
+# ifdef IS31FL3731
+# ifdef LED_DRIVER_ADDR_1
+ IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_1, 0);
+# endif
+# ifdef LED_DRIVER_ADDR_2
+ IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_2, 1);
+# endif
+# ifdef LED_DRIVER_ADDR_3
+ IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_3, 2);
+# endif
+# ifdef LED_DRIVER_ADDR_4
+ IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_4, 3);
+# endif
+# else
+# ifdef LED_DRIVER_ADDR_1
+ IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_1, 0);
+# endif
+# ifdef LED_DRIVER_ADDR_2
+ IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_2, 1);
+# endif
+# ifdef LED_DRIVER_ADDR_3
+ IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_3, 2);
+# endif
+# ifdef LED_DRIVER_ADDR_4
+ IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_4, 3);
+# endif
+# endif
+}
+
+const led_matrix_driver_t led_matrix_driver = {
+ .init = init,
+ .flush = flush,
+# ifdef IS31FL3731
+ .set_value = IS31FL3731_set_value,
+ .set_value_all = IS31FL3731_set_value_all,
+# else
+ .set_value = IS31FL3733_set_value,
+ .set_value_all = IS31FL3733_set_value_all,
+# endif
+};
+
+#endif
diff --git a/quantum/led_matrix/led_matrix_types.h b/quantum/led_matrix/led_matrix_types.h
new file mode 100644
index 0000000000..61cdbd9b8e
--- /dev/null
+++ b/quantum/led_matrix/led_matrix_types.h
@@ -0,0 +1,97 @@
+/* Copyright 2021
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+
+#include
+#include
+
+#if defined(__GNUC__)
+# define PACKED __attribute__((__packed__))
+#else
+# define PACKED
+#endif
+
+#if defined(_MSC_VER)
+# pragma pack(push, 1)
+#endif
+
+#if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES)
+# define LED_MATRIX_KEYREACTIVE_ENABLED
+#endif
+
+// Last led hit
+#ifndef LED_HITS_TO_REMEMBER
+# define LED_HITS_TO_REMEMBER 8
+#endif // LED_HITS_TO_REMEMBER
+
+#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
+typedef struct PACKED {
+ uint8_t count;
+ uint8_t x[LED_HITS_TO_REMEMBER];
+ uint8_t y[LED_HITS_TO_REMEMBER];
+ uint8_t index[LED_HITS_TO_REMEMBER];
+ uint16_t tick[LED_HITS_TO_REMEMBER];
+} last_hit_t;
+#endif // LED_MATRIX_KEYREACTIVE_ENABLED
+
+typedef enum led_task_states { STARTING, RENDERING, FLUSHING, SYNCING } led_task_states;
+
+typedef uint8_t led_flags_t;
+
+typedef struct PACKED {
+ uint8_t iter;
+ led_flags_t flags;
+ bool init;
+} effect_params_t;
+
+typedef struct PACKED {
+ uint8_t x;
+ uint8_t y;
+} led_point_t;
+
+#define HAS_FLAGS(bits, flags) ((bits & flags) == flags)
+#define HAS_ANY_FLAGS(bits, flags) ((bits & flags) != 0x00)
+
+#define LED_FLAG_ALL 0xFF
+#define LED_FLAG_NONE 0x00
+#define LED_FLAG_MODIFIER 0x01
+#define LED_FLAG_KEYLIGHT 0x04
+#define LED_FLAG_INDICATOR 0x08
+
+#define NO_LED 255
+
+typedef struct PACKED {
+ uint8_t matrix_co[MATRIX_ROWS][MATRIX_COLS];
+ led_point_t point[DRIVER_LED_TOTAL];
+ uint8_t flags[DRIVER_LED_TOTAL];
+} led_config_t;
+
+typedef union {
+ uint32_t raw;
+ struct PACKED {
+ uint8_t enable : 2;
+ uint8_t mode : 6;
+ uint16_t reserved;
+ uint8_t val;
+ uint8_t speed; // EECONFIG needs to be increased to support this
+ led_flags_t flags;
+ };
+} led_eeconfig_t;
+
+#if defined(_MSC_VER)
+# pragma pack(pop)
+#endif
--
cgit v1.2.3
From 10d7eca5af736228fcd1de834eb0d922bec3c8b0 Mon Sep 17 00:00:00 2001
From: Johannes Choo
Date: Sat, 17 Jul 2021 00:37:18 +0800
Subject: Fix LED Hit Counter for LED/RGB Matrix (#12674)
---
quantum/led_matrix/led_matrix.c | 2 +-
quantum/rgb_matrix/rgb_matrix.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
(limited to 'quantum/led_matrix')
diff --git a/quantum/led_matrix/led_matrix.c b/quantum/led_matrix/led_matrix.c
index 32788866c5..fe7f1f0394 100644
--- a/quantum/led_matrix/led_matrix.c
+++ b/quantum/led_matrix/led_matrix.c
@@ -219,7 +219,7 @@ void process_led_matrix(uint8_t row, uint8_t col, bool pressed) {
memcpy(&last_hit_buffer.y[0], &last_hit_buffer.y[led_count], LED_HITS_TO_REMEMBER - led_count);
memcpy(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit
memcpy(&last_hit_buffer.index[0], &last_hit_buffer.index[led_count], LED_HITS_TO_REMEMBER - led_count);
- last_hit_buffer.count--;
+ last_hit_buffer.count = LED_HITS_TO_REMEMBER - led_count;
}
for (uint8_t i = 0; i < led_count; i++) {
diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c
index 789cd28605..624e851581 100644
--- a/quantum/rgb_matrix/rgb_matrix.c
+++ b/quantum/rgb_matrix/rgb_matrix.c
@@ -230,7 +230,7 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) {
memcpy(&last_hit_buffer.y[0], &last_hit_buffer.y[led_count], LED_HITS_TO_REMEMBER - led_count);
memcpy(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit
memcpy(&last_hit_buffer.index[0], &last_hit_buffer.index[led_count], LED_HITS_TO_REMEMBER - led_count);
- last_hit_buffer.count--;
+ last_hit_buffer.count = LED_HITS_TO_REMEMBER - led_count;
}
for (uint8_t i = 0; i < led_count; i++) {
--
cgit v1.2.3
From 1414e9736d441f4cefbdd2f88157419066f96f71 Mon Sep 17 00:00:00 2001
From: Joakim Tufvegren
Date: Tue, 20 Jul 2021 03:54:32 +0200
Subject: Switch Ergodox Infinity over to split_common (#13481)
---
keyboards/ergodox_infinity/config.h | 19 ++-
keyboards/ergodox_infinity/ergodox_infinity.c | 126 +++----------------
keyboards/ergodox_infinity/led.c | 26 ----
keyboards/ergodox_infinity/matrix.c | 172 --------------------------
keyboards/ergodox_infinity/rules.mk | 11 +-
keyboards/ergodox_infinity/visualizer.c | 3 +-
quantum/led_matrix/led_matrix.c | 2 +-
7 files changed, 36 insertions(+), 323 deletions(-)
delete mode 100644 keyboards/ergodox_infinity/led.c
delete mode 100644 keyboards/ergodox_infinity/matrix.c
(limited to 'quantum/led_matrix')
diff --git a/keyboards/ergodox_infinity/config.h b/keyboards/ergodox_infinity/config.h
index 275d4e1dcf..e0208ba4d3 100644
--- a/keyboards/ergodox_infinity/config.h
+++ b/keyboards/ergodox_infinity/config.h
@@ -54,7 +54,20 @@ along with this program. If not, see .
/* key matrix size */
#define MATRIX_ROWS 18
#define MATRIX_COLS 5
-#define LOCAL_MATRIX_ROWS 9
+
+// For some reason, the rows are colums in the schematic, and vice versa
+#define MATRIX_ROW_PINS { B2, B3, B18, B19, C0, C9, C10, C11, D0 }
+#define MATRIX_COL_PINS { D1, D4, D5, D6, D7 }
+#define UNUSED_PINS
+
+/* COL2ROW, ROW2COL */
+#define DIODE_DIRECTION ROW2COL
+
+/* Serial config (for communication between halves) */
+#define SERIAL_USART_DRIVER SD1 // Only true for the master half
+#define SERIAL_USART_CONFIG { (SERIAL_USART_SPEED), } // Only field is speed
+#define SERIAL_USART_FULL_DUPLEX
+#define SERIAL_USART_TIMEOUT 50
/* number of backlight levels */
#define BACKLIGHT_LEVELS 3
@@ -103,10 +116,8 @@ along with this program. If not, see .
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
-#define SERIAL_LINK_BAUD 562500
-#define SERIAL_LINK_THREAD_PRIORITY (NORMALPRIO - 1)
-
#define VISUALIZER_USER_DATA_SIZE 16
+
/*
* Feature disable options
* These options are also useful to firmware size reduction.
diff --git a/keyboards/ergodox_infinity/ergodox_infinity.c b/keyboards/ergodox_infinity/ergodox_infinity.c
index b802bf014e..76cbca07f8 100644
--- a/keyboards/ergodox_infinity/ergodox_infinity.c
+++ b/keyboards/ergodox_infinity/ergodox_infinity.c
@@ -8,47 +8,6 @@
# include "lcd_backlight.h"
#endif
-#if (defined(LED_MATRIX_ENABLE) || defined(WPM_ENABLE))
-# include "serial_link/protocol/transport.h"
-
-# ifdef LED_MATRIX_ENABLE
-MASTER_TO_ALL_SLAVES_OBJECT(led_matrix, led_eeconfig_t);
-MASTER_TO_ALL_SLAVES_OBJECT(led_suspend_state, bool);
-static led_eeconfig_t last_sent_led_matrix;
-static uint16_t led_matrix_sent_timer = 0;
-
-void send_led_suspend_state(void) {
- if (is_serial_link_master()) {
- *begin_write_led_suspend_state() = led_matrix_get_suspend_state();
- end_write_led_suspend_state();
- }
-}
-# endif
-
-# ifdef WPM_ENABLE
-# include "wpm.h"
-MASTER_TO_ALL_SLAVES_OBJECT(current_wpm, uint8_t);
-static uint8_t last_sent_wpm = 0;
-# endif
-
-static remote_object_t *remote_objects[] = {
-# ifdef LED_MATRIX_ENABLE
- REMOTE_OBJECT(led_matrix),
- REMOTE_OBJECT(led_suspend_state),
-# endif
-# ifdef WPM_ENABLE
- REMOTE_OBJECT(current_wpm),
-# endif
-};
-#endif
-
-void init_serial_link_hal(void) {
- PORTA->PCR[1] = PORTx_PCRn_PE | PORTx_PCRn_PS | PORTx_PCRn_PFE | PORTx_PCRn_MUX(2);
- PORTA->PCR[2] = PORTx_PCRn_DSE | PORTx_PCRn_SRE | PORTx_PCRn_MUX(2);
- PORTE->PCR[0] = PORTx_PCRn_PE | PORTx_PCRn_PS | PORTx_PCRn_PFE | PORTx_PCRn_MUX(3);
- PORTE->PCR[1] = PORTx_PCRn_DSE | PORTx_PCRn_SRE | PORTx_PCRn_MUX(3);
-}
-
#define RED_PIN 1
#define GREEN_PIN 2
#define BLUE_PIN 3
@@ -176,70 +135,15 @@ void matrix_init_kb(void) {
#endif
matrix_init_user();
-#if (defined(LED_MATRIX_ENABLE) || defined(WPM_ENABLE))
- add_remote_objects(remote_objects, sizeof(remote_objects) / sizeof(remote_object_t *));
-#endif
}
void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)
-#ifdef LED_MATRIX_ENABLE
- if (is_serial_link_master()) {
- if (!led_matrix_get_suspend_state()) {
- if (timer_elapsed(led_matrix_sent_timer) >= 5000 || memcmp((void *)&last_sent_led_matrix, (void *)&led_matrix_eeconfig, sizeof(last_sent_led_matrix))) {
- led_matrix_sent_timer = timer_read();
- memcpy((void *)&last_sent_led_matrix, (void *)&led_matrix_eeconfig, sizeof(last_sent_led_matrix));
- *begin_write_led_matrix() = last_sent_led_matrix;
- end_write_led_matrix();
- }
- }
- } else if (is_serial_link_connected()) {
- bool *new_led_suspend_state = read_led_suspend_state();
- if (new_led_suspend_state) {
- led_matrix_set_suspend_state(*new_led_suspend_state);
- }
- if (!led_matrix_get_suspend_state()) {
- led_eeconfig_t *new_led_matrix = read_led_matrix();
- if (new_led_matrix) {
- memcpy((void *)&led_matrix_eeconfig, (void *)new_led_matrix, sizeof(last_sent_led_matrix));
- }
- }
- }
-#endif
-
-#ifdef WPM_ENABLE
- if (is_serial_link_master()) {
- uint8_t current_wpm = get_current_wpm();
- if (current_wpm != last_sent_wpm) {
- *begin_write_current_wpm() = current_wpm;
- end_write_current_wpm();
- last_sent_wpm = current_wpm;
- }
- } else if (is_serial_link_connected()) {
- uint8_t *new_wpm = read_current_wpm();
- if (new_wpm) {
- set_current_wpm(*new_wpm);
- }
- }
-#endif
-
matrix_scan_user();
}
-bool is_keyboard_master(void) { return is_serial_link_master(); }
-
-bool is_keyboard_left(void) {
-#if defined(EE_HANDS)
- return eeconfig_read_handedness();
-#elif defined(MASTER_IS_ON_RIGHT)
- return !is_keyboard_master();
-#else
- return is_keyboard_master();
-#endif
-}
-
__attribute__ ((weak)) void ergodox_board_led_on(void) {}
__attribute__ ((weak)) void ergodox_right_led_1_on(void) {}
@@ -262,20 +166,6 @@ __attribute__ ((weak)) void ergodox_right_led_2_set(uint8_t n) {}
__attribute__ ((weak)) void ergodox_right_led_3_set(uint8_t n) {}
-void suspend_power_down_kb(void) {
-#ifdef LED_MATRIX_ENABLE
- send_led_suspend_state();
-#endif
- suspend_power_down_user();
-}
-
-void suspend_wakeup_init_kb(void) {
-#ifdef LED_MATRIX_ENABLE
- send_led_suspend_state();
-#endif
- suspend_wakeup_init_user();
-}
-
#ifdef SWAP_HANDS_ENABLE
__attribute__ ((weak))
const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
@@ -472,3 +362,19 @@ __attribute__((weak)) void st7565_task_user(void) {
}
}
#endif
+
+#if defined(SPLIT_KEYBOARD)
+void usart_master_init(SerialDriver **driver) {
+ PORTA->PCR[1] = PORTx_PCRn_PE | PORTx_PCRn_PS | PORTx_PCRn_PFE | PORTx_PCRn_MUX(2);
+ PORTA->PCR[2] = PORTx_PCRn_DSE | PORTx_PCRn_SRE | PORTx_PCRn_MUX(2);
+
+ // driver is set to SD1 in config.h
+}
+
+void usart_slave_init(SerialDriver **driver) {
+ PORTE->PCR[0] = PORTx_PCRn_PE | PORTx_PCRn_PS | PORTx_PCRn_PFE | PORTx_PCRn_MUX(3);
+ PORTE->PCR[1] = PORTx_PCRn_DSE | PORTx_PCRn_SRE | PORTx_PCRn_MUX(3);
+
+ *driver = &SD2;
+}
+#endif
diff --git a/keyboards/ergodox_infinity/led.c b/keyboards/ergodox_infinity/led.c
deleted file mode 100644
index 0b50247d7a..0000000000
--- a/keyboards/ergodox_infinity/led.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-Copyright 2012 Jun Wako
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-*/
-
-#include
-
-#include "led.h"
-
-
-void led_set(uint8_t usb_led) {
- //TODO: Add led emulation if there's no customized visualization
- (void)usb_led;
-}
diff --git a/keyboards/ergodox_infinity/matrix.c b/keyboards/ergodox_infinity/matrix.c
deleted file mode 100644
index 0fca56a979..0000000000
--- a/keyboards/ergodox_infinity/matrix.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
-Copyright 2016 Fred Sundvik
-Jun Wako
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-*/
-#include
-#include
-#include
-#include
-#include "timer.h"
-#include "wait.h"
-#include "print.h"
-#include "debug.h"
-#include "matrix.h"
-#include "keyboard.h"
-#include "serial_link/system/serial_link.h"
-
-
-/*
- * Infinity ErgoDox Pinusage:
- * Column pins are input with internal pull-down. Row pins are output and strobe with high.
- * Key is high or 1 when it turns on.
- *
- * col: { PTD1, PTD4, PTD5, PTD6, PTD7 }
- * row: { PTB2, PTB3, PTB18, PTB19, PTC0, PTC9, PTC10, PTC11, PTD0 }
- */
-/* matrix state(1:on, 0:off) */
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[LOCAL_MATRIX_ROWS];
-static bool debouncing = false;
-static uint16_t debouncing_time = 0;
-
-
-void matrix_init(void)
-{
- /* Row(sense) */
- palSetPadMode(GPIOD, 1, PAL_MODE_INPUT_PULLDOWN);
- palSetPadMode(GPIOD, 4, PAL_MODE_INPUT_PULLDOWN);
- palSetPadMode(GPIOD, 5, PAL_MODE_INPUT_PULLDOWN);
- palSetPadMode(GPIOD, 6, PAL_MODE_INPUT_PULLDOWN);
- palSetPadMode(GPIOD, 7, PAL_MODE_INPUT_PULLDOWN);
-
- /* Column(strobe) */
- palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL);
- palSetPadMode(GPIOB, 3, PAL_MODE_OUTPUT_PUSHPULL);
- palSetPadMode(GPIOB, 18, PAL_MODE_OUTPUT_PUSHPULL);
- palSetPadMode(GPIOB, 19, PAL_MODE_OUTPUT_PUSHPULL);
- palSetPadMode(GPIOC, 0, PAL_MODE_OUTPUT_PUSHPULL);
- palSetPadMode(GPIOC, 9, PAL_MODE_OUTPUT_PUSHPULL);
- palSetPadMode(GPIOC, 10, PAL_MODE_OUTPUT_PUSHPULL);
- palSetPadMode(GPIOC, 11, PAL_MODE_OUTPUT_PUSHPULL);
- palSetPadMode(GPIOD, 0, PAL_MODE_OUTPUT_PUSHPULL);
-
- memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
- memset(matrix_debouncing, 0, LOCAL_MATRIX_ROWS * sizeof(matrix_row_t));
-
- matrix_init_quantum();
-}
-
-uint8_t matrix_scan(void)
-{
- for (int row = 0; row < LOCAL_MATRIX_ROWS; row++) {
- matrix_row_t data = 0;
-
- // strobe row
- switch (row) {
- case 0: palSetPad(GPIOB, 2); break;
- case 1: palSetPad(GPIOB, 3); break;
- case 2: palSetPad(GPIOB, 18); break;
- case 3: palSetPad(GPIOB, 19); break;
- case 4: palSetPad(GPIOC, 0); break;
- case 5: palSetPad(GPIOC, 9); break;
- case 6: palSetPad(GPIOC, 10); break;
- case 7: palSetPad(GPIOC, 11); break;
- case 8: palSetPad(GPIOD, 0); break;
- }
-
- // need wait to settle pin state
- // if you wait too short, or have a too high update rate
- // the keyboard might freeze, or there might not be enough
- // processing power to update the LCD screen properly.
- // 20us, or two ticks at 100000Hz seems to be OK
- wait_us(20);
-
- // read col data: { PTD1, PTD4, PTD5, PTD6, PTD7 }
- data = ((palReadPort(GPIOD) & 0xF0) >> 3) |
- ((palReadPort(GPIOD) & 0x02) >> 1);
-
- // un-strobe row
- switch (row) {
- case 0: palClearPad(GPIOB, 2); break;
- case 1: palClearPad(GPIOB, 3); break;
- case 2: palClearPad(GPIOB, 18); break;
- case 3: palClearPad(GPIOB, 19); break;
- case 4: palClearPad(GPIOC, 0); break;
- case 5: palClearPad(GPIOC, 9); break;
- case 6: palClearPad(GPIOC, 10); break;
- case 7: palClearPad(GPIOC, 11); break;
- case 8: palClearPad(GPIOD, 0); break;
- }
-
- if (matrix_debouncing[row] != data) {
- matrix_debouncing[row] = data;
- debouncing = true;
- debouncing_time = timer_read();
- }
- }
-
- uint8_t offset = 0;
- if (is_serial_link_master() && !is_keyboard_left()) {
- offset = MATRIX_ROWS - LOCAL_MATRIX_ROWS;
- }
-
- if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
- for (int row = 0; row < LOCAL_MATRIX_ROWS; row++) {
- matrix[offset + row] = matrix_debouncing[row];
- }
- debouncing = false;
- }
- matrix_scan_quantum();
- return 1;
-}
-
-bool matrix_is_on(uint8_t row, uint8_t col)
-{
- return (matrix[row] & (1<.
#include "visualizer_keyframes.h"
#include "lcd_keyframes.h"
#include "lcd_backlight_keyframes.h"
-#include "system/serial_link.h"
#include "default_animations.h"
static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF);
@@ -177,7 +176,7 @@ static void update_emulated_leds(visualizer_state_t* state, visualizer_keyboard_
uint8_t new_index;
uint8_t old_index;
- if (is_serial_link_master()) {
+ if (is_keyboard_master()) {
new_index = get_led_index_master(user_data_new);
old_index = get_led_index_master(user_data_old);
}
diff --git a/quantum/led_matrix/led_matrix.c b/quantum/led_matrix/led_matrix.c
index fe7f1f0394..bcf258b260 100644
--- a/quantum/led_matrix/led_matrix.c
+++ b/quantum/led_matrix/led_matrix.c
@@ -459,7 +459,7 @@ void led_matrix_init(void) {
void led_matrix_set_suspend_state(bool state) {
#ifdef LED_DISABLE_WHEN_USB_SUSPENDED
- if (state) {
+ if (state && is_keyboard_master()) {
led_matrix_set_value_all(0); // turn off all LEDs when suspending
}
suspend_state = state;
--
cgit v1.2.3
From 7da97c293da851851c204af065a0c8d2f884effd Mon Sep 17 00:00:00 2001
From: Drashna Jaelre
Date: Tue, 17 Aug 2021 11:19:00 -0700
Subject: Rgb matrix/enable modes explicitly (#13758)
* Change animations to require explicet activation
* Add support for legacy config
* Make default for now
* Add LED Matrix support
* change LED Matrix docs---
docs/feature_led_matrix.md | 40 +++---
docs/feature_rgb_matrix.md | 80 +++++------
quantum/led_matrix/animations/alpha_mods_anim.h | 2 +-
quantum/led_matrix/animations/band_anim.h | 2 +-
quantum/led_matrix/animations/band_pinwheel_anim.h | 2 +-
quantum/led_matrix/animations/band_spiral_anim.h | 2 +-
quantum/led_matrix/animations/breathing_anim.h | 2 +-
.../led_matrix/animations/cycle_left_right_anim.h | 2 +-
quantum/led_matrix/animations/cycle_out_in_anim.h | 2 +-
quantum/led_matrix/animations/cycle_up_down_anim.h | 2 +-
quantum/led_matrix/animations/dual_beacon_anim.h | 2 +-
.../led_matrix/animations/solid_reactive_cross.h | 8 +-
.../led_matrix/animations/solid_reactive_nexus.h | 10 +-
.../animations/solid_reactive_simple_anim.h | 2 +-
.../led_matrix/animations/solid_reactive_wide.h | 8 +-
quantum/led_matrix/animations/solid_splash_anim.h | 8 +-
.../led_matrix/animations/wave_left_right_anim.h | 2 +-
quantum/led_matrix/animations/wave_up_down_anim.h | 2 +-
quantum/led_matrix/led_matrix.h | 1 +
quantum/led_matrix/led_matrix_legacy_enables.h | 82 +++++++++++
quantum/process_keycode/process_rgb.c | 6 +-
quantum/rgb_matrix/animations/alpha_mods_anim.h | 2 +-
quantum/rgb_matrix/animations/breathing_anim.h | 2 +-
.../animations/colorband_pinwheel_sat_anim.h | 2 +-
.../animations/colorband_pinwheel_val_anim.h | 2 +-
quantum/rgb_matrix/animations/colorband_sat_anim.h | 2 +-
.../animations/colorband_spiral_sat_anim.h | 2 +-
.../animations/colorband_spiral_val_anim.h | 2 +-
quantum/rgb_matrix/animations/colorband_val_anim.h | 2 +-
quantum/rgb_matrix/animations/cycle_all_anim.h | 2 +-
.../rgb_matrix/animations/cycle_left_right_anim.h | 2 +-
quantum/rgb_matrix/animations/cycle_out_in_anim.h | 2 +-
.../rgb_matrix/animations/cycle_out_in_dual_anim.h | 2 +-
.../rgb_matrix/animations/cycle_pinwheel_anim.h | 2 +-
quantum/rgb_matrix/animations/cycle_spiral_anim.h | 2 +-
quantum/rgb_matrix/animations/cycle_up_down_anim.h | 2 +-
quantum/rgb_matrix/animations/dual_beacon_anim.h | 2 +-
.../animations/gradient_left_right_anim.h | 2 +-
.../rgb_matrix/animations/gradient_up_down_anim.h | 2 +-
quantum/rgb_matrix/animations/hue_breathing_anim.h | 2 +-
quantum/rgb_matrix/animations/hue_pendulum_anim.h | 2 +-
quantum/rgb_matrix/animations/hue_wave_anim.h | 2 +-
.../animations/jellybean_raindrops_anim.h | 2 +-
.../rgb_matrix/animations/rainbow_beacon_anim.h | 2 +-
.../animations/rainbow_moving_chevron_anim.h | 2 +-
.../rgb_matrix/animations/rainbow_pinwheels_anim.h | 2 +-
quantum/rgb_matrix/animations/raindrops_anim.h | 2 +-
.../rgb_matrix/animations/typing_heatmap_anim.h | 2 +-
quantum/rgb_matrix/rgb_matrix.c | 6 +-
quantum/rgb_matrix/rgb_matrix.h | 1 +
quantum/rgb_matrix/rgb_matrix_legacy_enables.h | 153 +++++++++++++++++++++
51 files changed, 359 insertions(+), 122 deletions(-)
create mode 100644 quantum/led_matrix/led_matrix_legacy_enables.h
create mode 100644 quantum/rgb_matrix/rgb_matrix_legacy_enables.h
(limited to 'quantum/led_matrix')
diff --git a/docs/feature_led_matrix.md b/docs/feature_led_matrix.md
index 7d7971bbed..fc66826015 100644
--- a/docs/feature_led_matrix.md
+++ b/docs/feature_led_matrix.md
@@ -164,26 +164,26 @@ You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `con
|Define |Description |
|-------------------------------------------------------|-----------------------------------------------|
-|`#define DISABLE_LED_MATRIX_ALPHAS_MODS` |Disables `LED_MATRIX_ALPHAS_MODS` |
-|`#define DISABLE_LED_MATRIX_BREATHING` |Disables `LED_MATRIX_BREATHING` |
-|`#define DISABLE_LED_MATRIX_BAND` |Disables `LED_MATRIX_BAND` |
-|`#define DISABLE_LED_MATRIX_BAND_PINWHEEL` |Disables `LED_MATRIX_BAND_PINWHEEL` |
-|`#define DISABLE_LED_MATRIX_BAND_SPIRAL` |Disables `LED_MATRIX_BAND_SPIRAL` |
-|`#define DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT` |Disables `LED_MATRIX_CYCLE_LEFT_RIGHT` |
-|`#define DISABLE_LED_MATRIX_CYCLE_UP_DOWN` |Disables `LED_MATRIX_CYCLE_UP_DOWN` |
-|`#define DISABLE_LED_MATRIX_CYCLE_OUT_IN` |Disables `LED_MATRIX_CYCLE_OUT_IN` |
-|`#define DISABLE_LED_MATRIX_DUAL_BEACON` |Disables `LED_MATRIX_DUAL_BEACON` |
-|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE` |Disables `LED_MATRIX_SOLID_REACTIVE_SIMPLE` |
-|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE` |Disables `LED_MATRIX_SOLID_REACTIVE_WIDE` |
-|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE` |Disables `LED_MATRIX_SOLID_REACTIVE_MULTIWIDE` |
-|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS` |Disables `LED_MATRIX_SOLID_REACTIVE_CROSS` |
-|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS` |Disables `LED_MATRIX_SOLID_REACTIVE_MULTICROSS`|
-|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS` |Disables `LED_MATRIX_SOLID_REACTIVE_NEXUS` |
-|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS` |Disables `LED_MATRIX_SOLID_REACTIVE_MULTINEXUS`|
-|`#define DISABLE_LED_MATRIX_SOLID_SPLASH` |Disables `LED_MATRIX_SOLID_SPLASH` |
-|`#define DISABLE_LED_MATRIX_SOLID_MULTISPLASH` |Disables `LED_MATRIX_SOLID_MULTISPLASH` |
-|`#define DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT` |Disables `LED_MATRIX_WAVE_LEFT_RIGHT` |
-|`#define DISABLE_LED_MATRIX_WAVE_UP_DOWN` |Disables `LED_MATRIX_WAVE_UP_DOWN` |
+|`#define ENABLE_LED_MATRIX_ALPHAS_MODS` |Enables `LED_MATRIX_ALPHAS_MODS` |
+|`#define ENABLE_LED_MATRIX_BREATHING` |Enables `LED_MATRIX_BREATHING` |
+|`#define ENABLE_LED_MATRIX_BAND` |Enables `LED_MATRIX_BAND` |
+|`#define ENABLE_LED_MATRIX_BAND_PINWHEEL` |Enables `LED_MATRIX_BAND_PINWHEEL` |
+|`#define ENABLE_LED_MATRIX_BAND_SPIRAL` |Enables `LED_MATRIX_BAND_SPIRAL` |
+|`#define ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT` |Enables `LED_MATRIX_CYCLE_LEFT_RIGHT` |
+|`#define ENABLE_LED_MATRIX_CYCLE_UP_DOWN` |Enables `LED_MATRIX_CYCLE_UP_DOWN` |
+|`#define ENABLE_LED_MATRIX_CYCLE_OUT_IN` |Enables `LED_MATRIX_CYCLE_OUT_IN` |
+|`#define ENABLE_LED_MATRIX_DUAL_BEACON` |Enables `LED_MATRIX_DUAL_BEACON` |
+|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE` |Enables `LED_MATRIX_SOLID_REACTIVE_SIMPLE` |
+|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE` |Enables `LED_MATRIX_SOLID_REACTIVE_WIDE` |
+|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE` |Enables `LED_MATRIX_SOLID_REACTIVE_MULTIWIDE` |
+|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS` |Enables `LED_MATRIX_SOLID_REACTIVE_CROSS` |
+|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS` |Enables `LED_MATRIX_SOLID_REACTIVE_MULTICROSS`|
+|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS` |Enables `LED_MATRIX_SOLID_REACTIVE_NEXUS` |
+|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS` |Enables `LED_MATRIX_SOLID_REACTIVE_MULTINEXUS`|
+|`#define ENABLE_LED_MATRIX_SOLID_SPLASH` |Enables `LED_MATRIX_SOLID_SPLASH` |
+|`#define ENABLE_LED_MATRIX_SOLID_MULTISPLASH` |Enables `LED_MATRIX_SOLID_MULTISPLASH` |
+|`#define ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT` |Enables `LED_MATRIX_WAVE_LEFT_RIGHT` |
+|`#define ENABLE_LED_MATRIX_WAVE_UP_DOWN` |Enables `LED_MATRIX_WAVE_UP_DOWN` |
## Custom LED Matrix Effects :id=custom-led-matrix-effects
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 670d7e09bf..31fa9ed36e 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -448,46 +448,46 @@ You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `con
|Define |Description |
|-------------------------------------------------------|-----------------------------------------------|
-|`#define DISABLE_RGB_MATRIX_ALPHAS_MODS` |Disables `RGB_MATRIX_ALPHAS_MODS` |
-|`#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN` |Disables `RGB_MATRIX_GRADIENT_UP_DOWN` |
-|`#define DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT` |Disables `MATRIX_GRADIENT_LEFT_RIGHT` |
-|`#define DISABLE_RGB_MATRIX_BREATHING` |Disables `RGB_MATRIX_BREATHING` |
-|`#define DISABLE_RGB_MATRIX_BAND_SAT` |Disables `RGB_MATRIX_BAND_SAT` |
-|`#define DISABLE_RGB_MATRIX_BAND_VAL` |Disables `RGB_MATRIX_BAND_VAL` |
-|`#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT` |Disables `RGB_MATRIX_BAND_PINWHEEL_SAT` |
-|`#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL` |Disables `RGB_MATRIX_BAND_PINWHEEL_VAL` |
-|`#define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT` |Disables `RGB_MATRIX_BAND_SPIRAL_SAT` |
-|`#define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL` |Disables `RGB_MATRIX_BAND_SPIRAL_VAL` |
-|`#define DISABLE_RGB_MATRIX_CYCLE_ALL` |Disables `RGB_MATRIX_CYCLE_ALL` |
-|`#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT` |Disables `RGB_MATRIX_CYCLE_LEFT_RIGHT` |
-|`#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN` |Disables `RGB_MATRIX_CYCLE_UP_DOWN` |
-|`#define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON` |Disables `RGB_MATRIX_RAINBOW_MOVING_CHEVRON` |
-|`#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN` |Disables `RGB_MATRIX_CYCLE_OUT_IN` |
-|`#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL` |Disables `RGB_MATRIX_CYCLE_OUT_IN_DUAL` |
-|`#define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL` |Disables `RGB_MATRIX_CYCLE_PINWHEEL` |
-|`#define DISABLE_RGB_MATRIX_CYCLE_SPIRAL` |Disables `RGB_MATRIX_CYCLE_SPIRAL` |
-|`#define DISABLE_RGB_MATRIX_DUAL_BEACON` |Disables `RGB_MATRIX_DUAL_BEACON` |
-|`#define DISABLE_RGB_MATRIX_RAINBOW_BEACON` |Disables `RGB_MATRIX_RAINBOW_BEACON` |
-|`#define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS` |Disables `RGB_MATRIX_RAINBOW_PINWHEELS` |
-|`#define DISABLE_RGB_MATRIX_RAINDROPS` |Disables `RGB_MATRIX_RAINDROPS` |
-|`#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS` |Disables `RGB_MATRIX_JELLYBEAN_RAINDROPS` |
-|`#define DISABLE_RGB_MATRIX_HUE_BREATHING` |Disables `RGB_MATRIX_HUE_BREATHING` |
-|`#define DISABLE_RGB_MATRIX_HUE_PENDULUM` |Disables `RGB_MATRIX_HUE_PENDULUM` |
-|`#define DISABLE_RGB_MATRIX_HUE_WAVE ` |Disables `RGB_MATRIX_HUE_WAVE ` |
-|`#define DISABLE_RGB_MATRIX_TYPING_HEATMAP` |Disables `RGB_MATRIX_TYPING_HEATMAP` |
-|`#define DISABLE_RGB_MATRIX_DIGITAL_RAIN` |Disables `RGB_MATRIX_DIGITAL_RAIN` |
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE` |Disables `RGB_MATRIX_SOLID_REACTIVE_SIMPLE` |
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE` |Disables `RGB_MATRIX_SOLID_REACTIVE` |
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE` |Disables `RGB_MATRIX_SOLID_REACTIVE_WIDE` |
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE` |Disables `RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE` |
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS` |Disables `RGB_MATRIX_SOLID_REACTIVE_CROSS` |
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS` |Disables `RGB_MATRIX_SOLID_REACTIVE_MULTICROSS`|
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS` |Disables `RGB_MATRIX_SOLID_REACTIVE_NEXUS` |
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS` |Disables `RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS`|
-|`#define DISABLE_RGB_MATRIX_SPLASH` |Disables `RGB_MATRIX_SPLASH` |
-|`#define DISABLE_RGB_MATRIX_MULTISPLASH` |Disables `RGB_MATRIX_MULTISPLASH` |
-|`#define DISABLE_RGB_MATRIX_SOLID_SPLASH` |Disables `RGB_MATRIX_SOLID_SPLASH` |
-|`#define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH` |Disables `RGB_MATRIX_SOLID_MULTISPLASH` |
+|`#define ENABLE_RGB_MATRIX_ALPHAS_MODS` |Enables `RGB_MATRIX_ALPHAS_MODS` |
+|`#define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN` |Enables `RGB_MATRIX_GRADIENT_UP_DOWN` |
+|`#define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT` |Enables `MATRIX_GRADIENT_LEFT_RIGHT` |
+|`#define ENABLE_RGB_MATRIX_BREATHING` |Enables `RGB_MATRIX_BREATHING` |
+|`#define ENABLE_RGB_MATRIX_BAND_SAT` |Enables `RGB_MATRIX_BAND_SAT` |
+|`#define ENABLE_RGB_MATRIX_BAND_VAL` |Enables `RGB_MATRIX_BAND_VAL` |
+|`#define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT` |Enables `RGB_MATRIX_BAND_PINWHEEL_SAT` |
+|`#define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL` |Enables `RGB_MATRIX_BAND_PINWHEEL_VAL` |
+|`#define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT` |Enables `RGB_MATRIX_BAND_SPIRAL_SAT` |
+|`#define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL` |Enables `RGB_MATRIX_BAND_SPIRAL_VAL` |
+|`#define ENABLE_RGB_MATRIX_CYCLE_ALL` |Enables `RGB_MATRIX_CYCLE_ALL` |
+|`#define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT` |Enables `RGB_MATRIX_CYCLE_LEFT_RIGHT` |
+|`#define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN` |Enables `RGB_MATRIX_CYCLE_UP_DOWN` |
+|`#define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON` |Enables `RGB_MATRIX_RAINBOW_MOVING_CHEVRON` |
+|`#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN` |Enables `RGB_MATRIX_CYCLE_OUT_IN` |
+|`#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL` |Enables `RGB_MATRIX_CYCLE_OUT_IN_DUAL` |
+|`#define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL` |Enables `RGB_MATRIX_CYCLE_PINWHEEL` |
+|`#define ENABLE_RGB_MATRIX_CYCLE_SPIRAL` |Enables `RGB_MATRIX_CYCLE_SPIRAL` |
+|`#define ENABLE_RGB_MATRIX_DUAL_BEACON` |Enables `RGB_MATRIX_DUAL_BEACON` |
+|`#define ENABLE_RGB_MATRIX_RAINBOW_BEACON` |Enables `RGB_MATRIX_RAINBOW_BEACON` |
+|`#define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS` |Enables `RGB_MATRIX_RAINBOW_PINWHEELS` |
+|`#define ENABLE_RGB_MATRIX_RAINDROPS` |Enables `RGB_MATRIX_RAINDROPS` |
+|`#define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS` |Enables `RGB_MATRIX_JELLYBEAN_RAINDROPS` |
+|`#define ENABLE_RGB_MATRIX_HUE_BREATHING` |Enables `RGB_MATRIX_HUE_BREATHING` |
+|`#define ENABLE_RGB_MATRIX_HUE_PENDULUM` |Enables `RGB_MATRIX_HUE_PENDULUM` |
+|`#define ENABLE_RGB_MATRIX_HUE_WAVE ` |Enables `RGB_MATRIX_HUE_WAVE ` |
+|`#define ENABLE_RGB_MATRIX_TYPING_HEATMAP` |Enables `RGB_MATRIX_TYPING_HEATMAP` |
+|`#define ENABLE_RGB_MATRIX_DIGITAL_RAIN` |Enables `RGB_MATRIX_DIGITAL_RAIN` |
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE` |Enables `RGB_MATRIX_SOLID_REACTIVE_SIMPLE` |
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE` |Enables `RGB_MATRIX_SOLID_REACTIVE` |
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE` |Enables `RGB_MATRIX_SOLID_REACTIVE_WIDE` |
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE` |Enables `RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE` |
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS` |Enables `RGB_MATRIX_SOLID_REACTIVE_CROSS` |
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS` |Enables `RGB_MATRIX_SOLID_REACTIVE_MULTICROSS`|
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS` |Enables `RGB_MATRIX_SOLID_REACTIVE_NEXUS` |
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS` |Enables `RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS`|
+|`#define ENABLE_RGB_MATRIX_SPLASH` |Enables `RGB_MATRIX_SPLASH` |
+|`#define ENABLE_RGB_MATRIX_MULTISPLASH` |Enables `RGB_MATRIX_MULTISPLASH` |
+|`#define ENABLE_RGB_MATRIX_SOLID_SPLASH` |Enables `RGB_MATRIX_SOLID_SPLASH` |
+|`#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH` |Enables `RGB_MATRIX_SOLID_MULTISPLASH` |
### RGB Matrix Effect Typing Heatmap :id=rgb-matrix-effect-typing-heatmap
diff --git a/quantum/led_matrix/animations/alpha_mods_anim.h b/quantum/led_matrix/animations/alpha_mods_anim.h
index a4638fde69..14038cd082 100644
--- a/quantum/led_matrix/animations/alpha_mods_anim.h
+++ b/quantum/led_matrix/animations/alpha_mods_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_ALPHAS_MODS
+#ifdef ENABLE_LED_MATRIX_ALPHAS_MODS
LED_MATRIX_EFFECT(ALPHAS_MODS)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/band_anim.h b/quantum/led_matrix/animations/band_anim.h
index f9cb85dc4f..5548787b88 100644
--- a/quantum/led_matrix/animations/band_anim.h
+++ b/quantum/led_matrix/animations/band_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_BAND
+#ifdef ENABLE_LED_MATRIX_BAND
LED_MATRIX_EFFECT(BAND)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/band_pinwheel_anim.h b/quantum/led_matrix/animations/band_pinwheel_anim.h
index d3144bffbf..89651582d5 100644
--- a/quantum/led_matrix/animations/band_pinwheel_anim.h
+++ b/quantum/led_matrix/animations/band_pinwheel_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_BAND_PINWHEEL
+#ifdef ENABLE_LED_MATRIX_BAND_PINWHEEL
LED_MATRIX_EFFECT(BAND_PINWHEEL)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/band_spiral_anim.h b/quantum/led_matrix/animations/band_spiral_anim.h
index defbe69676..70b0ffaea9 100644
--- a/quantum/led_matrix/animations/band_spiral_anim.h
+++ b/quantum/led_matrix/animations/band_spiral_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_BAND_SPIRAL
+#ifdef ENABLE_LED_MATRIX_BAND_SPIRAL
LED_MATRIX_EFFECT(BAND_SPIRAL)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/breathing_anim.h b/quantum/led_matrix/animations/breathing_anim.h
index 4f49f50690..e3f600c45c 100644
--- a/quantum/led_matrix/animations/breathing_anim.h
+++ b/quantum/led_matrix/animations/breathing_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_BREATHING
+#ifdef ENABLE_LED_MATRIX_BREATHING
LED_MATRIX_EFFECT(BREATHING)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/cycle_left_right_anim.h b/quantum/led_matrix/animations/cycle_left_right_anim.h
index c426d02fd5..769e6d7942 100644
--- a/quantum/led_matrix/animations/cycle_left_right_anim.h
+++ b/quantum/led_matrix/animations/cycle_left_right_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT
+#ifdef ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT
LED_MATRIX_EFFECT(CYCLE_LEFT_RIGHT)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/cycle_out_in_anim.h b/quantum/led_matrix/animations/cycle_out_in_anim.h
index 55527556fd..6adf9c25ff 100644
--- a/quantum/led_matrix/animations/cycle_out_in_anim.h
+++ b/quantum/led_matrix/animations/cycle_out_in_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_CYCLE_OUT_IN
+#ifdef ENABLE_LED_MATRIX_CYCLE_OUT_IN
LED_MATRIX_EFFECT(CYCLE_OUT_IN)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/cycle_up_down_anim.h b/quantum/led_matrix/animations/cycle_up_down_anim.h
index d97de0d1ec..7a5868ac26 100644
--- a/quantum/led_matrix/animations/cycle_up_down_anim.h
+++ b/quantum/led_matrix/animations/cycle_up_down_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_CYCLE_UP_DOWN
+#ifdef ENABLE_LED_MATRIX_CYCLE_UP_DOWN
LED_MATRIX_EFFECT(CYCLE_UP_DOWN)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/dual_beacon_anim.h b/quantum/led_matrix/animations/dual_beacon_anim.h
index e1bc5ae464..3552c9fc39 100644
--- a/quantum/led_matrix/animations/dual_beacon_anim.h
+++ b/quantum/led_matrix/animations/dual_beacon_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_DUAL_BEACON
+#ifdef ENABLE_LED_MATRIX_DUAL_BEACON
LED_MATRIX_EFFECT(DUAL_BEACON)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/solid_reactive_cross.h b/quantum/led_matrix/animations/solid_reactive_cross.h
index 94425c959f..3a3c46be13 100644
--- a/quantum/led_matrix/animations/solid_reactive_cross.h
+++ b/quantum/led_matrix/animations/solid_reactive_cross.h
@@ -1,11 +1,11 @@
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
# if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS)
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
LED_MATRIX_EFFECT(SOLID_REACTIVE_CROSS)
# endif
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS)
# endif
@@ -22,11 +22,11 @@ static uint8_t SOLID_REACTIVE_CROSS_math(uint8_t val, int16_t dx, int16_t dy, ui
return qadd8(val, 255 - effect);
}
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
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
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); }
# endif
diff --git a/quantum/led_matrix/animations/solid_reactive_nexus.h b/quantum/led_matrix/animations/solid_reactive_nexus.h
index 504b1104f1..2520b8e1df 100644
--- a/quantum/led_matrix/animations/solid_reactive_nexus.h
+++ b/quantum/led_matrix/animations/solid_reactive_nexus.h
@@ -1,11 +1,11 @@
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
-# if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS)
+# if defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS)
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
LED_MATRIX_EFFECT(SOLID_REACTIVE_NEXUS)
# endif
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS)
# endif
@@ -19,11 +19,11 @@ static uint8_t SOLID_REACTIVE_NEXUS_math(uint8_t val, int16_t dx, int16_t dy, ui
return qadd8(val, 255 - effect);
}
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
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
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); }
# endif
diff --git a/quantum/led_matrix/animations/solid_reactive_simple_anim.h b/quantum/led_matrix/animations/solid_reactive_simple_anim.h
index 4752a84162..43f6ad9ab4 100644
--- a/quantum/led_matrix/animations/solid_reactive_simple_anim.h
+++ b/quantum/led_matrix/animations/solid_reactive_simple_anim.h
@@ -1,5 +1,5 @@
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE
LED_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/solid_reactive_wide.h b/quantum/led_matrix/animations/solid_reactive_wide.h
index 922e32fe5f..d683b02510 100644
--- a/quantum/led_matrix/animations/solid_reactive_wide.h
+++ b/quantum/led_matrix/animations/solid_reactive_wide.h
@@ -1,11 +1,11 @@
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
# if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE)
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
LED_MATRIX_EFFECT(SOLID_REACTIVE_WIDE)
# endif
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE)
# endif
@@ -17,11 +17,11 @@ static uint8_t SOLID_REACTIVE_WIDE_math(uint8_t val, int16_t dx, int16_t dy, uin
return qadd8(val, 255 - effect);
}
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
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
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); }
# endif
diff --git a/quantum/led_matrix/animations/solid_splash_anim.h b/quantum/led_matrix/animations/solid_splash_anim.h
index d95889b813..cf599c8fe6 100644
--- a/quantum/led_matrix/animations/solid_splash_anim.h
+++ b/quantum/led_matrix/animations/solid_splash_anim.h
@@ -1,11 +1,11 @@
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
# if !defined(DISABLE_LED_MATRIX_SOLID_SPLASH) || !defined(DISABLE_LED_MATRIX_SOLID_MULTISPLASH)
-# ifndef DISABLE_LED_MATRIX_SOLID_SPLASH
+# ifdef ENABLE_LED_MATRIX_SOLID_SPLASH
LED_MATRIX_EFFECT(SOLID_SPLASH)
# endif
-# ifndef DISABLE_LED_MATRIX_SOLID_MULTISPLASH
+# ifdef ENABLE_LED_MATRIX_SOLID_MULTISPLASH
LED_MATRIX_EFFECT(SOLID_MULTISPLASH)
# endif
@@ -17,11 +17,11 @@ uint8_t SOLID_SPLASH_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uin
return qadd8(val, 255 - effect);
}
-# ifndef DISABLE_LED_MATRIX_SOLID_SPLASH
+# ifdef ENABLE_LED_MATRIX_SOLID_SPLASH
bool SOLID_SPLASH(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math); }
# endif
-# ifndef DISABLE_LED_MATRIX_SOLID_MULTISPLASH
+# ifdef ENABLE_LED_MATRIX_SOLID_MULTISPLASH
bool SOLID_MULTISPLASH(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); }
# endif
diff --git a/quantum/led_matrix/animations/wave_left_right_anim.h b/quantum/led_matrix/animations/wave_left_right_anim.h
index 8579f1b45f..c062cf968e 100644
--- a/quantum/led_matrix/animations/wave_left_right_anim.h
+++ b/quantum/led_matrix/animations/wave_left_right_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT
+#ifdef ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT
LED_MATRIX_EFFECT(WAVE_LEFT_RIGHT)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/wave_up_down_anim.h b/quantum/led_matrix/animations/wave_up_down_anim.h
index 635c608414..5e612f6b6d 100644
--- a/quantum/led_matrix/animations/wave_up_down_anim.h
+++ b/quantum/led_matrix/animations/wave_up_down_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_WAVE_UP_DOWN
+#ifdef ENABLE_LED_MATRIX_WAVE_UP_DOWN
LED_MATRIX_EFFECT(WAVE_UP_DOWN)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h
index 6f85854fbe..a7a1c983f7 100644
--- a/quantum/led_matrix/led_matrix.h
+++ b/quantum/led_matrix/led_matrix.h
@@ -23,6 +23,7 @@
#include
#include "led_matrix_types.h"
#include "quantum.h"
+#include "led_matrix_legacy_enables.h"
#ifdef IS31FL3731
# include "is31fl3731-simple.h"
diff --git a/quantum/led_matrix/led_matrix_legacy_enables.h b/quantum/led_matrix/led_matrix_legacy_enables.h
new file mode 100644
index 0000000000..7738d2f34e
--- /dev/null
+++ b/quantum/led_matrix/led_matrix_legacy_enables.h
@@ -0,0 +1,82 @@
+/* Copyright 2021 QMK
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// to-do: remove this
+
+#pragma once
+
+#ifndef DISABLE_LED_MATRIX_ALPHAS_MODS
+# define ENABLE_LED_MATRIX_ALPHAS_MODS
+#endif
+#ifndef DISABLE_LED_MATRIX_BREATHING
+# define ENABLE_LED_MATRIX_BREATHING
+#endif
+#ifndef DISABLE_LED_MATRIX_BAND
+# define ENABLE_LED_MATRIX_BAND
+#endif
+#ifndef DISABLE_LED_MATRIX_BAND_PINWHEEL
+# define ENABLE_LED_MATRIX_BAND_PINWHEEL
+#endif
+#ifndef DISABLE_LED_MATRIX_BAND_SPIRAL
+# define ENABLE_LED_MATRIX_BAND_SPIRAL
+#endif
+#ifndef DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT
+# define ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT
+#endif
+#ifndef DISABLE_LED_MATRIX_CYCLE_UP_DOWN
+# define ENABLE_LED_MATRIX_CYCLE_UP_DOWN
+#endif
+#ifndef DISABLE_LED_MATRIX_CYCLE_OUT_IN
+# define ENABLE_LED_MATRIX_CYCLE_OUT_IN
+#endif
+#ifndef DISABLE_LED_MATRIX_DUAL_BEACON
+# define ENABLE_LED_MATRIX_DUAL_BEACON
+#endif
+#if defined(LED_MATRIX_KEYREACTIVE_ENABLED)
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE
+# define ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE
+# endif
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
+# define ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
+# endif
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
+# define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
+# endif
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
+# define ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
+# endif
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
+# define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
+# endif
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
+# define ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
+# endif
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
+# define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
+# endif
+# ifndef DISABLE_LED_MATRIX_SPLASH
+# define ENABLE_LED_MATRIX_SPLASH
+# endif
+# ifndef DISABLE_LED_MATRIX_MULTISPLASH
+# define ENABLE_LED_MATRIX_MULTISPLASH
+# endif
+#endif
+#ifndef DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT
+# define ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT
+#endif
+#ifndef DISABLE_LED_MATRIX_WAVE_UP_DOWN
+# define ENABLE_LED_MATRIX_WAVE_UP_DOWN
+#endif
diff --git a/quantum/process_keycode/process_rgb.c b/quantum/process_keycode/process_rgb.c
index b9fee1ca59..69853cd5c4 100644
--- a/quantum/process_keycode/process_rgb.c
+++ b/quantum/process_keycode/process_rgb.c
@@ -161,7 +161,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) && defined(RGBLIGHT_EFFECT_BREATHING)
handleKeycodeRGBMode(RGBLIGHT_MODE_BREATHING, RGBLIGHT_MODE_BREATHING_end);
#endif
-#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && !defined(DISABLE_RGB_MATRIX_BREATHING)
+#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && defined(ENABLE_RGB_MATRIX_BREATHING)
rgb_matrix_mode(RGB_MATRIX_BREATHING);
#endif
return false;
@@ -169,7 +169,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) && defined(RGBLIGHT_EFFECT_RAINBOW_MOOD)
handleKeycodeRGBMode(RGBLIGHT_MODE_RAINBOW_MOOD, RGBLIGHT_MODE_RAINBOW_MOOD_end);
#endif
-#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && !defined(DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT)
+#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && defined(ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT)
rgb_matrix_mode(RGB_MATRIX_CYCLE_LEFT_RIGHT);
#endif
return false;
@@ -177,7 +177,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) && defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL)
handleKeycodeRGBMode(RGBLIGHT_MODE_RAINBOW_SWIRL, RGBLIGHT_MODE_RAINBOW_SWIRL_end);
#endif
-#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && !defined(DISABLE_RGB_MATRIX_CYCLE_PINWHEEL)
+#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && defined(ENABLE_RGB_MATRIX_CYCLE_PINWHEEL)
rgb_matrix_mode(RGB_MATRIX_CYCLE_PINWHEEL);
#endif
return false;
diff --git a/quantum/rgb_matrix/animations/alpha_mods_anim.h b/quantum/rgb_matrix/animations/alpha_mods_anim.h
index 426d88ef35..3f2c9b799a 100644
--- a/quantum/rgb_matrix/animations/alpha_mods_anim.h
+++ b/quantum/rgb_matrix/animations/alpha_mods_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
+#ifdef ENABLE_RGB_MATRIX_ALPHAS_MODS
RGB_MATRIX_EFFECT(ALPHAS_MODS)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/breathing_anim.h b/quantum/rgb_matrix/animations/breathing_anim.h
index 340bd93e5d..a00ccb83a2 100644
--- a/quantum/rgb_matrix/animations/breathing_anim.h
+++ b/quantum/rgb_matrix/animations/breathing_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_BREATHING
+#ifdef ENABLE_RGB_MATRIX_BREATHING
RGB_MATRIX_EFFECT(BREATHING)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h b/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h
index 3df3cfda7d..ac95789228 100644
--- a/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h
+++ b/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
+#ifdef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
RGB_MATRIX_EFFECT(BAND_PINWHEEL_SAT)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h b/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h
index 7d80074fd5..f7fe4b76e9 100644
--- a/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h
+++ b/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
+#ifdef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
RGB_MATRIX_EFFECT(BAND_PINWHEEL_VAL)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/colorband_sat_anim.h b/quantum/rgb_matrix/animations/colorband_sat_anim.h
index 35b830af6b..96a6cbf5cd 100644
--- a/quantum/rgb_matrix/animations/colorband_sat_anim.h
+++ b/quantum/rgb_matrix/animations/colorband_sat_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_BAND_SAT
+#ifdef ENABLE_RGB_MATRIX_BAND_SAT
RGB_MATRIX_EFFECT(BAND_SAT)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h b/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h
index 048157aa1b..52f6040d81 100644
--- a/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h
+++ b/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
+#ifdef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
RGB_MATRIX_EFFECT(BAND_SPIRAL_SAT)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h b/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h
index bff2da1616..d5752e27fb 100644
--- a/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h
+++ b/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL
+#ifdef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
RGB_MATRIX_EFFECT(BAND_SPIRAL_VAL)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/colorband_val_anim.h b/quantum/rgb_matrix/animations/colorband_val_anim.h
index f1aaf1d067..32bc6f52a5 100644
--- a/quantum/rgb_matrix/animations/colorband_val_anim.h
+++ b/quantum/rgb_matrix/animations/colorband_val_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_BAND_VAL
+#ifdef ENABLE_RGB_MATRIX_BAND_VAL
RGB_MATRIX_EFFECT(BAND_VAL)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/cycle_all_anim.h b/quantum/rgb_matrix/animations/cycle_all_anim.h
index faf8598a39..20af94b6ba 100644
--- a/quantum/rgb_matrix/animations/cycle_all_anim.h
+++ b/quantum/rgb_matrix/animations/cycle_all_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
+#ifdef ENABLE_RGB_MATRIX_CYCLE_ALL
RGB_MATRIX_EFFECT(CYCLE_ALL)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/cycle_left_right_anim.h b/quantum/rgb_matrix/animations/cycle_left_right_anim.h
index cf911eb937..7f84f4bd59 100644
--- a/quantum/rgb_matrix/animations/cycle_left_right_anim.h
+++ b/quantum/rgb_matrix/animations/cycle_left_right_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
+#ifdef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
RGB_MATRIX_EFFECT(CYCLE_LEFT_RIGHT)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/cycle_out_in_anim.h b/quantum/rgb_matrix/animations/cycle_out_in_anim.h
index d66acd4b2b..2277f16a2f 100644
--- a/quantum/rgb_matrix/animations/cycle_out_in_anim.h
+++ b/quantum/rgb_matrix/animations/cycle_out_in_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN
+#ifdef ENABLE_RGB_MATRIX_CYCLE_OUT_IN
RGB_MATRIX_EFFECT(CYCLE_OUT_IN)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h b/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h
index fe8396140f..981c0afd05 100644
--- a/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h
+++ b/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
+#ifdef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
RGB_MATRIX_EFFECT(CYCLE_OUT_IN_DUAL)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h b/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h
index 7799887099..1a7db4a4c7 100644
--- a/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h
+++ b/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
+#ifdef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
RGB_MATRIX_EFFECT(CYCLE_PINWHEEL)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/cycle_spiral_anim.h b/quantum/rgb_matrix/animations/cycle_spiral_anim.h
index 80cfb0dbc7..245cdc237f 100644
--- a/quantum/rgb_matrix/animations/cycle_spiral_anim.h
+++ b/quantum/rgb_matrix/animations/cycle_spiral_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_CYCLE_SPIRAL
+#ifdef ENABLE_RGB_MATRIX_CYCLE_SPIRAL
RGB_MATRIX_EFFECT(CYCLE_SPIRAL)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/cycle_up_down_anim.h b/quantum/rgb_matrix/animations/cycle_up_down_anim.h
index 5016f739d6..c9b5a54133 100644
--- a/quantum/rgb_matrix/animations/cycle_up_down_anim.h
+++ b/quantum/rgb_matrix/animations/cycle_up_down_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
+#ifdef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
RGB_MATRIX_EFFECT(CYCLE_UP_DOWN)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/dual_beacon_anim.h b/quantum/rgb_matrix/animations/dual_beacon_anim.h
index ce94871681..5c06080a26 100644
--- a/quantum/rgb_matrix/animations/dual_beacon_anim.h
+++ b/quantum/rgb_matrix/animations/dual_beacon_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
+#ifdef ENABLE_RGB_MATRIX_DUAL_BEACON
RGB_MATRIX_EFFECT(DUAL_BEACON)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/gradient_left_right_anim.h b/quantum/rgb_matrix/animations/gradient_left_right_anim.h
index 53dfd04e2c..b4f2752ff7 100644
--- a/quantum/rgb_matrix/animations/gradient_left_right_anim.h
+++ b/quantum/rgb_matrix/animations/gradient_left_right_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
+#ifdef ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
RGB_MATRIX_EFFECT(GRADIENT_LEFT_RIGHT)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/gradient_up_down_anim.h b/quantum/rgb_matrix/animations/gradient_up_down_anim.h
index 7e0d2898cf..3fd45cf99b 100644
--- a/quantum/rgb_matrix/animations/gradient_up_down_anim.h
+++ b/quantum/rgb_matrix/animations/gradient_up_down_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
+#ifdef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
RGB_MATRIX_EFFECT(GRADIENT_UP_DOWN)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/hue_breathing_anim.h b/quantum/rgb_matrix/animations/hue_breathing_anim.h
index 54dea958af..6d974b8c39 100644
--- a/quantum/rgb_matrix/animations/hue_breathing_anim.h
+++ b/quantum/rgb_matrix/animations/hue_breathing_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_HUE_BREATHING
+#ifdef ENABLE_RGB_MATRIX_HUE_BREATHING
RGB_MATRIX_EFFECT(HUE_BREATHING)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/hue_pendulum_anim.h b/quantum/rgb_matrix/animations/hue_pendulum_anim.h
index 2d8d36174f..a6e1c1074d 100644
--- a/quantum/rgb_matrix/animations/hue_pendulum_anim.h
+++ b/quantum/rgb_matrix/animations/hue_pendulum_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_HUE_PENDULUM
+#ifdef ENABLE_RGB_MATRIX_HUE_PENDULUM
RGB_MATRIX_EFFECT(HUE_PENDULUM)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/hue_wave_anim.h b/quantum/rgb_matrix/animations/hue_wave_anim.h
index fd9026fc90..b1c72b7336 100644
--- a/quantum/rgb_matrix/animations/hue_wave_anim.h
+++ b/quantum/rgb_matrix/animations/hue_wave_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_HUE_WAVE
+#ifdef ENABLE_RGB_MATRIX_HUE_WAVE
RGB_MATRIX_EFFECT(HUE_WAVE)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h
index a17e954b1b..7d8eafffb9 100644
--- a/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h
+++ b/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
+#ifdef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/rainbow_beacon_anim.h b/quantum/rgb_matrix/animations/rainbow_beacon_anim.h
index 977261182f..b54d997f63 100644
--- a/quantum/rgb_matrix/animations/rainbow_beacon_anim.h
+++ b/quantum/rgb_matrix/animations/rainbow_beacon_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
+#ifdef ENABLE_RGB_MATRIX_RAINBOW_BEACON
RGB_MATRIX_EFFECT(RAINBOW_BEACON)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h b/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h
index e51e7b2516..50db922014 100644
--- a/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h
+++ b/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
+#ifdef ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
RGB_MATRIX_EFFECT(RAINBOW_MOVING_CHEVRON)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h b/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h
index 1cd4ed2acf..3299f15df1 100644
--- a/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h
+++ b/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
+#ifdef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
RGB_MATRIX_EFFECT(RAINBOW_PINWHEELS)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/raindrops_anim.h b/quantum/rgb_matrix/animations/raindrops_anim.h
index 38359cdca7..c01688e2c7 100644
--- a/quantum/rgb_matrix/animations/raindrops_anim.h
+++ b/quantum/rgb_matrix/animations/raindrops_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_RAINDROPS
+#ifdef ENABLE_RGB_MATRIX_RAINDROPS
RGB_MATRIX_EFFECT(RAINDROPS)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/typing_heatmap_anim.h b/quantum/rgb_matrix/animations/typing_heatmap_anim.h
index e7dda11a2f..28f040109d 100644
--- a/quantum/rgb_matrix/animations/typing_heatmap_anim.h
+++ b/quantum/rgb_matrix/animations/typing_heatmap_anim.h
@@ -1,4 +1,4 @@
-#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
+#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP)
RGB_MATRIX_EFFECT(TYPING_HEATMAP)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c
index 624e851581..e5635ee039 100644
--- a/quantum/rgb_matrix/rgb_matrix.c
+++ b/quantum/rgb_matrix/rgb_matrix.c
@@ -92,7 +92,7 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { return hsv_to_rgb(hsv
#endif
#if !defined(RGB_MATRIX_STARTUP_MODE)
-# ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
+# ifdef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT
# else
// fallback to solid colors if RGB_MATRIX_CYCLE_LEFT_RIGHT is disabled in userspace
@@ -243,11 +243,11 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) {
}
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
-#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
+#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP)
if (rgb_matrix_config.mode == RGB_MATRIX_TYPING_HEATMAP) {
process_rgb_matrix_typing_heatmap(row, col);
}
-#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
+#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP)
}
void rgb_matrix_test(void) {
diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h
index 58ac29da32..f53e011c1b 100644
--- a/quantum/rgb_matrix/rgb_matrix.h
+++ b/quantum/rgb_matrix/rgb_matrix.h
@@ -23,6 +23,7 @@
#include "rgb_matrix_types.h"
#include "color.h"
#include "quantum.h"
+#include "rgb_matrix_legacy_enables.h"
#ifdef IS31FL3731
# include "is31fl3731.h"
diff --git a/quantum/rgb_matrix/rgb_matrix_legacy_enables.h b/quantum/rgb_matrix/rgb_matrix_legacy_enables.h
new file mode 100644
index 0000000000..398858ebc8
--- /dev/null
+++ b/quantum/rgb_matrix/rgb_matrix_legacy_enables.h
@@ -0,0 +1,153 @@
+/* Copyright 2021 QMK
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// to-do: remove this
+
+#pragma once
+
+#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
+# define ENABLE_RGB_MATRIX_ALPHAS_MODS
+#endif
+#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
+# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
+#endif
+#ifndef DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
+# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
+#endif
+#ifndef DISABLE_RGB_MATRIX_BREATHING
+# define ENABLE_RGB_MATRIX_BREATHING
+#endif
+#ifndef DISABLE_RGB_MATRIX_BAND_SAT
+# define ENABLE_RGB_MATRIX_BAND_SAT
+#endif
+#ifndef DISABLE_RGB_MATRIX_BAND_VAL
+# define ENABLE_RGB_MATRIX_BAND_VAL
+#endif
+#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
+# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
+#endif
+#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
+# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
+#endif
+#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
+# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
+#endif
+#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL
+# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
+#endif
+#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
+# define ENABLE_RGB_MATRIX_CYCLE_ALL
+#endif
+#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
+# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
+#endif
+#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
+# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
+#endif
+#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
+# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
+#endif
+#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN
+# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN
+#endif
+#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
+# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
+#endif
+#ifndef DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
+# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
+#endif
+#ifndef DISABLE_RGB_MATRIX_CYCLE_SPIRAL
+# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL
+#endif
+#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
+# define ENABLE_RGB_MATRIX_DUAL_BEACON
+#endif
+#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
+# define ENABLE_RGB_MATRIX_RAINBOW_BEACON
+#endif
+#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
+# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
+#endif
+#ifndef DISABLE_RGB_MATRIX_RAINDROPS
+# define ENABLE_RGB_MATRIX_RAINDROPS
+#endif
+#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
+# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
+#endif
+#ifndef DISABLE_RGB_MATRIX_HUE_BREATHING
+# define ENABLE_RGB_MATRIX_HUE_BREATHING
+#endif
+#ifndef DISABLE_RGB_MATRIX_HUE_PENDULUM
+# define ENABLE_RGB_MATRIX_HUE_PENDULUM
+#endif
+#ifndef DISABLE_RGB_MATRIX_HUE_WAVE
+# define ENABLE_RGB_MATRIX_HUE_WAVE
+#endif
+#ifndef DISABLE_RGB_MATRIX_PIXEL_RAIN
+# define ENABLE_RGB_MATRIX_PIXEL_RAIN
+#endif
+#ifndef DISABLE_RGB_MATRIX_PIXEL_FLOW
+# define ENABLE_RGB_MATRIX_PIXEL_FLOW
+#endif
+#ifndef DISABLE_RGB_MATRIX_PIXEL_FRACTAL
+# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL
+#endif
+#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
+# ifndef DISABLE_RGB_MATRIX_TYPING_HEATMAP
+# define ENABLE_RGB_MATRIX_TYPING_HEATMAP
+# endif
+# ifndef DISABLE_RGB_MATRIX_DIGITAL_RAIN
+# define ENABLE_RGB_MATRIX_DIGITAL_RAIN
+# endif
+#endif
+#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED)
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
+# endif
+# ifndef DISABLE_RGB_MATRIX_SPLASH
+# define ENABLE_RGB_MATRIX_SPLASH
+# endif
+# ifndef DISABLE_RGB_MATRIX_MULTISPLASH
+# define ENABLE_RGB_MATRIX_MULTISPLASH
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH
+# define ENABLE_RGB_MATRIX_SOLID_SPLASH
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
+# define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
+# endif
+#endif
--
cgit v1.2.3
From 92fa07336cd7fcd578c31a8069cf955a4d601327 Mon Sep 17 00:00:00 2001
From: Drashna Jaelre
Date: Fri, 20 Aug 2021 06:14:42 -0700
Subject: [Bug] Fix RGB/LED Matrix Suspend code (#14084)
---
quantum/led_matrix/led_matrix.c | 5 +++--
quantum/rgb_matrix/rgb_matrix.c | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
(limited to 'quantum/led_matrix')
diff --git a/quantum/led_matrix/led_matrix.c b/quantum/led_matrix/led_matrix.c
index bcf258b260..9133849132 100644
--- a/quantum/led_matrix/led_matrix.c
+++ b/quantum/led_matrix/led_matrix.c
@@ -459,8 +459,9 @@ void led_matrix_init(void) {
void led_matrix_set_suspend_state(bool state) {
#ifdef LED_DISABLE_WHEN_USB_SUSPENDED
- if (state && is_keyboard_master()) {
- led_matrix_set_value_all(0); // turn off all LEDs when suspending
+ if (state && !suspend_state && is_keyboard_master()) { // only run if turning off, and only once
+ led_task_effect(0); // turn off all LEDs when suspending
+ led_task_flush(0); // and actually flash led state to LEDs
}
suspend_state = state;
#endif
diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c
index e5635ee039..8f00b40877 100644
--- a/quantum/rgb_matrix/rgb_matrix.c
+++ b/quantum/rgb_matrix/rgb_matrix.c
@@ -501,8 +501,9 @@ void rgb_matrix_init(void) {
void rgb_matrix_set_suspend_state(bool state) {
#ifdef RGB_DISABLE_WHEN_USB_SUSPENDED
- if (state) {
- rgb_matrix_set_color_all(0, 0, 0); // turn off all LEDs when suspending
+ if (state && !suspend_state) { // only run if turning off, and only once
+ rgb_task_render(0); // turn off all LEDs when suspending
+ rgb_task_flush(0); // and actually flash led state to LEDs
}
suspend_state = state;
#endif
--
cgit v1.2.3
From a7d48b063ec9d551396eadeb02a924d2ee3ea515 Mon Sep 17 00:00:00 2001
From: Ryan
Date: Sat, 21 Aug 2021 03:43:49 +1000
Subject: Fix LED Matrix suspend code (#14090)
---
quantum/led_matrix/led_matrix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'quantum/led_matrix')
diff --git a/quantum/led_matrix/led_matrix.c b/quantum/led_matrix/led_matrix.c
index 9133849132..50510e49aa 100644
--- a/quantum/led_matrix/led_matrix.c
+++ b/quantum/led_matrix/led_matrix.c
@@ -460,7 +460,7 @@ void led_matrix_init(void) {
void led_matrix_set_suspend_state(bool state) {
#ifdef LED_DISABLE_WHEN_USB_SUSPENDED
if (state && !suspend_state && is_keyboard_master()) { // only run if turning off, and only once
- led_task_effect(0); // turn off all LEDs when suspending
+ led_task_render(0); // turn off all LEDs when suspending
led_task_flush(0); // and actually flash led state to LEDs
}
suspend_state = state;
--
cgit v1.2.3