diff options
Diffstat (limited to 'quantum/rgb_matrix/rgb_matrix.h')
| -rw-r--r-- | quantum/rgb_matrix/rgb_matrix.h | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h index f53e011c1..a804d99ab 100644 --- a/quantum/rgb_matrix/rgb_matrix.h +++ b/quantum/rgb_matrix/rgb_matrix.h | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | #include "rgb_matrix_types.h" | 23 | #include "rgb_matrix_types.h" |
| 24 | #include "color.h" | 24 | #include "color.h" |
| 25 | #include "quantum.h" | 25 | #include "quantum.h" |
| 26 | #include "rgb_matrix_legacy_enables.h" | ||
| 27 | 26 | ||
| 28 | #ifdef IS31FL3731 | 27 | #ifdef IS31FL3731 |
| 29 | # include "is31fl3731.h" | 28 | # include "is31fl3731.h" |
| @@ -33,6 +32,8 @@ | |||
| 33 | # include "is31fl3737.h" | 32 | # include "is31fl3737.h" |
| 34 | #elif defined(IS31FL3741) | 33 | #elif defined(IS31FL3741) |
| 35 | # include "is31fl3741.h" | 34 | # include "is31fl3741.h" |
| 35 | #elif defined(CKLED2001) | ||
| 36 | # include "ckled2001.h" | ||
| 36 | #elif defined(AW20216) | 37 | #elif defined(AW20216) |
| 37 | # include "aw20216.h" | 38 | # include "aw20216.h" |
| 38 | #elif defined(WS2812) | 39 | #elif defined(WS2812) |
| @@ -48,14 +49,33 @@ | |||
| 48 | #endif | 49 | #endif |
| 49 | 50 | ||
| 50 | #if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL | 51 | #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) \ | 52 | # if defined(RGB_MATRIX_SPLIT) |
| 52 | uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \ | 53 | # define RGB_MATRIX_USE_LIMITS(min, max) \ |
| 53 | uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \ | 54 | uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \ |
| 54 | if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; | 55 | uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \ |
| 56 | if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; \ | ||
| 57 | uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; \ | ||
| 58 | if (is_keyboard_left() && (max > k_rgb_matrix_split[0])) max = k_rgb_matrix_split[0]; \ | ||
| 59 | if (!(is_keyboard_left()) && (min < k_rgb_matrix_split[0])) min = k_rgb_matrix_split[0]; | ||
| 60 | # else | ||
| 61 | # define RGB_MATRIX_USE_LIMITS(min, max) \ | ||
| 62 | uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \ | ||
| 63 | uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \ | ||
| 64 | if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; | ||
| 65 | # endif | ||
| 55 | #else | 66 | #else |
| 56 | # define RGB_MATRIX_USE_LIMITS(min, max) \ | 67 | # if defined(RGB_MATRIX_SPLIT) |
| 57 | uint8_t min = 0; \ | 68 | # define RGB_MATRIX_USE_LIMITS(min, max) \ |
| 58 | uint8_t max = DRIVER_LED_TOTAL; | 69 | uint8_t min = 0; \ |
| 70 | uint8_t max = DRIVER_LED_TOTAL; \ | ||
| 71 | const uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; \ | ||
| 72 | if (is_keyboard_left() && (max > k_rgb_matrix_split[0])) max = k_rgb_matrix_split[0]; \ | ||
| 73 | if (!(is_keyboard_left()) && (min < k_rgb_matrix_split[0])) min = k_rgb_matrix_split[0]; | ||
| 74 | # else | ||
| 75 | # define RGB_MATRIX_USE_LIMITS(min, max) \ | ||
| 76 | uint8_t min = 0; \ | ||
| 77 | uint8_t max = DRIVER_LED_TOTAL; | ||
| 78 | # endif | ||
| 59 | #endif | 79 | #endif |
| 60 | 80 | ||
| 61 | #define RGB_MATRIX_INDICATOR_SET_COLOR(i, r, g, b) \ | 81 | #define RGB_MATRIX_INDICATOR_SET_COLOR(i, r, g, b) \ |
| @@ -214,6 +234,18 @@ typedef struct { | |||
| 214 | void (*flush)(void); | 234 | void (*flush)(void); |
| 215 | } rgb_matrix_driver_t; | 235 | } rgb_matrix_driver_t; |
| 216 | 236 | ||
| 237 | static inline bool rgb_matrix_check_finished_leds(uint8_t led_idx) { | ||
| 238 | #if defined(RGB_MATRIX_SPLIT) | ||
| 239 | if (is_keyboard_left()) { | ||
| 240 | uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; | ||
| 241 | return led_idx < k_rgb_matrix_split[0]; | ||
| 242 | } else | ||
| 243 | return led_idx < DRIVER_LED_TOTAL; | ||
| 244 | #else | ||
| 245 | return led_idx < DRIVER_LED_TOTAL; | ||
| 246 | #endif | ||
| 247 | } | ||
| 248 | |||
| 217 | extern const rgb_matrix_driver_t rgb_matrix_driver; | 249 | extern const rgb_matrix_driver_t rgb_matrix_driver; |
| 218 | 250 | ||
| 219 | extern rgb_config_t rgb_matrix_config; | 251 | extern rgb_config_t rgb_matrix_config; |
