summaryrefslogtreecommitdiff
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.h45
1 files changed, 38 insertions, 7 deletions
diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h
index a7a1c983f7..5386744430 100644
--- a/quantum/led_matrix/led_matrix.h
+++ b/quantum/led_matrix/led_matrix.h
@@ -38,14 +38,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 +166,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;