diff options
| author | Vlad K <vkvitnevski@gmail.com> | 2021-11-01 15:04:37 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-02 09:04:37 +1100 |
| commit | a29ca1e7f1a5addfde163b158399684505453fc9 (patch) | |
| tree | 3a98dc034d034c4a5e8a30b1e744d7793ecbc00b /quantum/led_matrix/led_matrix.h | |
| parent | 7f8faa429e0c0662cec34a7d60e33ca58333d6d7 (diff) | |
| download | qmk_firmware-a29ca1e7f1a5addfde163b158399684505453fc9.tar.gz qmk_firmware-a29ca1e7f1a5addfde163b158399684505453fc9.zip | |
Add support for ISSI drivers on both sides of a split keyboard (#13842)
* Gets RGB working on a split keyboard with IS31FL3733. Currently needs small tweak to re-enable WS2812
* Added helper function
* Trying to integrate the function
* Moved functionality into a macro
* Swapped conditional for a macro everywhere
* Tidying up
* More code cleanup
* Documentation updates
* Fixed formatting via linter
* Switching to a function from a macro
* Fixed compile error
* Fixing WS2812 behavior. UNTESTED.
* Updated documentation about the driver addresses.
* Fixed code for WS2812
* Trying to add in LED_MATRIX support
* Updated effects for LED matrix
* Updated third-party effect defines.
* Ran format-c on modified files
* Apply suggestions from code review
Co-authored-by: Ryan <fauxpark@gmail.com>
* Move to static inline. Avoids issues with gcc v8+
* Move helper function for LED_matrix to static inline to avoid issues with gcc v8+
Co-authored-by: Vlad Kvitnevskiy <vladkvit@outlook.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'quantum/led_matrix/led_matrix.h')
| -rw-r--r-- | quantum/led_matrix/led_matrix.h | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h index a7a1c983f..f540be44c 100644 --- a/quantum/led_matrix/led_matrix.h +++ b/quantum/led_matrix/led_matrix.h | |||
| @@ -38,14 +38,33 @@ | |||
| 38 | #endif | 38 | #endif |
| 39 | 39 | ||
| 40 | #if defined(LED_MATRIX_LED_PROCESS_LIMIT) && LED_MATRIX_LED_PROCESS_LIMIT > 0 && LED_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL | 40 | #if defined(LED_MATRIX_LED_PROCESS_LIMIT) && LED_MATRIX_LED_PROCESS_LIMIT > 0 && LED_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL |
| 41 | # define LED_MATRIX_USE_LIMITS(min, max) \ | 41 | # if defined(LED_MATRIX_SPLIT) |
| 42 | uint8_t min = LED_MATRIX_LED_PROCESS_LIMIT * params->iter; \ | 42 | # define LED_MATRIX_USE_LIMITS(min, max) |
| 43 | uint8_t max = min + LED_MATRIX_LED_PROCESS_LIMIT; \ | 43 | uint8_t min = LED_MATRIX_LED_PROCESS_LIMIT * params->iter; |
| 44 | if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; | 44 | uint8_t max = min + LED_MATRIX_LED_PROCESS_LIMIT; |
| 45 | if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; | ||
| 46 | uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT; | ||
| 47 | if (is_keyboard_left() && (max > k_led_matrix_split[0])) max = k_led_matrix_split[0]; | ||
| 48 | if (!(is_keyboard_left()) && (min < k_led_matrix_split[0])) min = k_led_matrix_split[0]; | ||
| 49 | # else | ||
| 50 | # define LED_MATRIX_USE_LIMITS(min, max) \ | ||
| 51 | uint8_t min = LED_MATRIX_LED_PROCESS_LIMIT * params->iter; \ | ||
| 52 | uint8_t max = min + LED_MATRIX_LED_PROCESS_LIMIT; \ | ||
| 53 | if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; | ||
| 54 | # endif | ||
| 45 | #else | 55 | #else |
| 46 | # define LED_MATRIX_USE_LIMITS(min, max) \ | 56 | # if defined(LED_MATRIX_SPLIT) |
| 47 | uint8_t min = 0; \ | 57 | # define LED_MATRIX_USE_LIMITS(min, max) \ |
| 48 | uint8_t max = DRIVER_LED_TOTAL; | 58 | uint8_t min = 0; \ |
| 59 | uint8_t max = DRIVER_LED_TOTAL; \ | ||
| 60 | const uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT; \ | ||
| 61 | if (is_keyboard_left() && (max > k_led_matrix_split[0])) max = k_led_matrix_split[0]; \ | ||
| 62 | if (!(is_keyboard_left()) && (min < k_led_matrix_split[0])) min = k_led_matrix_split[0]; | ||
| 63 | # else | ||
| 64 | # define LED_MATRIX_USE_LIMITS(min, max) \ | ||
| 65 | uint8_t min = 0; \ | ||
| 66 | uint8_t max = DRIVER_LED_TOTAL; | ||
| 67 | # endif | ||
| 49 | #endif | 68 | #endif |
| 50 | 69 | ||
| 51 | #define LED_MATRIX_TEST_LED_FLAGS() \ | 70 | #define LED_MATRIX_TEST_LED_FLAGS() \ |
| @@ -147,6 +166,18 @@ typedef struct { | |||
| 147 | void (*flush)(void); | 166 | void (*flush)(void); |
| 148 | } led_matrix_driver_t; | 167 | } led_matrix_driver_t; |
| 149 | 168 | ||
| 169 | static inline bool led_matrix_check_finished_leds(uint8_t led_idx) { | ||
| 170 | #if defined(LED_MATRIX_SPLIT) | ||
| 171 | if (is_keyboard_left()) { | ||
| 172 | uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT; | ||
| 173 | return led_idx < k_led_matrix_split[0]; | ||
| 174 | } else | ||
| 175 | return led_idx < DRIVER_LED_TOTAL; | ||
| 176 | #else | ||
| 177 | return led_idx < DRIVER_LED_TOTAL; | ||
| 178 | #endif | ||
| 179 | } | ||
| 180 | |||
| 150 | extern const led_matrix_driver_t led_matrix_driver; | 181 | extern const led_matrix_driver_t led_matrix_driver; |
| 151 | 182 | ||
| 152 | extern led_eeconfig_t led_matrix_eeconfig; | 183 | extern led_eeconfig_t led_matrix_eeconfig; |
