-static bool has_ghost_in_row(uint8_t row)
+
+static inline bool countones(uint16_t data)
+{
+ int count = 0;
+ for (int col = 0; col < MATRIX_COLS; col++) {
+ if (data & (1<<col))
+ count++;
+ }
+ if (count > 1){
+ return true;
+ }
+ return false;
+}
+static inline bool has_ghost_in_row(uint8_t row, uint16_t rowdata)
/* No ghost exists when less than 2 keys are down on the row.
If there are "active" blanks in the matrix, the key can't be pressed by the user,
there is no doubt as to which keys are really being pressed.
The ghosts will be ignored, they are KC_NO. */
/* No ghost exists when less than 2 keys are down on the row.
If there are "active" blanks in the matrix, the key can't be pressed by the user,
there is no doubt as to which keys are really being pressed.
The ghosts will be ignored, they are KC_NO. */
// Ghost occurs when the row shares column line with other row, blanks in the matrix don't matter
// If there are more than two real keys pressed and they match another row's real keys, the row will be ignored.
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
// Ghost occurs when the row shares column line with other row, blanks in the matrix don't matter
// If there are more than two real keys pressed and they match another row's real keys, the row will be ignored.
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
/* Keep track of whether ghosted status has changed for
* debugging. But don't update matrix_prev until un-ghosted, or
* the last key would be lost.
/* Keep track of whether ghosted status has changed for
* debugging. But don't update matrix_prev until un-ghosted, or
* the last key would be lost.