diff options
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/quantum.c | 10 | ||||
| -rw-r--r-- | quantum/rgb_matrix.c | 19 | ||||
| -rw-r--r-- | quantum/rgb_matrix.h | 2 | ||||
| -rw-r--r-- | quantum/rgb_matrix_animations/typing_heatmap_anim.h | 4 | ||||
| -rw-r--r-- | quantum/split_common/matrix.c | 4 | ||||
| -rw-r--r-- | quantum/split_common/transport.c | 37 | ||||
| -rw-r--r-- | quantum/split_common/transport.h | 4 |
7 files changed, 43 insertions, 37 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c index 6d202c515..38234bb17 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -221,9 +221,6 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 221 | #ifdef HAPTIC_ENABLE | 221 | #ifdef HAPTIC_ENABLE |
| 222 | process_haptic(keycode, record) && | 222 | process_haptic(keycode, record) && |
| 223 | #endif // HAPTIC_ENABLE | 223 | #endif // HAPTIC_ENABLE |
| 224 | #if defined(RGB_MATRIX_ENABLE) | ||
| 225 | process_rgb_matrix(keycode, record) && | ||
| 226 | #endif | ||
| 227 | #if defined(VIA_ENABLE) | 224 | #if defined(VIA_ENABLE) |
| 228 | process_record_via(keycode, record) && | 225 | process_record_via(keycode, record) && |
| 229 | #endif | 226 | #endif |
| @@ -624,9 +621,6 @@ void matrix_init_quantum() { | |||
| 624 | #ifdef AUDIO_ENABLE | 621 | #ifdef AUDIO_ENABLE |
| 625 | audio_init(); | 622 | audio_init(); |
| 626 | #endif | 623 | #endif |
| 627 | #ifdef RGB_MATRIX_ENABLE | ||
| 628 | rgb_matrix_init(); | ||
| 629 | #endif | ||
| 630 | #if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) | 624 | #if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) |
| 631 | unicode_input_mode_init(); | 625 | unicode_input_mode_init(); |
| 632 | #endif | 626 | #endif |
| @@ -681,10 +675,6 @@ void matrix_scan_quantum() { | |||
| 681 | led_matrix_task(); | 675 | led_matrix_task(); |
| 682 | #endif | 676 | #endif |
| 683 | 677 | ||
| 684 | #ifdef RGB_MATRIX_ENABLE | ||
| 685 | rgb_matrix_task(); | ||
| 686 | #endif | ||
| 687 | |||
| 688 | #ifdef WPM_ENABLE | 678 | #ifdef WPM_ENABLE |
| 689 | decay_wpm(); | 679 | decay_wpm(); |
| 690 | #endif | 680 | #endif |
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index a945df68e..ec17b4d72 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix.c | |||
| @@ -184,11 +184,12 @@ void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | |||
| 184 | 184 | ||
| 185 | void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { rgb_matrix_driver.set_color_all(red, green, blue); } | 185 | void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { rgb_matrix_driver.set_color_all(red, green, blue); } |
| 186 | 186 | ||
| 187 | bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) { | 187 | void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) { |
| 188 | #ifndef RGB_MATRIX_SPLIT | ||
| 189 | if (!is_keyboard_master()) return; | ||
| 190 | #endif | ||
| 188 | #if RGB_DISABLE_TIMEOUT > 0 | 191 | #if RGB_DISABLE_TIMEOUT > 0 |
| 189 | if (record->event.pressed) { | 192 | rgb_anykey_timer = 0; |
| 190 | rgb_anykey_timer = 0; | ||
| 191 | } | ||
| 192 | #endif // RGB_DISABLE_TIMEOUT > 0 | 193 | #endif // RGB_DISABLE_TIMEOUT > 0 |
| 193 | 194 | ||
| 194 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED | 195 | #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED |
| @@ -196,12 +197,12 @@ bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) { | |||
| 196 | uint8_t led_count = 0; | 197 | uint8_t led_count = 0; |
| 197 | 198 | ||
| 198 | # if defined(RGB_MATRIX_KEYRELEASES) | 199 | # if defined(RGB_MATRIX_KEYRELEASES) |
| 199 | if (!record->event.pressed) | 200 | if (!pressed) |
| 200 | # elif defined(RGB_MATRIX_KEYPRESSES) | 201 | # elif defined(RGB_MATRIX_KEYPRESSES) |
| 201 | if (record->event.pressed) | 202 | if (pressed) |
| 202 | # endif // defined(RGB_MATRIX_KEYRELEASES) | 203 | # endif // defined(RGB_MATRIX_KEYRELEASES) |
| 203 | { | 204 | { |
| 204 | led_count = rgb_matrix_map_row_column_to_led(record->event.key.row, record->event.key.col, led); | 205 | led_count = rgb_matrix_map_row_column_to_led(row, col, led); |
| 205 | } | 206 | } |
| 206 | 207 | ||
| 207 | if (last_hit_buffer.count + led_count > LED_HITS_TO_REMEMBER) { | 208 | if (last_hit_buffer.count + led_count > LED_HITS_TO_REMEMBER) { |
| @@ -224,11 +225,9 @@ bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) { | |||
| 224 | 225 | ||
| 225 | #if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP) | 226 | #if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP) |
| 226 | if (rgb_matrix_config.mode == RGB_MATRIX_TYPING_HEATMAP) { | 227 | if (rgb_matrix_config.mode == RGB_MATRIX_TYPING_HEATMAP) { |
| 227 | process_rgb_matrix_typing_heatmap(record); | 228 | process_rgb_matrix_typing_heatmap(row, col); |
| 228 | } | 229 | } |
| 229 | #endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP) | 230 | #endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP) |
| 230 | |||
| 231 | return true; | ||
| 232 | } | 231 | } |
| 233 | 232 | ||
| 234 | void rgb_matrix_test(void) { | 233 | void rgb_matrix_test(void) { |
diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h index 8c80c1bff..bb8bcfab6 100644 --- a/quantum/rgb_matrix.h +++ b/quantum/rgb_matrix.h | |||
| @@ -98,7 +98,7 @@ uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *l | |||
| 98 | void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); | 98 | void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); |
| 99 | void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue); | 99 | void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue); |
| 100 | 100 | ||
| 101 | bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record); | 101 | void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed); |
| 102 | 102 | ||
| 103 | void rgb_matrix_task(void); | 103 | void rgb_matrix_task(void); |
| 104 | 104 | ||
diff --git a/quantum/rgb_matrix_animations/typing_heatmap_anim.h b/quantum/rgb_matrix_animations/typing_heatmap_anim.h index e06437bf7..e7dda11a2 100644 --- a/quantum/rgb_matrix_animations/typing_heatmap_anim.h +++ b/quantum/rgb_matrix_animations/typing_heatmap_anim.h | |||
| @@ -6,9 +6,7 @@ RGB_MATRIX_EFFECT(TYPING_HEATMAP) | |||
| 6 | # define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 25 | 6 | # define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 25 |
| 7 | # endif | 7 | # endif |
| 8 | 8 | ||
| 9 | void process_rgb_matrix_typing_heatmap(keyrecord_t* record) { | 9 | void process_rgb_matrix_typing_heatmap(uint8_t row, uint8_t col) { |
| 10 | uint8_t row = record->event.key.row; | ||
| 11 | uint8_t col = record->event.key.col; | ||
| 12 | uint8_t m_row = row - 1; | 10 | uint8_t m_row = row - 1; |
| 13 | uint8_t p_row = row + 1; | 11 | uint8_t p_row = row + 1; |
| 14 | uint8_t m_col = col - 1; | 12 | uint8_t m_col = col - 1; |
diff --git a/quantum/split_common/matrix.c b/quantum/split_common/matrix.c index bad762b49..d6636b886 100644 --- a/quantum/split_common/matrix.c +++ b/quantum/split_common/matrix.c | |||
| @@ -257,7 +257,7 @@ bool matrix_post_scan(void) { | |||
| 257 | static uint8_t error_count; | 257 | static uint8_t error_count; |
| 258 | 258 | ||
| 259 | matrix_row_t slave_matrix[ROWS_PER_HAND] = {0}; | 259 | matrix_row_t slave_matrix[ROWS_PER_HAND] = {0}; |
| 260 | if (!transport_master(slave_matrix)) { | 260 | if (!transport_master(matrix + thisHand, slave_matrix)) { |
| 261 | error_count++; | 261 | error_count++; |
| 262 | 262 | ||
| 263 | if (error_count > ERROR_DISCONNECT_COUNT) { | 263 | if (error_count > ERROR_DISCONNECT_COUNT) { |
| @@ -282,7 +282,7 @@ bool matrix_post_scan(void) { | |||
| 282 | 282 | ||
| 283 | matrix_scan_quantum(); | 283 | matrix_scan_quantum(); |
| 284 | } else { | 284 | } else { |
| 285 | transport_slave(matrix + thisHand); | 285 | transport_slave(matrix + thatHand, matrix + thisHand); |
| 286 | 286 | ||
| 287 | matrix_slave_scan_user(); | 287 | matrix_slave_scan_user(); |
| 288 | } | 288 | } |
diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index b45ba92c3..977b5dc33 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c | |||
| @@ -31,6 +31,9 @@ typedef struct _I2C_slave_buffer_t { | |||
| 31 | # ifndef DISABLE_SYNC_TIMER | 31 | # ifndef DISABLE_SYNC_TIMER |
| 32 | uint32_t sync_timer; | 32 | uint32_t sync_timer; |
| 33 | # endif | 33 | # endif |
| 34 | # ifdef SPLIT_TRANSPORT_MIRROR | ||
| 35 | matrix_row_t mmatrix[ROWS_PER_HAND]; | ||
| 36 | # endif | ||
| 34 | matrix_row_t smatrix[ROWS_PER_HAND]; | 37 | matrix_row_t smatrix[ROWS_PER_HAND]; |
| 35 | # ifdef SPLIT_MODS_ENABLE | 38 | # ifdef SPLIT_MODS_ENABLE |
| 36 | uint8_t real_mods; | 39 | uint8_t real_mods; |
| @@ -56,7 +59,8 @@ typedef struct _I2C_slave_buffer_t { | |||
| 56 | static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg; | 59 | static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg; |
| 57 | 60 | ||
| 58 | # define I2C_SYNC_TIME_START offsetof(I2C_slave_buffer_t, sync_timer) | 61 | # define I2C_SYNC_TIME_START offsetof(I2C_slave_buffer_t, sync_timer) |
| 59 | # define I2C_KEYMAP_START offsetof(I2C_slave_buffer_t, smatrix) | 62 | # define I2C_KEYMAP_MASTER_START offsetof(I2C_slave_buffer_t, mmatrix) |
| 63 | # define I2C_KEYMAP_SLAVE_START offsetof(I2C_slave_buffer_t, smatrix) | ||
| 60 | # define I2C_REAL_MODS_START offsetof(I2C_slave_buffer_t, real_mods) | 64 | # define I2C_REAL_MODS_START offsetof(I2C_slave_buffer_t, real_mods) |
| 61 | # define I2C_WEAK_MODS_START offsetof(I2C_slave_buffer_t, weak_mods) | 65 | # define I2C_WEAK_MODS_START offsetof(I2C_slave_buffer_t, weak_mods) |
| 62 | # define I2C_ONESHOT_MODS_START offsetof(I2C_slave_buffer_t, oneshot_mods) | 66 | # define I2C_ONESHOT_MODS_START offsetof(I2C_slave_buffer_t, oneshot_mods) |
| @@ -72,8 +76,11 @@ static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_re | |||
| 72 | # endif | 76 | # endif |
| 73 | 77 | ||
| 74 | // Get rows from other half over i2c | 78 | // Get rows from other half over i2c |
| 75 | bool transport_master(matrix_row_t matrix[]) { | 79 | bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { |
| 76 | i2c_readReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_START, (void *)matrix, sizeof(i2c_buffer->smatrix), TIMEOUT); | 80 | i2c_readReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_SLAVE_START, (void *)slave_matrix, sizeof(i2c_buffer->smatrix), TIMEOUT); |
| 81 | #ifdef SPLIT_TRANSPORT_MIRROR | ||
| 82 | i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_MASTER_START, (void *)master_matrix, sizeof(i2c_buffer->mmatrix), TIMEOUT); | ||
| 83 | #endif | ||
| 77 | 84 | ||
| 78 | // write backlight info | 85 | // write backlight info |
| 79 | # ifdef BACKLIGHT_ENABLE | 86 | # ifdef BACKLIGHT_ENABLE |
| @@ -141,12 +148,15 @@ bool transport_master(matrix_row_t matrix[]) { | |||
| 141 | return true; | 148 | return true; |
| 142 | } | 149 | } |
| 143 | 150 | ||
| 144 | void transport_slave(matrix_row_t matrix[]) { | 151 | void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { |
| 145 | # ifndef DISABLE_SYNC_TIMER | 152 | # ifndef DISABLE_SYNC_TIMER |
| 146 | sync_timer_update(i2c_buffer->sync_timer); | 153 | sync_timer_update(i2c_buffer->sync_timer); |
| 147 | # endif | 154 | # endif |
| 148 | // Copy matrix to I2C buffer | 155 | // Copy matrix to I2C buffer |
| 149 | memcpy((void *)i2c_buffer->smatrix, (void *)matrix, sizeof(i2c_buffer->smatrix)); | 156 | memcpy((void*)i2c_buffer->smatrix, (void *)slave_matrix, sizeof(i2c_buffer->smatrix)); |
| 157 | #ifdef SPLIT_TRANSPORT_MIRROR | ||
| 158 | memcpy((void*)master_matrix, (void *)i2c_buffer->mmatrix, sizeof(i2c_buffer->mmatrix)); | ||
| 159 | #endif | ||
| 150 | 160 | ||
| 151 | // Read Backlight Info | 161 | // Read Backlight Info |
| 152 | # ifdef BACKLIGHT_ENABLE | 162 | # ifdef BACKLIGHT_ENABLE |
| @@ -207,6 +217,9 @@ typedef struct _Serial_m2s_buffer_t { | |||
| 207 | # ifndef DISABLE_SYNC_TIMER | 217 | # ifndef DISABLE_SYNC_TIMER |
| 208 | uint32_t sync_timer; | 218 | uint32_t sync_timer; |
| 209 | # endif | 219 | # endif |
| 220 | # ifdef SPLIT_TRANSPORT_MIRROR | ||
| 221 | matrix_row_t mmatrix[ROWS_PER_HAND]; | ||
| 222 | # endif | ||
| 210 | # ifdef BACKLIGHT_ENABLE | 223 | # ifdef BACKLIGHT_ENABLE |
| 211 | uint8_t backlight_level; | 224 | uint8_t backlight_level; |
| 212 | # endif | 225 | # endif |
| @@ -289,7 +302,7 @@ void transport_rgblight_slave(void) { | |||
| 289 | # define transport_rgblight_slave() | 302 | # define transport_rgblight_slave() |
| 290 | # endif | 303 | # endif |
| 291 | 304 | ||
| 292 | bool transport_master(matrix_row_t matrix[]) { | 305 | bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { |
| 293 | # ifndef SERIAL_USE_MULTI_TRANSACTION | 306 | # ifndef SERIAL_USE_MULTI_TRANSACTION |
| 294 | if (soft_serial_transaction() != TRANSACTION_END) { | 307 | if (soft_serial_transaction() != TRANSACTION_END) { |
| 295 | return false; | 308 | return false; |
| @@ -303,7 +316,10 @@ bool transport_master(matrix_row_t matrix[]) { | |||
| 303 | 316 | ||
| 304 | // TODO: if MATRIX_COLS > 8 change to unpack() | 317 | // TODO: if MATRIX_COLS > 8 change to unpack() |
| 305 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | 318 | for (int i = 0; i < ROWS_PER_HAND; ++i) { |
| 306 | matrix[i] = serial_s2m_buffer.smatrix[i]; | 319 | slave_matrix[i] = serial_s2m_buffer.smatrix[i]; |
| 320 | #ifdef SPLIT_TRANSPORT_MIRROR | ||
| 321 | serial_m2s_buffer.mmatrix[i] = master_matrix[i]; | ||
| 322 | #endif | ||
| 307 | } | 323 | } |
| 308 | 324 | ||
| 309 | # ifdef BACKLIGHT_ENABLE | 325 | # ifdef BACKLIGHT_ENABLE |
| @@ -333,7 +349,7 @@ bool transport_master(matrix_row_t matrix[]) { | |||
| 333 | return true; | 349 | return true; |
| 334 | } | 350 | } |
| 335 | 351 | ||
| 336 | void transport_slave(matrix_row_t matrix[]) { | 352 | void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { |
| 337 | transport_rgblight_slave(); | 353 | transport_rgblight_slave(); |
| 338 | # ifndef DISABLE_SYNC_TIMER | 354 | # ifndef DISABLE_SYNC_TIMER |
| 339 | sync_timer_update(serial_m2s_buffer.sync_timer); | 355 | sync_timer_update(serial_m2s_buffer.sync_timer); |
| @@ -341,7 +357,10 @@ void transport_slave(matrix_row_t matrix[]) { | |||
| 341 | 357 | ||
| 342 | // TODO: if MATRIX_COLS > 8 change to pack() | 358 | // TODO: if MATRIX_COLS > 8 change to pack() |
| 343 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | 359 | for (int i = 0; i < ROWS_PER_HAND; ++i) { |
| 344 | serial_s2m_buffer.smatrix[i] = matrix[i]; | 360 | serial_s2m_buffer.smatrix[i] = slave_matrix[i]; |
| 361 | #ifdef SPLIT_TRANSPORT_MIRROR | ||
| 362 | master_matrix[i] = serial_m2s_buffer.mmatrix[i]; | ||
| 363 | #endif | ||
| 345 | } | 364 | } |
| 346 | # ifdef BACKLIGHT_ENABLE | 365 | # ifdef BACKLIGHT_ENABLE |
| 347 | backlight_set(serial_m2s_buffer.backlight_level); | 366 | backlight_set(serial_m2s_buffer.backlight_level); |
diff --git a/quantum/split_common/transport.h b/quantum/split_common/transport.h index c667bfab8..a9f66301b 100644 --- a/quantum/split_common/transport.h +++ b/quantum/split_common/transport.h | |||
| @@ -6,5 +6,5 @@ void transport_master_init(void); | |||
| 6 | void transport_slave_init(void); | 6 | void transport_slave_init(void); |
| 7 | 7 | ||
| 8 | // returns false if valid data not received from slave | 8 | // returns false if valid data not received from slave |
| 9 | bool transport_master(matrix_row_t matrix[]); | 9 | bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]); |
| 10 | void transport_slave(matrix_row_t matrix[]); | 10 | void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]); |
