From 9632360caa5e6511b0ec13cb4c55eb64408232b5 Mon Sep 17 00:00:00 2001
From: Jeff Epler <jepler@gmail.com>
Date: Tue, 30 Aug 2022 03:20:04 -0500
Subject: Use a macro to compute the size of arrays at compile time (#18044)

* Add ARRAY_SIZE and CEILING utility macros

* Apply a coccinelle patch to use ARRAY_SIZE

* fix up some straggling items

* Fix 'make test:secure'

* Enhance ARRAY_SIZE macro to reject acting on pointers

The previous definition would not produce a diagnostic for
```
int *p;
size_t num_elem = ARRAY_SIZE(p)
```
but the new one will.

* explicitly get definition of ARRAY_SIZE

* Convert to ARRAY_SIZE when const is involved

The following spatch finds additional instances where the array is
const and the division is by the size of the type, not the size of
the first element:
```
@ rule5a using "empty.iso" @
type T;
const T[] E;
@@

- (sizeof(E)/sizeof(T))
+ ARRAY_SIZE(E)

@ rule6a using "empty.iso" @
type T;
const T[] E;
@@

- sizeof(E)/sizeof(T)
+ ARRAY_SIZE(E)
```

* New instances of ARRAY_SIZE added since initial spatch run

* Use `ARRAY_SIZE` in docs (found by grep)

* Manually use ARRAY_SIZE

hs_set is expected to be the same size as uint16_t, though it's made
of two 8-bit integers

* Just like char, sizeof(uint8_t) is guaranteed to be 1

This is at least true on any plausible system where qmk is actually used.

Per my understanding it's universally true, assuming that uint8_t exists:
https://stackoverflow.com/questions/48655310/can-i-assume-that-sizeofuint8-t-1

* Run qmk-format on core C files touched in this branch

Co-authored-by: Stefan Kerkmann <karlk90@pm.me>
---
 quantum/rgb_matrix/rgb_matrix_drivers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'quantum/rgb_matrix')

diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c
index 27fa7369bf..99151e5a92 100644
--- a/quantum/rgb_matrix/rgb_matrix_drivers.c
+++ b/quantum/rgb_matrix/rgb_matrix_drivers.c
@@ -369,7 +369,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);
     }
 }
-- 
cgit v1.2.3


From 36c410592dbd35da33ccc5fd6d2a5cbf4b25a708 Mon Sep 17 00:00:00 2001
From: Ryan <fauxpark@gmail.com>
Date: Fri, 23 Sep 2022 22:46:23 +1000
Subject: Change `DRIVER_LED_COUNT` to `{LED,RGB}_MATRIX_LED_COUNT` (#18399)

---
 quantum/rgb_matrix/animations/jellybean_raindrops_anim.h |  2 +-
 quantum/rgb_matrix/animations/pixel_flow_anim.h          |  4 ++--
 quantum/rgb_matrix/animations/pixel_rain_anim.h          |  2 +-
 quantum/rgb_matrix/animations/raindrops_anim.h           |  2 +-
 quantum/rgb_matrix/rgb_matrix.c                          |  8 ++++----
 quantum/rgb_matrix/rgb_matrix.h                          | 16 ++++++++--------
 quantum/rgb_matrix/rgb_matrix_drivers.c                  |  6 +++---
 quantum/rgb_matrix/rgb_matrix_types.h                    |  4 ++--
 8 files changed, 22 insertions(+), 22 deletions(-)

(limited to 'quantum/rgb_matrix')

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/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c
index 2730686839..ae61e75535 100644
--- a/quantum/rgb_matrix/rgb_matrix.c
+++ b/quantum/rgb_matrix/rgb_matrix.c
@@ -202,7 +202,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);
@@ -461,13 +461,13 @@ 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);
diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h
index fc9fc3e020..0b35e98f45 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,20 +63,20 @@
 #        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
 
