summaryrefslogtreecommitdiffstats
path: root/quantum/rgb_matrix
diff options
context:
space:
mode:
authorlokher <lokher@gmail.com>2022-12-06 17:04:10 +0800
committerlokher <lokher@gmail.com>2022-12-06 17:04:10 +0800
commit27fc28fd2ff52e079a5bc58d6aaea4c752420615 (patch)
tree7ac943fb1ba4f430a7220efd18f66f6a77205c30 /quantum/rgb_matrix
parente736133392fe6427cfb995da0787337189828272 (diff)
parent2709b6ed616f8012ff4cfd3ee69a822a8d188351 (diff)
Merge upstream master
Diffstat (limited to 'quantum/rgb_matrix')
-rw-r--r--quantum/rgb_matrix/animations/jellybean_raindrops_anim.h2
-rw-r--r--quantum/rgb_matrix/animations/pixel_flow_anim.h4
-rw-r--r--quantum/rgb_matrix/animations/pixel_rain_anim.h2
-rw-r--r--quantum/rgb_matrix/animations/raindrops_anim.h2
-rw-r--r--quantum/rgb_matrix/animations/typing_heatmap_anim.h2
-rw-r--r--quantum/rgb_matrix/rgb_matrix.c102
-rw-r--r--quantum/rgb_matrix/rgb_matrix.h36
-rw-r--r--quantum/rgb_matrix/rgb_matrix_drivers.c26
-rw-r--r--quantum/rgb_matrix/rgb_matrix_types.h4
9 files changed, 100 insertions, 80 deletions
diff --git a/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h
index 31dffcbc5a..69bf265d14 100644
--- a/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h
+++ b/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h
@@ -13,7 +13,7 @@ bool JELLYBEAN_RAINDROPS(effect_params_t* params) {
if (!params->init) {
// Change one LED every tick, make sure speed is not 0
if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) {
- jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
+ jellybean_raindrops_set_color(rand() % RGB_MATRIX_LED_COUNT, params);
}
return false;
}
diff --git a/quantum/rgb_matrix/animations/pixel_flow_anim.h b/quantum/rgb_matrix/animations/pixel_flow_anim.h
index 714f5d174e..8628c3c2ec 100644
--- a/quantum/rgb_matrix/animations/pixel_flow_anim.h
+++ b/quantum/rgb_matrix/animations/pixel_flow_anim.h
@@ -7,7 +7,7 @@ RGB_MATRIX_EFFECT(PIXEL_FLOW)
static bool PIXEL_FLOW(effect_params_t* params) {
// LED state array
- static RGB led[DRIVER_LED_TOTAL];
+ static RGB led[RGB_MATRIX_LED_COUNT];
static uint32_t wait_timer = 0;
if (wait_timer > g_rgb_timer) {
@@ -21,7 +21,7 @@ static bool PIXEL_FLOW(effect_params_t* params) {
if (params->init) {
// Clear LEDs and fill the state array
rgb_matrix_set_color_all(0, 0, 0);
- for (uint8_t j = 0; j < DRIVER_LED_TOTAL; ++j) {
+ for (uint8_t j = 0; j < RGB_MATRIX_LED_COUNT; ++j) {
led[j] = (random8() & 2) ? (RGB){0, 0, 0} : hsv_to_rgb((HSV){random8(), qadd8(random8() >> 1, 127), rgb_matrix_config.hsv.v});
}
}
diff --git a/quantum/rgb_matrix/animations/pixel_rain_anim.h b/quantum/rgb_matrix/animations/pixel_rain_anim.h
index ce2528a26d..fded60340f 100644
--- a/quantum/rgb_matrix/animations/pixel_rain_anim.h
+++ b/quantum/rgb_matrix/animations/pixel_rain_anim.h
@@ -41,7 +41,7 @@ static bool PIXEL_RAIN(effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max);
if (g_rgb_timer > wait_timer) {
- rain_pixel(mod8(random8(), DRIVER_LED_TOTAL), params, random8() & 2);
+ rain_pixel(mod8(random8(), RGB_MATRIX_LED_COUNT), params, random8() & 2);
}
return rgb_matrix_check_finished_leds(led_max);
}
diff --git a/quantum/rgb_matrix/animations/raindrops_anim.h b/quantum/rgb_matrix/animations/raindrops_anim.h
index a508e51183..6b92d649ad 100644
--- a/quantum/rgb_matrix/animations/raindrops_anim.h
+++ b/quantum/rgb_matrix/animations/raindrops_anim.h
@@ -24,7 +24,7 @@ bool RAINDROPS(effect_params_t* params) {
if (!params->init) {
// Change one LED every tick, make sure speed is not 0
if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
- raindrops_set_color(random8() % DRIVER_LED_TOTAL, params);
+ raindrops_set_color(random8() % RGB_MATRIX_LED_COUNT, params);
}
} else {
for (int i = led_min; i < led_max; i++) {
diff --git a/quantum/rgb_matrix/animations/typing_heatmap_anim.h b/quantum/rgb_matrix/animations/typing_heatmap_anim.h
index a05c07760e..00d137f1a6 100644
--- a/quantum/rgb_matrix/animations/typing_heatmap_anim.h
+++ b/quantum/rgb_matrix/animations/typing_heatmap_anim.h
@@ -29,7 +29,7 @@ void process_rgb_matrix_typing_heatmap(uint8_t row, uint8_t col) {
if (i_row == row && i_col == col) {
g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], 32);
} else {
-# define LED_DISTANCE(led_a, led_b) sqrt16(((int8_t)(led_a.x - led_b.x) * (int8_t)(led_a.x - led_b.x)) + ((int8_t)(led_a.y - led_b.y) * (int8_t)(led_a.y - led_b.y)))
+# define LED_DISTANCE(led_a, led_b) sqrt16(((int16_t)(led_a.x - led_b.x) * (int16_t)(led_a.x - led_b.x)) + ((int16_t)(led_a.y - led_b.y) * (int16_t)(led_a.y - led_b.y)))
uint8_t distance = LED_DISTANCE(g_led_config.point[g_led_config.matrix_co[row][col]], g_led_config.point[g_led_config.matrix_co[i_row][i_col]]);
# undef LED_DISTANCE
if (distance <= RGB_MATRIX_TYPING_HEATMAP_SPREAD) {
diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c
index 1ba1686b44..181199f235 100644
--- a/quantum/rgb_matrix/rgb_matrix.c
+++ b/quantum/rgb_matrix/rgb_matrix.c
@@ -56,12 +56,8 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) {
// -----End rgb effect includes macros-------
// ------------------------------------------
-#if defined(RGB_DISABLE_AFTER_TIMEOUT) && !defined(RGB_DISABLE_TIMEOUT)
-# define RGB_DISABLE_TIMEOUT (RGB_DISABLE_AFTER_TIMEOUT * 1200UL)
-#endif
-
-#ifndef RGB_DISABLE_TIMEOUT
-# define RGB_DISABLE_TIMEOUT 0
+#ifndef RGB_MATRIX_TIMEOUT
+# define RGB_MATRIX_TIMEOUT 0
#endif
#if !defined(RGB_MATRIX_MAXIMUM_BRIGHTNESS) || RGB_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX
@@ -85,29 +81,29 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) {
# define RGB_MATRIX_SPD_STEP 16
#endif
-#if !defined(RGB_MATRIX_STARTUP_MODE)
+#if !defined(RGB_MATRIX_DEFAULT_MODE)
# ifdef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
-# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT
+# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT
# else
// fallback to solid colors if RGB_MATRIX_CYCLE_LEFT_RIGHT is disabled in userspace
-# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_COLOR
+# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_SOLID_COLOR
# endif
#endif
-#if !defined(RGB_MATRIX_STARTUP_HUE)
-# define RGB_MATRIX_STARTUP_HUE 0
+#if !defined(RGB_MATRIX_DEFAULT_HUE)
+# define RGB_MATRIX_DEFAULT_HUE 0
#endif
-#if !defined(RGB_MATRIX_STARTUP_SAT)
-# define RGB_MATRIX_STARTUP_SAT UINT8_MAX
+#if !defined(RGB_MATRIX_DEFAULT_SAT)
+# define RGB_MATRIX_DEFAULT_SAT UINT8_MAX
#endif
-#if !defined(RGB_MATRIX_STARTUP_VAL)
-# define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS
+#if !defined(RGB_MATRIX_DEFAULT_VAL)
+# define RGB_MATRIX_DEFAULT_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS
#endif
-#if !defined(RGB_MATRIX_STARTUP_SPD)
-# define RGB_MATRIX_STARTUP_SPD UINT8_MAX / 2
+#if !defined(RGB_MATRIX_DEFAULT_SPD)
+# define RGB_MATRIX_DEFAULT_SPD UINT8_MAX / 2
#endif
#if defined(RGB_MATRIX_BRIGHTNESS_TURN_OFF_VAL) && (RGB_MATRIX_BRIGHTNESS_TURN_OFF_VAL >= RGB_MATRIX_MAXIMUM_BRIGHTNESS)
@@ -133,10 +129,10 @@ static uint8_t rgb_last_enable = UINT8_MAX;
static uint8_t rgb_last_effect = UINT8_MAX;
static effect_params_t rgb_effect_params = {0, LED_FLAG_ALL, false};
static rgb_task_states rgb_task_state = SYNCING;
-#if RGB_DISABLE_TIMEOUT > 0
+#if RGB_MATRIX_TIMEOUT > 0
static uint32_t rgb_anykey_timer;
-static uint32_t rgb_disable_timeout = RGB_DISABLE_TIMEOUT;
-#endif // RGB_DISABLE_TIMEOUT > 0
+static uint32_t rgb_matrix_timeout = RGB_MATRIX_TIMEOUT;
+#endif // RGB_MATRIX_TIMEOUT > 0
// double buffers
static uint32_t rgb_timer_buffer;
@@ -160,9 +156,9 @@ void eeconfig_update_rgb_matrix(void) {
void eeconfig_update_rgb_matrix_default(void) {
dprintf("eeconfig_update_rgb_matrix_default\n");
rgb_matrix_config.enable = 1;
- rgb_matrix_config.mode = RGB_MATRIX_STARTUP_MODE;
- rgb_matrix_config.hsv = (HSV){RGB_MATRIX_STARTUP_HUE, RGB_MATRIX_STARTUP_SAT, RGB_MATRIX_STARTUP_VAL};
- rgb_matrix_config.speed = RGB_MATRIX_STARTUP_SPD;
+ rgb_matrix_config.mode = RGB_MATRIX_DEFAULT_MODE;
+ rgb_matrix_config.hsv = (HSV){RGB_MATRIX_DEFAULT_HUE, RGB_MATRIX_DEFAULT_SAT, RGB_MATRIX_DEFAULT_VAL};
+ rgb_matrix_config.speed = RGB_MATRIX_DEFAULT_SPD;
rgb_matrix_config.flags = LED_FLAG_ALL;
eeconfig_flush_rgb_matrix(true);
}
@@ -212,7 +208,7 @@ void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
- for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++)
+ for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++)
rgb_matrix_set_color(i, red, green, blue);
#else
rgb_matrix_driver.set_color_all(red, green, blue);
@@ -223,9 +219,9 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) {
#ifndef RGB_MATRIX_SPLIT
if (!is_keyboard_master()) return;
#endif
-#if RGB_DISABLE_TIMEOUT > 0
+#if RGB_MATRIX_TIMEOUT > 0
rgb_anykey_timer = 0;
-#endif // RGB_DISABLE_TIMEOUT > 0
+#endif // RGB_MATRIX_TIMEOUT > 0
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
uint8_t led[LED_HITS_TO_REMEMBER];
@@ -316,17 +312,17 @@ static bool rgb_matrix_none(effect_params_t *params) {
}
static void rgb_task_timers(void) {
-#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0
+#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_MATRIX_TIMEOUT > 0
uint32_t deltaTime = sync_timer_elapsed32(rgb_timer_buffer);
-#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0
+#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_MATRIX_TIMEOUT > 0
rgb_timer_buffer = sync_timer_read32();
// Update double buffer timers
-#if RGB_DISABLE_TIMEOUT > 0
+#if RGB_MATRIX_TIMEOUT > 0
if (rgb_anykey_timer + deltaTime <= UINT32_MAX) {
rgb_anykey_timer += deltaTime;
}
-#endif // RGB_DISABLE_TIMEOUT > 0
+#endif // RGB_MATRIX_TIMEOUT > 0
// Update double buffer last hit timers
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
@@ -431,7 +427,7 @@ static void rgb_task_flush(uint8_t effect) {
rgb_matrix_driver.exit_shutdown();
driver_shutdown = false;
}
-#endif
+#endif
// update pwm buffers
rgb_matrix_update_pwm_buffers();
#ifdef RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE
@@ -439,7 +435,7 @@ static void rgb_task_flush(uint8_t effect) {
if (effect == RGB_MATRIX_NONE && !driver_shutdown && rgb_matrix_driver_allow_shutdown()) {
rgb_matrix_driver_shutdown();
}
-#endif
+#endif
// next task
rgb_task_state = SYNCING;
@@ -451,9 +447,9 @@ void rgb_matrix_task(void) {
// 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 RGB_DISABLE_TIMEOUT > 0
- (rgb_anykey_timer > rgb_disable_timeout) ||
-#endif // RGB_DISABLE_TIMEOUT > 0
+#if RGB_MATRIX_TIMEOUT > 0
+ (rgb_anykey_timer > rgb_matrix_timeout) ||
+#endif // RGB_MATRIX_TIMEOUT > 0
false;
uint8_t effect = suspend_backlight || !rgb_matrix_config.enable ? 0 : rgb_matrix_config.mode;
@@ -480,12 +476,15 @@ void rgb_matrix_task(void) {
void rgb_matrix_indicators(void) {
rgb_matrix_indicators_kb();
- rgb_matrix_indicators_user();
}
-__attribute__((weak)) void rgb_matrix_indicators_kb(void) {}
+__attribute__((weak)) bool rgb_matrix_indicators_kb(void) {
+ return rgb_matrix_indicators_user();
+}
-__attribute__((weak)) void rgb_matrix_indicators_user(void) {}
+__attribute__((weak)) bool rgb_matrix_indicators_user(void) {
+ return true;
+}
void rgb_matrix_indicators_advanced(effect_params_t *params) {
/* special handling is needed for "params->iter", since it's already been incremented.
@@ -493,27 +492,30 @@ void rgb_matrix_indicators_advanced(effect_params_t *params) {
* and not sure which would be better. Otherwise, this should be called from
* rgb_task_render, right before the iter++ line.
*/
-#if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL
+#if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < RGB_MATRIX_LED_COUNT
uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * (params->iter - 1);
uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT;
- if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL;
+ if (max > RGB_MATRIX_LED_COUNT) max = RGB_MATRIX_LED_COUNT;
#else
uint8_t min = 0;
- uint8_t max = DRIVER_LED_TOTAL;
+ uint8_t max = RGB_MATRIX_LED_COUNT;
#endif
rgb_matrix_indicators_advanced_kb(min, max);
- rgb_matrix_indicators_advanced_user(min, max);
}
-__attribute__((weak)) void rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {}
+__attribute__((weak)) bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
+ return rgb_matrix_indicators_advanced_user(led_min, led_max);
+}
-__attribute__((weak)) void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {}
+__attribute__((weak)) bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
+ return true;
+}
void rgb_matrix_init(void) {
rgb_matrix_driver.init();
#ifdef RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE
driver_shutdown = false;
-#endif
+#endif
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
g_last_hit_tracker.count = 0;
@@ -811,15 +813,15 @@ void rgb_matrix_set_flags_noeeprom(led_flags_t flags) {
}
-#if RGB_DISABLE_TIMEOUT > 0
-void rgb_matrix_disable_timeout_set(uint32_t timeout) {
- rgb_disable_timeout = timeout;
+#if RGB_MATRIX_TIMEOUT > 0
+void rgb_matrix_disable_timeout_set(uint32_t timeout) {
+ rgb_matrix_timeout = timeout;
}
void rgb_matrix_disable_time_reset(void){ rgb_anykey_timer = 0; }
#endif
#ifdef RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE
-void rgb_matrix_driver_shutdown(void) {
+void rgb_matrix_driver_shutdown(void) {
rgb_matrix_driver.shutdown();
driver_shutdown = true;
};
@@ -827,4 +829,4 @@ void rgb_matrix_driver_shutdown(void) {
bool rgb_matrix_is_driver_shutdown(void) { return driver_shutdown; }
__attribute__((weak)) bool rgb_matrix_driver_allow_shutdown(void) { return true; };
-#endif \ No newline at end of file
+#endif
diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h
index dca07cf367..8c6875bf54 100644
--- a/quantum/rgb_matrix/rgb_matrix.h
+++ b/quantum/rgb_matrix/rgb_matrix.h
@@ -47,15 +47,15 @@
#endif
#ifndef RGB_MATRIX_LED_PROCESS_LIMIT
-# define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5
+# define RGB_MATRIX_LED_PROCESS_LIMIT (RGB_MATRIX_LED_COUNT + 4) / 5
#endif
-#if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL
+#if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < RGB_MATRIX_LED_COUNT
# if defined(RGB_MATRIX_SPLIT)
# define RGB_MATRIX_USE_LIMITS(min, max) \
uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \
uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \
- if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; \
+ if (max > RGB_MATRIX_LED_COUNT) max = RGB_MATRIX_LED_COUNT; \
uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; \
if (is_keyboard_left() && (max > k_rgb_matrix_split[0])) max = k_rgb_matrix_split[0]; \
if (!(is_keyboard_left()) && (min < k_rgb_matrix_split[0])) min = k_rgb_matrix_split[0];
@@ -63,32 +63,32 @@
# define RGB_MATRIX_USE_LIMITS(min, max) \
uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \
uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \
- if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL;
+ if (max > RGB_MATRIX_LED_COUNT) max = RGB_MATRIX_LED_COUNT;
# endif
#else
# if defined(RGB_MATRIX_SPLIT)
# define RGB_MATRIX_USE_LIMITS(min, max) \
uint8_t min = 0; \
- uint8_t max = DRIVER_LED_TOTAL; \
+ uint8_t max = RGB_MATRIX_LED_COUNT; \
const uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; \
if (is_keyboard_left() && (max > k_rgb_matrix_split[0])) max = k_rgb_matrix_split[0]; \
if (!(is_keyboard_left()) && (min < k_rgb_matrix_split[0])) min = k_rgb_matrix_split[0];
# else
# define RGB_MATRIX_USE_LIMITS(min, max) \
uint8_t min = 0; \
- uint8_t max = DRIVER_LED_TOTAL;
+ uint8_t max = RGB_MATRIX_LED_COUNT;
# endif
#endif
#define RGB_MATRIX_INDICATOR_SET_COLOR(i, r, g, b) \
- if (i >= led_min && i <= led_max) { \
+ if (i >= led_min && i < led_max) { \
rgb_matrix_set_color(i, r, g, b); \
}
#define RGB_MATRIX_TEST_LED_FLAGS() \
if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) continue
-#define RGB_DISABLE_TIME_INFINITE (UINT32_MAX)
+#define RGB_MATRIX_TIMEOUT_INFINITE (UINT32_MAX)
enum rgb_matrix_effects {
RGB_MATRIX_NONE = 0,
@@ -134,12 +134,12 @@ void rgb_matrix_none_indicators_user(void);
// This runs after another backlight effect and replaces
// colors already set
void rgb_matrix_indicators(void);
-void rgb_matrix_indicators_kb(void);
-void rgb_matrix_indicators_user(void);
+bool rgb_matrix_indicators_kb(void);
+bool rgb_matrix_indicators_user(void);
void rgb_matrix_indicators_advanced(effect_params_t *params);
-void rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max);
-void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max);
+bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max);
+bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max);
void rgb_matrix_init(void);
@@ -187,13 +187,13 @@ void rgb_matrix_increase_speed_noeeprom(void);
void rgb_matrix_decrease_speed(void);
void rgb_matrix_decrease_speed_noeeprom(void);
led_flags_t rgb_matrix_get_flags(void);
-led_flags_t rgb_matrix_get_flags_noeeprom(void);
void rgb_matrix_set_flags(led_flags_t flags);
-#ifdef RGB_DISABLE_TIMEOUT
-# if RGB_DISABLE_TIMEOUT > 0
+void rgb_matrix_set_flags_noeeprom(led_flags_t flags);
+#ifdef RGB_MATRIX_TIMEOUT
+# if RGB_MATRIX_TIMEOUT > 0
void rgb_matrix_disable_timeout_set(uint32_t timeout);
void rgb_matrix_disable_time_reset(void);
-# endif
+# endif
#endif
#ifdef RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE
void rgb_matrix_driver_shutdown(void);
@@ -268,9 +268,9 @@ static inline bool rgb_matrix_check_finished_leds(uint8_t led_idx) {
uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT;
return led_idx < k_rgb_matrix_split[0];
} else
- return led_idx < DRIVER_LED_TOTAL;
+ return led_idx < RGB_MATRIX_LED_COUNT;
#else
- return led_idx < DRIVER_LED_TOTAL;
+ return led_idx < RGB_MATRIX_LED_COUNT;
#endif
}
diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c
index 4b02be98d2..86828020e4 100644
--- a/quantum/rgb_matrix/rgb_matrix_drivers.c
+++ b/quantum/rgb_matrix/rgb_matrix_drivers.c
@@ -76,6 +76,12 @@ static void init(void) {
IS31FL3737_init(DRIVER_ADDR_1);
# if defined(DRIVER_ADDR_2)
IS31FL3737_init(DRIVER_ADDR_2);
+# if defined(DRIVER_ADDR_3)
+ IS31FL3737_init(DRIVER_ADDR_3);
+# if defined(DRIVER_ADDR_4)
+ IS31FL3737_init(DRIVER_ADDR_4);
+# endif
+# endif
# endif
# elif defined(IS31FL3741)
@@ -111,7 +117,7 @@ static void init(void) {
# endif
# endif
- for (int index = 0; index < DRIVER_LED_TOTAL; index++) {
+ for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) {
bool enabled = true;
// This only caches it for later
@@ -159,6 +165,12 @@ static void init(void) {
IS31FL3737_update_led_control_registers(DRIVER_ADDR_1, 0);
# if defined(DRIVER_ADDR_2)
IS31FL3737_update_led_control_registers(DRIVER_ADDR_2, 1);
+# if defined(DRIVER_ADDR_3)
+ IS31FL3737_update_led_control_registers(DRIVER_ADDR_3, 2);
+# if defined(DRIVER_ADDR_4)
+ IS31FL3737_update_led_control_registers(DRIVER_ADDR_4, 3);
+# endif
+# endif
# endif
# elif defined(IS31FL3741)
@@ -240,6 +252,12 @@ static void flush(void) {
IS31FL3737_update_pwm_buffers(DRIVER_ADDR_1, 0);
# if defined(DRIVER_ADDR_2)
IS31FL3737_update_pwm_buffers(DRIVER_ADDR_2, 1);
+# if defined(DRIVER_ADDR_3)
+ IS31FL3737_update_pwm_buffers(DRIVER_ADDR_3, 2);
+# if defined(DRIVER_ADDR_4)
+ IS31FL3737_update_pwm_buffers(DRIVER_ADDR_4, 3);
+# endif
+# endif
# endif
}
@@ -381,13 +399,13 @@ const rgb_matrix_driver_t rgb_matrix_driver = {
# endif
// LED color buffer
-LED_TYPE rgb_matrix_ws2812_array[DRIVER_LED_TOTAL];
+LED_TYPE rgb_matrix_ws2812_array[RGB_MATRIX_LED_COUNT];
static void init(void) {}
static void flush(void) {
// Assumes use of RGB_DI_PIN
- ws2812_setleds(rgb_matrix_ws2812_array, DRIVER_LED_TOTAL);
+ ws2812_setleds(rgb_matrix_ws2812_array, RGB_MATRIX_LED_COUNT);
}
// Set an led in the buffer to a color
@@ -414,7 +432,7 @@ static inline void setled(int i, uint8_t r, uint8_t g, uint8_t b) {
}
static void setled_all(uint8_t r, uint8_t g, uint8_t b) {
- for (int i = 0; i < sizeof(rgb_matrix_ws2812_array) / sizeof(rgb_matrix_ws2812_array[0]); i++) {
+ for (int i = 0; i < ARRAY_SIZE(rgb_matrix_ws2812_array); i++) {
setled(i, r, g, b);
}
}
diff --git a/quantum/rgb_matrix/rgb_matrix_types.h b/quantum/rgb_matrix/rgb_matrix_types.h
index d0ac4e4466..eea603c41c 100644
--- a/quantum/rgb_matrix/rgb_matrix_types.h
+++ b/quantum/rgb_matrix/rgb_matrix_types.h
@@ -78,8 +78,8 @@ typedef struct PACKED {
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_point_t point[RGB_MATRIX_LED_COUNT];
+ uint8_t flags[RGB_MATRIX_LED_COUNT];
} led_config_t;
typedef union {