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<