summaryrefslogtreecommitdiff
path: root/quantum/led_matrix
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/led_matrix')
-rw-r--r--quantum/led_matrix/animations/alpha_mods_anim.h4
-rw-r--r--quantum/led_matrix/animations/band_anim.h2
-rw-r--r--quantum/led_matrix/animations/band_pinwheel_anim.h2
-rw-r--r--quantum/led_matrix/animations/band_spiral_anim.h2
-rw-r--r--quantum/led_matrix/animations/breathing_anim.h4
-rw-r--r--quantum/led_matrix/animations/cycle_left_right_anim.h2
-rw-r--r--quantum/led_matrix/animations/cycle_out_in_anim.h2
-rw-r--r--quantum/led_matrix/animations/cycle_up_down_anim.h2
-rw-r--r--quantum/led_matrix/animations/dual_beacon_anim.h2
-rw-r--r--quantum/led_matrix/animations/runners/effect_runner_dx_dy.h2
-rw-r--r--quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h2
-rw-r--r--quantum/led_matrix/animations/runners/effect_runner_i.h2
-rw-r--r--quantum/led_matrix/animations/runners/effect_runner_reactive.h2
-rw-r--r--quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h2
-rw-r--r--quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h2
-rw-r--r--quantum/led_matrix/animations/solid_anim.h2
-rw-r--r--quantum/led_matrix/animations/solid_reactive_cross.h4
-rw-r--r--quantum/led_matrix/animations/solid_reactive_nexus.h2
-rw-r--r--quantum/led_matrix/animations/solid_reactive_simple_anim.h2
-rw-r--r--quantum/led_matrix/animations/solid_reactive_wide.h4
-rw-r--r--quantum/led_matrix/animations/solid_splash_anim.h4
-rw-r--r--quantum/led_matrix/animations/wave_left_right_anim.h2
-rw-r--r--quantum/led_matrix/animations/wave_up_down_anim.h2
-rw-r--r--quantum/led_matrix/led_matrix.c50
-rw-r--r--quantum/led_matrix/led_matrix.h46
-rw-r--r--quantum/led_matrix/led_matrix_drivers.c133
-rw-r--r--quantum/led_matrix/led_matrix_legacy_enables.h82
27 files changed, 145 insertions, 222 deletions
diff --git a/quantum/led_matrix/animations/alpha_mods_anim.h b/quantum/led_matrix/animations/alpha_mods_anim.h
index 14038cd082..4d017894a1 100644
--- a/quantum/led_matrix/animations/alpha_mods_anim.h
+++ b/quantum/led_matrix/animations/alpha_mods_anim.h
@@ -17,8 +17,8 @@ bool ALPHAS_MODS(effect_params_t* params) {
led_matrix_set_value(i, val1);
}
}
- return led_max < DRIVER_LED_TOTAL;
+ return led_matrix_check_finished_leds(led_max);
}
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
-#endif // DISABLE_LED_MATRIX_ALPHAS_MODS
+#endif // ENABLE_LED_MATRIX_ALPHAS_MODS
diff --git a/quantum/led_matrix/animations/band_anim.h b/quantum/led_matrix/animations/band_anim.h
index 5548787b88..293be4f67a 100644
--- a/quantum/led_matrix/animations/band_anim.h
+++ b/quantum/led_matrix/animations/band_anim.h
@@ -10,4 +10,4 @@ static uint8_t BAND_math(uint8_t val, uint8_t i, uint8_t time) {
bool BAND(effect_params_t* params) { return effect_runner_i(params, &BAND_math); }
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
-#endif // DISABLE_LED_MATRIX_BAND
+#endif // ENABLE_LED_MATRIX_BAND
diff --git a/quantum/led_matrix/animations/band_pinwheel_anim.h b/quantum/led_matrix/animations/band_pinwheel_anim.h
index 89651582d5..f47a3869ce 100644
--- a/quantum/led_matrix/animations/band_pinwheel_anim.h
+++ b/quantum/led_matrix/animations/band_pinwheel_anim.h
@@ -7,4 +7,4 @@ static uint8_t BAND_PINWHEEL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t t
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
+#endif // ENABLE_LED_MATRIX_BAND_PINWHEEL
diff --git a/quantum/led_matrix/animations/band_spiral_anim.h b/quantum/led_matrix/animations/band_spiral_anim.h
index 70b0ffaea9..a4bd382181 100644
--- a/quantum/led_matrix/animations/band_spiral_anim.h
+++ b/quantum/led_matrix/animations/band_spiral_anim.h
@@ -7,4 +7,4 @@ static uint8_t BAND_SPIRAL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dis
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
+#endif // ENABLE_LED_MATRIX_BAND_SPIRAL
diff --git a/quantum/led_matrix/animations/breathing_anim.h b/quantum/led_matrix/animations/breathing_anim.h
index e3f600c45c..899925f516 100644
--- a/quantum/led_matrix/animations/breathing_anim.h
+++ b/quantum/led_matrix/animations/breathing_anim.h
@@ -12,8 +12,8 @@ bool BREATHING(effect_params_t* params) {
LED_MATRIX_TEST_LED_FLAGS();
led_matrix_set_value(i, val);
}
- return led_max < DRIVER_LED_TOTAL;
+ return led_matrix_check_finished_leds(led_max);
}
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
-#endif // DISABLE_LED_MATRIX_BREATHING
+#endif // ENABLE_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
index 769e6d7942..1a8999b831 100644
--- a/quantum/led_matrix/animations/cycle_left_right_anim.h
+++ b/quantum/led_matrix/animations/cycle_left_right_anim.h
@@ -7,4 +7,4 @@ static uint8_t CYCLE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { ret
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
+#endif // ENABLE_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
index 6adf9c25ff..77d3a14b6f 100644
--- a/quantum/led_matrix/animations/cycle_out_in_anim.h
+++ b/quantum/led_matrix/animations/cycle_out_in_anim.h
@@ -7,4 +7,4 @@ static uint8_t CYCLE_OUT_IN_math(uint8_t val, int16_t dx, int16_t dy, uint8_t di
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
+#endif // ENABLE_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
index 7a5868ac26..b25947199c 100644
--- a/quantum/led_matrix/animations/cycle_up_down_anim.h
+++ b/quantum/led_matrix/animations/cycle_up_down_anim.h
@@ -7,4 +7,4 @@ static uint8_t CYCLE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { return
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
+#endif // ENABLE_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
index 3552c9fc39..81735e323c 100644
--- a/quantum/led_matrix/animations/dual_beacon_anim.h
+++ b/quantum/led_matrix/animations/dual_beacon_anim.h
@@ -7,4 +7,4 @@ static uint8_t DUAL_BEACON_math(uint8_t val, int8_t sin, int8_t cos, uint8_t i,
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
+#endif // ENABLE_LED_MATRIX_DUAL_BEACON
diff --git a/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h b/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h
index ef97631b90..fa9b7dbbfa 100644
--- a/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h
+++ b/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h
@@ -12,5 +12,5 @@ bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) {
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;
+ return led_matrix_check_finished_leds(led_max);
}
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
index 5ef5938be0..061a5f07fe 100644
--- a/quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h
+++ b/quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h
@@ -13,5 +13,5 @@ bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func)
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;
+ return led_matrix_check_finished_leds(led_max);
}
diff --git a/quantum/led_matrix/animations/runners/effect_runner_i.h b/quantum/led_matrix/animations/runners/effect_runner_i.h
index b3015759be..f6f8c0dee0 100644
--- a/quantum/led_matrix/animations/runners/effect_runner_i.h
+++ b/quantum/led_matrix/animations/runners/effect_runner_i.h
@@ -10,5 +10,5 @@ bool effect_runner_i(effect_params_t* params, i_f effect_func) {
LED_MATRIX_TEST_LED_FLAGS();
led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, i, time));
}
- return led_max < DRIVER_LED_TOTAL;
+ return led_matrix_check_finished_leds(led_max);
}
diff --git a/quantum/led_matrix/animations/runners/effect_runner_reactive.h b/quantum/led_matrix/animations/runners/effect_runner_reactive.h
index 4369ea8c49..be3090aa53 100644
--- a/quantum/led_matrix/animations/runners/effect_runner_reactive.h
+++ b/quantum/led_matrix/animations/runners/effect_runner_reactive.h
@@ -22,7 +22,7 @@ bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) {
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;
+ return led_matrix_check_finished_leds(led_max);
}
#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
index d6eb9731ee..f6ffc825a1 100644
--- a/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h
+++ b/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h
@@ -20,7 +20,7 @@ bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, react
}
led_matrix_set_value(i, scale8(val, led_matrix_eeconfig.val));
}
- return led_max < DRIVER_LED_TOTAL;
+ return led_matrix_check_finished_leds(led_max);
}
#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
index 4a5219abd1..3145e27139 100644
--- a/quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h
+++ b/quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h
@@ -12,5 +12,5 @@ bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) {
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;
+ return led_matrix_check_finished_leds(led_max);
}
diff --git a/quantum/led_matrix/animations/solid_anim.h b/quantum/led_matrix/animations/solid_anim.h
index 4c9e43c581..c728dbcc98 100644
--- a/quantum/led_matrix/animations/solid_anim.h
+++ b/quantum/led_matrix/animations/solid_anim.h
@@ -9,7 +9,7 @@ bool SOLID(effect_params_t* params) {
LED_MATRIX_TEST_LED_FLAGS();
led_matrix_set_value(i, val);
}
- return led_max < DRIVER_LED_TOTAL;
+ return led_matrix_check_finished_leds(led_max);
}
#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
index 3a3c46be13..a149e9a929 100644
--- a/quantum/led_matrix/animations/solid_reactive_cross.h
+++ b/quantum/led_matrix/animations/solid_reactive_cross.h
@@ -1,5 +1,5 @@
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
-# if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS)
+# if defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS)
# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
LED_MATRIX_EFFECT(SOLID_REACTIVE_CROSS)
@@ -31,5 +31,5 @@ bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { return effect_runner_r
# endif
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
-# endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS)
+# endif // defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || defined(ENABLE_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
index 2520b8e1df..5a86e48c6c 100644
--- a/quantum/led_matrix/animations/solid_reactive_nexus.h
+++ b/quantum/led_matrix/animations/solid_reactive_nexus.h
@@ -28,5 +28,5 @@ bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { return effect_runner_r
# endif
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
-# endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS)
+# endif // defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || defined(ENABLE_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
index 43f6ad9ab4..14f5e90730 100644
--- a/quantum/led_matrix/animations/solid_reactive_simple_anim.h
+++ b/quantum/led_matrix/animations/solid_reactive_simple_anim.h
@@ -8,5 +8,5 @@ static uint8_t SOLID_REACTIVE_SIMPLE_math(uint8_t val, uint16_t offset) { return
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 // ENABLE_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
index d683b02510..3aa88063a7 100644
--- a/quantum/led_matrix/animations/solid_reactive_wide.h
+++ b/quantum/led_matrix/animations/solid_reactive_wide.h
@@ -1,5 +1,5 @@
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
-# if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE)
+# if !defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE)
# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
LED_MATRIX_EFFECT(SOLID_REACTIVE_WIDE)
@@ -26,5 +26,5 @@ bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { return effect_runner_re
# endif
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
-# endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE)
+# endif // !defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(ENABLE_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
index cf599c8fe6..17b692a09a 100644
--- a/quantum/led_matrix/animations/solid_splash_anim.h
+++ b/quantum/led_matrix/animations/solid_splash_anim.h
@@ -1,5 +1,5 @@
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
-# if !defined(DISABLE_LED_MATRIX_SOLID_SPLASH) || !defined(DISABLE_LED_MATRIX_SOLID_MULTISPLASH)
+# if defined(ENABLE_LED_MATRIX_SOLID_SPLASH) || defined(ENABLE_LED_MATRIX_SOLID_MULTISPLASH)
# ifdef ENABLE_LED_MATRIX_SOLID_SPLASH
LED_MATRIX_EFFECT(SOLID_SPLASH)
@@ -26,5 +26,5 @@ bool SOLID_MULTISPLASH(effect_params_t* params) { return effect_runner_reactive_
# endif
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
-# endif // !defined(DISABLE_LED_MATRIX_SPLASH) && !defined(DISABLE_LED_MATRIX_MULTISPLASH)
+# endif // defined(ENABLE_LED_MATRIX_SPLASH) || defined(ENABLE_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
index c062cf968e..76487f8515 100644
--- a/quantum/led_matrix/animations/wave_left_right_anim.h
+++ b/quantum/led_matrix/animations/wave_left_right_anim.h
@@ -7,4 +7,4 @@ static uint8_t WAVE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { retu
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
+#endif // ENABLE_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
index 5e612f6b6d..94710f5c6e 100644
--- a/quantum/led_matrix/animations/wave_up_down_anim.h
+++ b/quantum/led_matrix/animations/wave_up_down_anim.h
@@ -7,4 +7,4 @@ static uint8_t WAVE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { return
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
+#endif // ENABLE_LED_MATRIX_WAVE_UP_DOWN
diff --git a/quantum/led_matrix/led_matrix.c b/quantum/led_matrix/led_matrix.c
index 50510e49aa..be1494e884 100644
--- a/quantum/led_matrix/led_matrix.c
+++ b/quantum/led_matrix/led_matrix.c
@@ -33,14 +33,6 @@ const led_point_t k_led_matrix_center = {112, 32};
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"
@@ -107,7 +99,6 @@ last_hit_t g_last_hit_tracker;
// 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};
@@ -127,9 +118,9 @@ static last_hit_t last_hit_buffer;
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)); }
+EECONFIG_DEBOUNCE_HELPER(led_matrix, EECONFIG_LED_MATRIX, 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(void) { eeconfig_flush_led_matrix(true); }
void eeconfig_update_led_matrix_default(void) {
dprintf("eeconfig_update_led_matrix_default\n");
@@ -138,7 +129,7 @@ void eeconfig_update_led_matrix_default(void) {
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();
+ eeconfig_flush_led_matrix(true);
}
void eeconfig_debug_led_matrix(void) {
@@ -165,20 +156,10 @@ uint8_t led_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *l
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);
+ value = pgm_read_byte(&CIE1931_CURVE[value]);
#endif
+ led_matrix_driver.set_value(index, value);
}
void led_matrix_set_value_all(uint8_t value) {
@@ -232,11 +213,11 @@ void process_led_matrix(uint8_t row, uint8_t col, bool pressed) {
}
#endif // LED_MATRIX_KEYREACTIVE_ENABLED
-#if defined(LED_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_LED_MATRIX_TYPING_HEATMAP)
+#if defined(LED_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_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)
+#endif // defined(LED_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_LED_MATRIX_TYPING_HEATMAP)
}
static bool led_matrix_none(effect_params_t *params) {
@@ -279,9 +260,8 @@ static void led_task_timers(void) {
}
static void led_task_sync(void) {
+ eeconfig_flush_led_matrix(false);
// 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;
}
@@ -449,7 +429,7 @@ void led_matrix_init(void) {
eeconfig_update_led_matrix_default();
}
- eeconfig_read_led_matrix();
+ eeconfig_init_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();
@@ -472,7 +452,7 @@ 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);
+ eeconfig_flag_led_matrix(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); }
@@ -480,7 +460,7 @@ void led_matrix_toggle(void) { led_matrix_toggle_eeprom_helper(true); }
void led_matrix_enable(void) {
led_matrix_enable_noeeprom();
- led_eeconfig_update(true);
+ eeconfig_flag_led_matrix(true);
}
void led_matrix_enable_noeeprom(void) {
@@ -490,7 +470,7 @@ void led_matrix_enable_noeeprom(void) {
void led_matrix_disable(void) {
led_matrix_disable_noeeprom();
- led_eeconfig_update(true);
+ eeconfig_flag_led_matrix(true);
}
void led_matrix_disable_noeeprom(void) {
@@ -512,7 +492,7 @@ void led_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
led_matrix_eeconfig.mode = mode;
}
led_task_state = STARTING;
- led_eeconfig_update(write_to_eeprom);
+ eeconfig_flag_led_matrix(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); }
@@ -539,7 +519,7 @@ void led_matrix_set_val_eeprom_helper(uint8_t val, bool write_to_eeprom) {
return;
}
led_matrix_eeconfig.val = (val > LED_MATRIX_MAXIMUM_BRIGHTNESS) ? LED_MATRIX_MAXIMUM_BRIGHTNESS : val;
- led_eeconfig_update(write_to_eeprom);
+ eeconfig_flag_led_matrix(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); }
@@ -557,7 +537,7 @@ 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);
+ eeconfig_flag_led_matrix(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); }
diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h
index a7a1c983f7..e42be64661 100644
--- a/quantum/led_matrix/led_matrix.h
+++ b/quantum/led_matrix/led_matrix.h
@@ -23,7 +23,6 @@
#include <stdbool.h>
#include "led_matrix_types.h"
#include "quantum.h"
-#include "led_matrix_legacy_enables.h"
#ifdef IS31FL3731
# include "is31fl3731-simple.h"
@@ -38,14 +37,33 @@
#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;
+# if defined(LED_MATRIX_SPLIT)
+# 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; \
+ uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT; \
+ if (is_keyboard_left() && (max > k_led_matrix_split[0])) max = k_led_matrix_split[0]; \
+ if (!(is_keyboard_left()) && (min < k_led_matrix_split[0])) min = k_led_matrix_split[0];
+# else
+# 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;
+# endif
#else
-# define LED_MATRIX_USE_LIMITS(min, max) \
- uint8_t min = 0; \
- uint8_t max = DRIVER_LED_TOTAL;
+# if defined(LED_MATRIX_SPLIT)
+# define LED_MATRIX_USE_LIMITS(min, max) \
+ uint8_t min = 0; \
+ uint8_t max = DRIVER_LED_TOTAL; \
+ const uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT; \
+ if (is_keyboard_left() && (max > k_led_matrix_split[0])) max = k_led_matrix_split[0]; \
+ if (!(is_keyboard_left()) && (min < k_led_matrix_split[0])) min = k_led_matrix_split[0];
+# else
+# define LED_MATRIX_USE_LIMITS(min, max) \
+ uint8_t min = 0; \
+ uint8_t max = DRIVER_LED_TOTAL;
+# endif
#endif
#define LED_MATRIX_TEST_LED_FLAGS() \
@@ -147,6 +165,18 @@ typedef struct {
void (*flush)(void);
} led_matrix_driver_t;
+static inline bool led_matrix_check_finished_leds(uint8_t led_idx) {
+#if defined(LED_MATRIX_SPLIT)
+ if (is_keyboard_left()) {
+ uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT;
+ return led_idx < k_led_matrix_split[0];
+ } else
+ return led_idx < DRIVER_LED_TOTAL;
+#else
+ return led_idx < DRIVER_LED_TOTAL;
+#endif
+}
+
extern const led_matrix_driver_t led_matrix_driver;
extern led_eeconfig_t led_matrix_eeconfig;
diff --git a/quantum/led_matrix/led_matrix_drivers.c b/quantum/led_matrix/led_matrix_drivers.c
index 1d46b2c506..2157619a0b 100644
--- a/quantum/led_matrix/led_matrix_drivers.c
+++ b/quantum/led_matrix/led_matrix_drivers.c
@@ -26,128 +26,123 @@
*/
#if defined(IS31FL3731) || defined(IS31FL3733)
-
# include "i2c_master.h"
static void init(void) {
i2c_init();
-# ifdef IS31FL3731
-# ifdef LED_DRIVER_ADDR_1
+
+# if defined(IS31FL3731)
IS31FL3731_init(LED_DRIVER_ADDR_1);
-# endif
-# ifdef LED_DRIVER_ADDR_2
+# if defined(LED_DRIVER_ADDR_2)
IS31FL3731_init(LED_DRIVER_ADDR_2);
-# endif
-# ifdef LED_DRIVER_ADDR_3
+# if defined(LED_DRIVER_ADDR_3)
IS31FL3731_init(LED_DRIVER_ADDR_3);
-# endif
-# ifdef LED_DRIVER_ADDR_4
+# if defined(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
# endif
- IS31FL3733_init(LED_DRIVER_ADDR_1, LED_DRIVER_SYNC_1);
# endif
-# ifdef LED_DRIVER_ADDR_2
-# ifndef LED_DRIVER_SYNC_2
+
+# elif defined(IS31FL3733)
+# if !defined(LED_DRIVER_SYNC_1)
+# define LED_DRIVER_SYNC_1 0
+# endif
+ IS31FL3733_init(LED_DRIVER_ADDR_1, LED_DRIVER_SYNC_1);
+# if defined(LED_DRIVER_ADDR_2)
+# if !defined(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
+# if defined(LED_DRIVER_ADDR_3)
+# if !defined(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
+# if defined(LED_DRIVER_ADDR_4)
+# if !defined(LED_DRIVER_SYNC_4)
+# define LED_DRIVER_SYNC_4 0
+# endif
IS31FL3733_init(LED_DRIVER_ADDR_4, LED_DRIVER_SYNC_4);
+# endif
+# endif
# endif
# endif
for (int index = 0; index < DRIVER_LED_TOTAL; index++) {
-# ifdef IS31FL3731
+# if defined(IS31FL3731)
IS31FL3731_set_led_control_register(index, true);
-# else
+# elif defined(IS31FL3733)
IS31FL3733_set_led_control_register(index, true);
# endif
}
+
// This actually updates the LED drivers
-# ifdef IS31FL3731
-# ifdef LED_DRIVER_ADDR_1
+# if defined(IS31FL3731)
IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_1, 0);
-# endif
-# ifdef LED_DRIVER_ADDR_2
+# if defined(LED_DRIVER_ADDR_2)
IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_2, 1);
-# endif
-# ifdef LED_DRIVER_ADDR_3
+# if defined(LED_DRIVER_ADDR_3)
IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_3, 2);
-# endif
-# ifdef LED_DRIVER_ADDR_4
+# if defined(LED_DRIVER_ADDR_4)
IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_4, 3);
+# endif
+# endif
# endif
-# else
-# ifdef LED_DRIVER_ADDR_1
+
+# elif defined(IS31FL3733)
IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_1, 0);
-# endif
-# ifdef LED_DRIVER_ADDR_2
+# if defined(LED_DRIVER_ADDR_2)
IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_2, 1);
-# endif
-# ifdef LED_DRIVER_ADDR_3
+# if defined(LED_DRIVER_ADDR_3)
IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_3, 2);
-# endif
-# ifdef LED_DRIVER_ADDR_4
+# if defined(LED_DRIVER_ADDR_4)
IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_4, 3);
+# endif
+# endif
# endif
# endif
}
+# if defined(IS31FL3731)
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
+# if defined(LED_DRIVER_ADDR_2)
IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_2, 1);
-# endif
-# ifdef LED_DRIVER_ADDR_3
+# if defined(LED_DRIVER_ADDR_3)
IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_3, 2);
-# endif
-# ifdef LED_DRIVER_ADDR_4
+# if defined(LED_DRIVER_ADDR_4)
IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_4, 3);
+# endif
+# endif
# endif
-# else
-# ifdef LED_DRIVER_ADDR_1
+}
+
+const led_matrix_driver_t led_matrix_driver = {
+ .init = init,
+ .flush = flush,
+ .set_value = IS31FL3731_set_value,
+ .set_value_all = IS31FL3731_set_value_all,
+};
+
+# elif defined(IS31FL3733)
+static void flush(void) {
IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_1, 0);
-# endif
-# ifdef LED_DRIVER_ADDR_2
+# if defined(LED_DRIVER_ADDR_2)
IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_2, 1);
-# endif
-# ifdef LED_DRIVER_ADDR_3
+# if defined(LED_DRIVER_ADDR_3)
IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_3, 2);
-# endif
-# ifdef LED_DRIVER_ADDR_4
+# if defined(LED_DRIVER_ADDR_4)
IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_4, 3);
+# endif
+# endif
# endif
-# endif
}
const led_matrix_driver_t led_matrix_driver = {
- .init = init,
+ .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
#endif
diff --git a/quantum/led_matrix/led_matrix_legacy_enables.h b/quantum/led_matrix/led_matrix_legacy_enables.h
deleted file mode 100644
index 7738d2f34e..0000000000
--- a/quantum/led_matrix/led_matrix_legacy_enables.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* 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 <http://www.gnu.org/licenses/>.
- */
-
-// 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