forked from mirrors/qmk_firmware
[Core] Optimize matrix processing (#7621)
Backport of tmk/tmk_keyboard@ad6059adc7
This commit is contained in:
parent
853b99954e
commit
85f4c3ebb4
1 changed files with 5 additions and 4 deletions
|
@ -297,13 +297,14 @@ void keyboard_task(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (debug_matrix) matrix_print();
|
if (debug_matrix) matrix_print();
|
||||||
for (uint8_t c = 0; c < MATRIX_COLS; c++) {
|
matrix_row_t col_mask = 1;
|
||||||
if (matrix_change & ((matrix_row_t)1 << c)) {
|
for (uint8_t c = 0; c < MATRIX_COLS; c++, col_mask <<= 1) {
|
||||||
|
if (matrix_change & col_mask) {
|
||||||
action_exec((keyevent_t){
|
action_exec((keyevent_t){
|
||||||
.key = (keypos_t){.row = r, .col = c}, .pressed = (matrix_row & ((matrix_row_t)1 << c)), .time = (timer_read() | 1) /* time should not be 0 */
|
.key = (keypos_t){.row = r, .col = c}, .pressed = (matrix_row & col_mask), .time = (timer_read() | 1) /* time should not be 0 */
|
||||||
});
|
});
|
||||||
// record a processed key
|
// record a processed key
|
||||||
matrix_prev[r] ^= ((matrix_row_t)1 << c);
|
matrix_prev[r] ^= col_mask;
|
||||||
#ifdef QMK_KEYS_PER_SCAN
|
#ifdef QMK_KEYS_PER_SCAN
|
||||||
// only jump out if we have processed "enough" keys.
|
// only jump out if we have processed "enough" keys.
|
||||||
if (++keys_processed >= QMK_KEYS_PER_SCAN)
|
if (++keys_processed >= QMK_KEYS_PER_SCAN)
|
||||||
|
|
Loading…
Reference in a new issue