@@ -246,9 +246,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 99151e5a92..e75b2c6c9d 100644
--- a/quantum/rgb_matrix/rgb_matrix_drivers.c
+++ b/quantum/rgb_matrix/rgb_matrix_drivers.c
@@ -106,7 +106,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
@@ -336,13 +336,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
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 {
-- 
cgit v1.2.3


From ea2819b2c2f1fbb9bf85010602758166530939ce Mon Sep 17 00:00:00 2001
From: Ryan <fauxpark@gmail.com>
Date: Mon, 26 Sep 2022 14:40:15 +1000
Subject: Change `{LED,RGB}_DISABLE_TIMEOUT` to `{LED,RGB}_MATRIX_TIMEOUT`
 (#18415)

---
 quantum/rgb_matrix/rgb_matrix.c | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

(limited to 'quantum/rgb_matrix')

diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c
index ae61e75535..8b335c017d 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
@@ -126,9 +122,9 @@ 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;
-#endif // RGB_DISABLE_TIMEOUT > 0
+#endif // RGB_MATRIX_TIMEOUT > 0
 
 // double buffers
 static uint32_t rgb_timer_buffer;
@@ -213,9 +209,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];
@@ -296,17 +292,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
@@ -419,9 +415,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 > (uint32_t)RGB_DISABLE_TIMEOUT) ||
-#endif // RGB_DISABLE_TIMEOUT > 0
+#if RGB_MATRIX_TIMEOUT > 0
+                             (rgb_anykey_timer > (uint32_t)RGB_MATRIX_TIMEOUT) ||
+#endif // RGB_MATRIX_TIMEOUT > 0
                              false;
 
     uint8_t effect = suspend_backlight || !rgb_matrix_config.enable ? 0 : rgb_matrix_config.mode;
-- 
cgit v1.2.3


From 64b1ed45507a15d5594b1f90b936c2096918f5a4 Mon Sep 17 00:00:00 2001
From: Drashna Jaelre <drashna@live.com>
Date: Tue, 4 Oct 2022 15:24:22 -0700
Subject: Fix Per Key LED Indicator Callbacks  (#18450)

Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
Co-authored-by: Nick Brassel <nick@tzarc.org>
---
 quantum/rgb_matrix/rgb_matrix.c | 18 ++++++++++++------
 quantum/rgb_matrix/rgb_matrix.h |  8 ++++----
 2 files changed, 16 insertions(+), 10 deletions(-)

(limited to 'quantum/rgb_matrix')

diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c
index 8b335c017d..539ca0e100 100644
--- a/quantum/rgb_matrix/rgb_matrix.c
+++ b/quantum/rgb_matrix/rgb_matrix.c
@@ -444,12 +444,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.
@@ -466,12 +469,15 @@ void rgb_matrix_indicators_advanced(effect_params_t *params) {
     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();
diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h
index 0b35e98f45..1cd054abc4 100644
--- a/quantum/rgb_matrix/rgb_matrix.h
+++ b/quantum/rgb_matrix/rgb_matrix.h
@@ -129,12 +129,12 @@ void rgb_matrix_task(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);
 
-- 
cgit v1.2.3


From 41159326ca7c366b50edad1392369131c4ce4008 Mon Sep 17 00:00:00 2001
From: James Thomson <thomsj@users.noreply.github.com>
Date: Tue, 11 Oct 2022 19:33:02 +0100
Subject: Fix boundary in `RGB_MATRIX_INDICATOR_SET_COLOR` (#18650)

---
 quantum/rgb_matrix/rgb_matrix.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'quantum/rgb_matrix')

diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h
index 1cd054abc4..e1bdad42e0 100644
--- a/quantum/rgb_matrix/rgb_matrix.h
+++ b/quantum/rgb_matrix/rgb_matrix.h
@@ -81,7 +81,7 @@
 #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);          \
     }
 
-- 
cgit v1.2.3


From 9d4c4ceee13bfa229de6be2255e83c9c324259d6 Mon Sep 17 00:00:00 2001
From: Jamal Bouajjaj <develop@electro707.com>
Date: Mon, 17 Oct 2022 17:26:58 -0400
Subject: 4 Driver support for IS31FL3737 (#18750)

* Added 4 driver support for the IS31FL3737 LED driver

* Updated docs for IS31FL3737 to support 4 drivers
---
 quantum/rgb_matrix/rgb_matrix_drivers.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

(limited to 'quantum/rgb_matrix')

diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c
index e75b2c6c9d..b4d23f8201 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)
@@ -154,6 +160,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)
@@ -235,6 +247,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
 }
 
