|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
uint8_t matrix_key_count(void) |
|
|
|
|
|
{ |
|
|
|
|
|
uint8_t count = 0; |
|
|
|
|
|
for (uint8_t i = 0; i < MATRIX_ROWS; i++) { |
|
|
|
|
|
#if (MATRIX_COLS <= 8) |
|
|
|
|
|
count += bitpop(matrix[i]); |
|
|
|
|
|
#else |
|
|
|
|
|
count += bitpop16(matrix[i]); |
|
|
|
|
|
#endif |
|
|
|
|
|
} |
|
|
|
|
|
return count; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#ifdef MATRIX_HAS_GHOST |
|
|
#ifdef MATRIX_HAS_GHOST |
|
|
inline |
|
|
inline |
|
|
static bool matrix_has_ghost_in_row(uint8_t row) |
|
|
static bool matrix_has_ghost_in_row(uint8_t row) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ghost exists in case same state as other row |
|
|
// ghost exists in case same state as other row |
|
|
for (uint8_t i=0; i < MATRIX_ROWS; i++) { |
|
|
for (uint8_t i=0; i < MATRIX_ROWS; i++) { |
|
|
//if (i != row && (matrix[i] & matrix[row]) == matrix[row]) |
|
|
|
|
|
if (i != row && (matrix[i] & matrix[row])) |
|
|
if (i != row && (matrix[i] & matrix[row])) |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |