diff options
| author | XScorpion2 <rcalt2vt@gmail.com> | 2021-02-15 18:30:33 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-16 11:30:33 +1100 |
| commit | d1806a26e4ad75fa0e0405283803eba22c1a49ba (patch) | |
| tree | 25bf2750e9770781cff373114bd44736463a91f1 /tmk_core | |
| parent | 1bc8a6e5d49861b268f9274a8686a2640e36e0b5 (diff) | |
| download | qmk_firmware-d1806a26e4ad75fa0e0405283803eba22c1a49ba.tar.gz qmk_firmware-d1806a26e4ad75fa0e0405283803eba22c1a49ba.zip | |
Split transport mirror (#11046)
* Split transport mirror support
* Updated RGB Matrix to respond to electrical events instead of key events
* split matrix slave fix
Diffstat (limited to 'tmk_core')
| -rw-r--r-- | tmk_core/common/eeconfig.h | 2 | ||||
| -rw-r--r-- | tmk_core/common/keyboard.c | 62 |
2 files changed, 44 insertions, 20 deletions
diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h index c4f048391..d66c4199c 100644 --- a/tmk_core/common/eeconfig.h +++ b/tmk_core/common/eeconfig.h | |||
| @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 21 | #include <stdbool.h> | 21 | #include <stdbool.h> |
| 22 | 22 | ||
| 23 | #ifndef EECONFIG_MAGIC_NUMBER | 23 | #ifndef EECONFIG_MAGIC_NUMBER |
| 24 | # define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEEC | 24 | # define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEEB // When changing, decrement this value to avoid future re-init issues |
| 25 | #endif | 25 | #endif |
| 26 | #define EECONFIG_MAGIC_NUMBER_OFF (uint16_t)0xFFFF | 26 | #define EECONFIG_MAGIC_NUMBER_OFF (uint16_t)0xFFFF |
| 27 | 27 | ||
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 299bda2c1..34fed0cab 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c | |||
| @@ -54,6 +54,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 54 | #ifdef RGBLIGHT_ENABLE | 54 | #ifdef RGBLIGHT_ENABLE |
| 55 | # include "rgblight.h" | 55 | # include "rgblight.h" |
| 56 | #endif | 56 | #endif |
| 57 | #ifdef RGB_MATRIX_ENABLE | ||
| 58 | # include "rgb_matrix.h" | ||
| 59 | #endif | ||
| 57 | #ifdef ENCODER_ENABLE | 60 | #ifdef ENCODER_ENABLE |
| 58 | # include "encoder.h" | 61 | # include "encoder.h" |
| 59 | #endif | 62 | #endif |
| @@ -304,6 +307,9 @@ void keyboard_init(void) { | |||
| 304 | #ifdef RGBLIGHT_ENABLE | 307 | #ifdef RGBLIGHT_ENABLE |
| 305 | rgblight_init(); | 308 | rgblight_init(); |
| 306 | #endif | 309 | #endif |
| 310 | #ifdef RGB_MATRIX_ENABLE | ||
| 311 | rgb_matrix_init(); | ||
| 312 | #endif | ||
| 307 | #ifdef ENCODER_ENABLE | 313 | #ifdef ENCODER_ENABLE |
| 308 | encoder_init(); | 314 | encoder_init(); |
| 309 | #endif | 315 | #endif |
| @@ -328,6 +334,17 @@ void keyboard_init(void) { | |||
| 328 | keyboard_post_init_kb(); /* Always keep this last */ | 334 | keyboard_post_init_kb(); /* Always keep this last */ |
| 329 | } | 335 | } |
| 330 | 336 | ||
| 337 | /** \brief key_event_task | ||
| 338 | * | ||
| 339 | * This function is responsible for calling into other systems when they need to respond to electrical switch press events. | ||
| 340 | * This is differnet than keycode events as no layer processing, or filtering occurs. | ||
| 341 | */ | ||
| 342 | void switch_events(uint8_t row, uint8_t col, bool pressed) { | ||
| 343 | #if defined(RGB_MATRIX_ENABLE) | ||
| 344 | process_rgb_matrix(row, col, pressed); | ||
| 345 | #endif | ||
| 346 | } | ||
| 347 | |||
| 331 | /** \brief Keyboard task: Do keyboard routine jobs | 348 | /** \brief Keyboard task: Do keyboard routine jobs |
| 332 | * | 349 | * |
| 333 | * Do routine keyboard jobs: | 350 | * Do routine keyboard jobs: |
| @@ -358,32 +375,35 @@ void keyboard_task(void) { | |||
| 358 | uint8_t matrix_changed = matrix_scan(); | 375 | uint8_t matrix_changed = matrix_scan(); |
| 359 | if (matrix_changed) last_matrix_activity_trigger(); | 376 | if (matrix_changed) last_matrix_activity_trigger(); |
| 360 | 377 | ||
| 361 | if (should_process_keypress()) { | 378 | for (uint8_t r = 0; r < MATRIX_ROWS; r++) { |
| 362 | for (uint8_t r = 0; r < MATRIX_ROWS; r++) { | 379 | matrix_row = matrix_get_row(r); |
| 363 | matrix_row = matrix_get_row(r); | 380 | matrix_change = matrix_row ^ matrix_prev[r]; |
| 364 | matrix_change = matrix_row ^ matrix_prev[r]; | 381 | if (matrix_change) { |
| 365 | if (matrix_change) { | ||
| 366 | #ifdef MATRIX_HAS_GHOST | 382 | #ifdef MATRIX_HAS_GHOST |
| 367 | if (has_ghost_in_row(r, matrix_row)) { | 383 | if (has_ghost_in_row(r, matrix_row)) { |
| 368 | continue; | 384 | continue; |
| 369 | } | 385 | } |
| 370 | #endif | 386 | #endif |
| 371 | if (debug_matrix) matrix_print(); | 387 | if (debug_matrix) matrix_print(); |
| 372 | matrix_row_t col_mask = 1; | 388 | matrix_row_t col_mask = 1; |
| 373 | for (uint8_t c = 0; c < MATRIX_COLS; c++, col_mask <<= 1) { | 389 | for (uint8_t c = 0; c < MATRIX_COLS; c++, col_mask <<= 1) { |
| 374 | if (matrix_change & col_mask) { | 390 | if (matrix_change & col_mask) { |
| 391 | if (should_process_keypress()) { | ||
| 375 | action_exec((keyevent_t){ | 392 | action_exec((keyevent_t){ |
| 376 | .key = (keypos_t){.row = r, .col = c}, .pressed = (matrix_row & col_mask), .time = (timer_read() | 1) /* time should not be 0 */ | 393 | .key = (keypos_t){.row = r, .col = c}, .pressed = (matrix_row & col_mask), .time = (timer_read() | 1) /* time should not be 0 */ |
| 377 | }); | 394 | }); |
| 378 | // record a processed key | 395 | } |
| 379 | matrix_prev[r] ^= col_mask; | 396 | // record a processed key |
| 397 | matrix_prev[r] ^= col_mask; | ||
| 398 | |||
| 399 | switch_events(r, c, (matrix_row & col_mask)); | ||
| 400 | |||
| 380 | #ifdef QMK_KEYS_PER_SCAN | 401 | #ifdef QMK_KEYS_PER_SCAN |
| 381 | // only jump out if we have processed "enough" keys. | 402 | // only jump out if we have processed "enough" keys. |
| 382 | if (++keys_processed >= QMK_KEYS_PER_SCAN) | 403 | if (++keys_processed >= QMK_KEYS_PER_SCAN) |
| 383 | #endif | 404 | #endif |
| 384 | // process a key per task call | 405 | // process a key per task call |
| 385 | goto MATRIX_LOOP_END; | 406 | goto MATRIX_LOOP_END; |
| 386 | } | ||
| 387 | } | 407 | } |
| 388 | } | 408 | } |
| 389 | } | 409 | } |
| @@ -405,6 +425,10 @@ MATRIX_LOOP_END: | |||
| 405 | rgblight_task(); | 425 | rgblight_task(); |
| 406 | #endif | 426 | #endif |
| 407 | 427 | ||
| 428 | #ifdef RGB_MATRIX_ENABLE | ||
| 429 | rgb_matrix_task(); | ||
| 430 | #endif | ||
| 431 | |||
| 408 | #if defined(BACKLIGHT_ENABLE) | 432 | #if defined(BACKLIGHT_ENABLE) |
| 409 | # if defined(BACKLIGHT_PIN) || defined(BACKLIGHT_PINS) | 433 | # if defined(BACKLIGHT_PIN) || defined(BACKLIGHT_PINS) |
| 410 | backlight_task(); | 434 | backlight_task(); |
