diff options
Diffstat (limited to 'quantum/rgb_matrix/rgb_matrix.h')
-rw-r--r-- | quantum/rgb_matrix/rgb_matrix.h | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h index f53e011c1..112dfaaae 100644 --- a/quantum/rgb_matrix/rgb_matrix.h +++ b/quantum/rgb_matrix/rgb_matrix.h | |||
@@ -48,14 +48,33 @@ | |||
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL | 50 | #if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL |
51 | # define RGB_MATRIX_USE_LIMITS(min, max) \ | 51 | # if defined(RGB_MATRIX_SPLIT) |
52 | uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \ | 52 | # define RGB_MATRIX_USE_LIMITS(min, max) \ |
53 | uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \ | 53 | uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \ |
54 | if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; | 54 | uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \ |
55 | if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; \ | ||
56 | uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; \ | ||
57 | if (is_keyboard_left() && (max > k_rgb_matrix_split[0])) max = k_rgb_matrix_split[0]; \ | ||
58 | if (!(is_keyboard_left()) && (min < k_rgb_matrix_split[0])) min = k_rgb_matrix_split[0]; | ||
59 | # else | ||
60 | # define RGB_MATRIX_USE_LIMITS(min, max) \ | ||
61 | uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \ | ||
62 | uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \ | ||
63 | if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; | ||
64 | # endif | ||
55 | #else | 65 | #else |
56 | # define RGB_MATRIX_USE_LIMITS(min, max) \ | 66 | # if defined(RGB_MATRIX_SPLIT) |
57 | uint8_t min = 0; \ | 67 | # define RGB_MATRIX_USE_LIMITS(min, max) \ |
58 | uint8_t max = DRIVER_LED_TOTAL; | 68 | uint8_t min = 0; \ |
69 | uint8_t max = DRIVER_LED_TOTAL; \ | ||
70 | const uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; \ | ||
71 | if (is_keyboard_left() && (max > k_rgb_matrix_split[0])) max = k_rgb_matrix_split[0]; \ | ||
72 | if (!(is_keyboard_left()) && (min < k_rgb_matrix_split[0])) min = k_rgb_matrix_split[0]; | ||
73 | # else | ||
74 | # define RGB_MATRIX_USE_LIMITS(min, max) \ | ||
75 | uint8_t min = 0; \ | ||
76 | uint8_t max = DRIVER_LED_TOTAL; | ||
77 | # endif | ||
59 | #endif | 78 | #endif |
60 | 79 | ||
61 | #define RGB_MATRIX_INDICATOR_SET_COLOR(i, r, g, b) \ | 80 | #define RGB_MATRIX_INDICATOR_SET_COLOR(i, r, g, b) \ |
@@ -214,6 +233,18 @@ typedef struct { | |||
214 | void (*flush)(void); | 233 | void (*flush)(void); |
215 | } rgb_matrix_driver_t; | 234 | } rgb_matrix_driver_t; |
216 | 235 | ||
236 | static inline bool rgb_matrix_check_finished_leds(uint8_t led_idx) { | ||
237 | #if defined(RGB_MATRIX_SPLIT) | ||
238 | if (is_keyboard_left()) { | ||
239 | uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; | ||
240 | return led_idx < k_rgb_matrix_split[0]; | ||
241 | } else | ||
242 | return led_idx < DRIVER_LED_TOTAL; | ||
243 | #else | ||
244 | return led_idx < DRIVER_LED_TOTAL; | ||
245 | #endif | ||
246 | } | ||
247 | |||
217 | extern const rgb_matrix_driver_t rgb_matrix_driver; | 248 | extern const rgb_matrix_driver_t rgb_matrix_driver; |
218 | 249 | ||
219 | extern rgb_config_t rgb_matrix_config; | 250 | extern rgb_config_t rgb_matrix_config; |