summaryrefslogtreecommitdiffstats
path: root/hhkb
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2010-10-23 20:27:43 +0200
committertmk <nobody@nowhere>2010-10-23 20:33:08 +0200
commit4acc38751e9c8e90921773e6e5f5a100b0729d98 (patch)
treee8e650c6c0557871f55c39b6449a0cc2479fbf58 /hhkb
parentbf92bdd7fa9938c162c29e565d245e5609e4a912 (diff)
downloadqmk_firmware-4acc38751e9c8e90921773e6e5f5a100b0729d98.tar.gz
qmk_firmware-4acc38751e9c8e90921773e6e5f5a100b0729d98.tar.xz
switch debug on/off by pressing 4 keys on booting time
Diffstat (limited to 'hhkb')
-rw-r--r--hhkb/matrix.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/hhkb/matrix.c b/hhkb/matrix.c
index a1917793e..a425439cc 100644
--- a/hhkb/matrix.c
+++ b/hhkb/matrix.c
@@ -32,6 +32,7 @@ static uint8_t _matrix1[MATRIX_ROWS];
static bool matrix_has_ghost_in_row(int row);
+static int bit_pop(uint8_t bits);
inline
@@ -88,7 +89,7 @@ int matrix_scan(void)
}
bool matrix_is_modified(void) {
- for (int i=0; i <MATRIX_ROWS; i++) {
+ for (int i = 0; i < MATRIX_ROWS; i++) {
if (matrix[i] != matrix_prev[i])
return true;
}
@@ -117,7 +118,22 @@ void matrix_print(void) {
}
}
+int matrix_key_count(void) {
+ int count = 0;
+ for (int i = 0; i < MATRIX_ROWS; i++) {
+ count += bit_pop(~matrix[i]);
+ }
+ return count;
+}
+
inline
static bool matrix_has_ghost_in_row(int row) {
return false;
}
+
+static int bit_pop(uint8_t bits) {
+ int c;
+ for (c = 0; bits; c++)
+ bits &= bits -1;
+ return c;
+}