summaryrefslogtreecommitdiffstats
path: root/quantum/led_matrix/led_matrix.h
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/led_matrix/led_matrix.h')
-rw-r--r--quantum/led_matrix/led_matrix.h46
1 files changed, 38 insertions, 8 deletions
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;