From b9895771edb4cca2bb17f5872a0e6ee068c91500 Mon Sep 17 00:00:00 2001 From: Jeremiah Date: Sat, 13 May 2017 13:19:28 -0700 Subject: [PATCH] improvements --- tmk_core/common/keyboard.c | 39 ++++++++++++++++---------------------- tmk_core/common/keyboard.h | 1 - 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 93a066e57..116914e1a 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c @@ -62,12 +62,21 @@ along with this program. If not, see . #endif - #ifdef MATRIX_HAS_GHOST -static uint16_t matrix_ghost_check[MATRIX_ROWS]; +extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; +// bit map of true keys and empty spots in matrix, each row is reversed +static uint16_t get_row_ghost_check(uint16_t row){ + for (int col = 0; col < MATRIX_COLS; col++) { + if (keymaps[0][row][col]) + row &= 1< 1){ + if (i != row && __builtin_popcount( + get_row_ghost_check(matrix_get_row(i)) & matrix_row + ) > 1){ return true; } } return false; - return false; } - -extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; -// bit map of true keys and empty spots in matrix, each row is reversed -void make_ghost_check_array(){ - for (int row = 0; row < MATRIX_ROWS; row++) { - for (int col = 0; col < MATRIX_COLS; col++) { - if (keymaps[0][row][col] & 0xFF) - matrix_ghost_check[row] |= 1<