-- 
cgit v1.2.3


From e59cb51be01cf0428524596490eb1bff91e566bd Mon Sep 17 00:00:00 2001
From: QMK Bot <hello@qmk.fm>
Date: Mon, 17 Oct 2022 14:29:19 -0700
Subject: [CI] Format code according to conventions (#18756)

---
 quantum/rgb_matrix/rgb_matrix_drivers.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

(limited to 'quantum/rgb_matrix')

diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c
index b4d23f8201..5b81915845 100644
--- a/quantum/rgb_matrix/rgb_matrix_drivers.c
+++ b/quantum/rgb_matrix/rgb_matrix_drivers.c
@@ -76,12 +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)
+#            if defined(DRIVER_ADDR_3)
     IS31FL3737_init(DRIVER_ADDR_3);
-#               if defined(DRIVER_ADDR_4)
+#                if defined(DRIVER_ADDR_4)
     IS31FL3737_init(DRIVER_ADDR_4);
-#               endif
-#           endif
+#                endif
+#            endif
 #        endif
 
 #    elif defined(IS31FL3741)
@@ -160,12 +160,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)
+#            if defined(DRIVER_ADDR_3)
     IS31FL3737_update_led_control_registers(DRIVER_ADDR_3, 2);
-#               if defined(DRIVER_ADDR_4)
+#                if defined(DRIVER_ADDR_4)
     IS31FL3737_update_led_control_registers(DRIVER_ADDR_4, 3);
-#               endif
-#           endif
+#                endif
+#            endif
 #        endif
 
 #    elif defined(IS31FL3741)
@@ -247,12 +247,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)
+#            if defined(DRIVER_ADDR_3)
     IS31FL3737_update_pwm_buffers(DRIVER_ADDR_3, 2);
-#               if defined(DRIVER_ADDR_4)
+#                if defined(DRIVER_ADDR_4)
     IS31FL3737_update_pwm_buffers(DRIVER_ADDR_4, 3);
-#               endif
-#           endif
+#                endif
+#            endif
 #        endif
 }
 
-- 
cgit v1.2.3


From 8e0945c82224ca2fdcc21eb7184520f879804fb6 Mon Sep 17 00:00:00 2001
From: Joel Challis <git@zvecr.com>
Date: Thu, 27 Oct 2022 09:52:51 +0100
Subject: Fix rgb_matrix_set_flags_noeeprom declaration (#18860)

---
 quantum/rgb_matrix/rgb_matrix.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'quantum/rgb_matrix')

diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h
index e1bdad42e0..62078f6e60 100644
--- a/quantum/rgb_matrix/rgb_matrix.h
+++ b/quantum/rgb_matrix/rgb_matrix.h
@@ -182,8 +182,8 @@ 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);
+void        rgb_matrix_set_flags_noeeprom(led_flags_t flags);
 
 #ifndef RGBLIGHT_ENABLE
 #    define eeconfig_update_rgblight_current eeconfig_update_rgb_matrix
-- 
cgit v1.2.3


From e12ca14af8fc1799357bbfffd156d53b4a51001c Mon Sep 17 00:00:00 2001
From: Ryan <fauxpark@gmail.com>
Date: Sun, 27 Nov 2022 04:18:24 +1100
Subject: Change `RGB_MATRIX_STARTUP_*` defines to `RGB_MATRIX_DEFAULT_*`
 (#19079)

---
 quantum/rgb_matrix/rgb_matrix.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

(limited to 'quantum/rgb_matrix')

diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c
index 539ca0e100..e7125bb87f 100644
--- a/quantum/rgb_matrix/rgb_matrix.c
+++ b/quantum/rgb_matrix/rgb_matrix.c
@@ -81,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
 
 // globals
@@ -146,9 +146,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);
 }
-- 
cgit v1.2.3