diff options
| author | Ryan <fauxpark@gmail.com> | 2021-04-22 19:21:13 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-22 19:21:13 +1000 |
| commit | d6ab908272e7f8f391b19aee0c8a9dce9b24f511 (patch) | |
| tree | fa25f706d1a11c5ebea4c03b59d217542ab47475 /quantum/led_matrix.c | |
| parent | 5d458c6c8ae6dcddec7dde87087b5169673ce69c (diff) | |
| download | qmk_firmware-d6ab908272e7f8f391b19aee0c8a9dce9b24f511.tar.gz qmk_firmware-d6ab908272e7f8f391b19aee0c8a9dce9b24f511.zip | |
LED Matrix: Split (#12633)
Diffstat (limited to 'quantum/led_matrix.c')
| -rw-r--r-- | quantum/led_matrix.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/quantum/led_matrix.c b/quantum/led_matrix.c index 69600c498..890573022 100644 --- a/quantum/led_matrix.c +++ b/quantum/led_matrix.c | |||
| @@ -90,6 +90,11 @@ static uint32_t led_timer_buffer; | |||
| 90 | static last_hit_t last_hit_buffer; | 90 | static last_hit_t last_hit_buffer; |
| 91 | #endif // LED_MATRIX_KEYREACTIVE_ENABLED | 91 | #endif // LED_MATRIX_KEYREACTIVE_ENABLED |
| 92 | 92 | ||
| 93 | // split led matrix | ||
| 94 | #if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) | ||
| 95 | const uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT; | ||
| 96 | #endif | ||
| 97 | |||
| 93 | void eeconfig_read_led_matrix(void) { eeprom_read_block(&led_matrix_eeconfig, EECONFIG_LED_MATRIX, sizeof(led_matrix_eeconfig)); } | 98 | void eeconfig_read_led_matrix(void) { eeprom_read_block(&led_matrix_eeconfig, EECONFIG_LED_MATRIX, sizeof(led_matrix_eeconfig)); } |
| 94 | 99 | ||
| 95 | void eeconfig_update_led_matrix(void) { eeprom_update_block(&led_matrix_eeconfig, EECONFIG_LED_MATRIX, sizeof(led_matrix_eeconfig)); } | 100 | void eeconfig_update_led_matrix(void) { eeprom_update_block(&led_matrix_eeconfig, EECONFIG_LED_MATRIX, sizeof(led_matrix_eeconfig)); } |
| @@ -128,22 +133,38 @@ uint8_t led_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *l | |||
| 128 | void led_matrix_update_pwm_buffers(void) { led_matrix_driver.flush(); } | 133 | void led_matrix_update_pwm_buffers(void) { led_matrix_driver.flush(); } |
| 129 | 134 | ||
| 130 | void led_matrix_set_value(int index, uint8_t value) { | 135 | void led_matrix_set_value(int index, uint8_t value) { |
| 131 | #ifdef USE_CIE1931_CURVE | 136 | #if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) |
| 132 | led_matrix_driver.set_value(index, pgm_read_byte(&CIE1931_CURVE[value])); | 137 | if (!is_keyboard_left() && index >= k_led_matrix_split[0]) |
| 133 | #else | 138 | # ifdef USE_CIE1931_CURVE |
| 134 | led_matrix_driver.set_value(index, value); | 139 | led_matrix_driver.set_value(index - k_led_matrix_split[0], pgm_read_byte(&CIE1931_CURVE[value])); |
| 140 | # else | ||
| 141 | led_matrix_driver.set_value(index - k_led_matrix_split[0], value); | ||
| 142 | # endif | ||
| 143 | else if (is_keyboard_left() && index < k_led_matrix_split[0]) | ||
| 135 | #endif | 144 | #endif |
| 145 | # ifdef USE_CIE1931_CURVE | ||
| 146 | led_matrix_driver.set_value(index, pgm_read_byte(&CIE1931_CURVE[value])); | ||
| 147 | # else | ||
| 148 | led_matrix_driver.set_value(index, value); | ||
| 149 | # endif | ||
| 136 | } | 150 | } |
| 137 | 151 | ||
| 138 | void led_matrix_set_value_all(uint8_t value) { | 152 | void led_matrix_set_value_all(uint8_t value) { |
| 139 | #ifdef USE_CIE1931_CURVE | 153 | #if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) |
| 140 | led_matrix_driver.set_value_all(pgm_read_byte(&CIE1931_CURVE[value])); | 154 | for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) led_matrix_set_value(i, value); |
| 141 | #else | 155 | #else |
| 156 | # ifdef USE_CIE1931_CURVE | ||
| 157 | led_matrix_driver.set_value_all(pgm_read_byte(&CIE1931_CURVE[value])); | ||
| 158 | # else | ||
| 142 | led_matrix_driver.set_value_all(value); | 159 | led_matrix_driver.set_value_all(value); |
| 160 | # endif | ||
| 143 | #endif | 161 | #endif |
| 144 | } | 162 | } |
| 145 | 163 | ||
| 146 | void process_led_matrix(uint8_t row, uint8_t col, bool pressed) { | 164 | void process_led_matrix(uint8_t row, uint8_t col, bool pressed) { |
| 165 | #ifndef LED_MATRIX_SPLIT | ||
| 166 | if (!is_keyboard_master()) return; | ||
| 167 | #endif | ||
| 147 | #if LED_DISABLE_TIMEOUT > 0 | 168 | #if LED_DISABLE_TIMEOUT > 0 |
| 148 | led_anykey_timer = 0; | 169 | led_anykey_timer = 0; |
| 149 | #endif // LED_DISABLE_TIMEOUT > 0 | 170 | #endif // LED_DISABLE_TIMEOUT > 0 |
