aboutsummaryrefslogtreecommitdiffstats
path: root/hhkb/matrix.c
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2010-10-27 20:51:45 +0900
committertmk <nobody@nowhere>2010-10-27 22:56:01 +0900
commit2f80e790c6310ad24a4cb3d4a72c31314364fef7 (patch)
treeaad001abdb61ff736e580f98184ab7cd9e870648 /hhkb/matrix.c
parent461e0d3d8c82cc78d29d3115af3c417bb51bb50f (diff)
downloadfirmware-2f80e790c6310ad24a4cb3d4a72c31314364fef7.tar.gz
firmware-2f80e790c6310ad24a4cb3d4a72c31314364fef7.tar.bz2
firmware-2f80e790c6310ad24a4cb3d4a72c31314364fef7.zip
new build method for macway
Diffstat (limited to 'hhkb/matrix.c')
-rw-r--r--hhkb/matrix.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/hhkb/matrix.c b/hhkb/matrix.c
index d8dc9a7f8..d95ee1135 100644
--- a/hhkb/matrix.c
+++ b/hhkb/matrix.c
@@ -1,10 +1,13 @@
/*
* scan matrix
*/
+#include <stdint.h>
+#include <stdbool.h>
#include <avr/io.h>
#include <util/delay.h>
#include "matrix.h"
#include "print.h"
+#include "util.h"
// matrix is active low. (key on: 0/key off: 1)
//
@@ -30,10 +33,6 @@ static uint8_t _matrix0[MATRIX_ROWS];
static uint8_t _matrix1[MATRIX_ROWS];
-static bool matrix_has_ghost_in_row(int row);
-static int bit_pop(uint8_t bits);
-
-
inline
int matrix_rows(void)
{
@@ -122,9 +121,6 @@ void matrix_print(void)
for (int row = 0; row < matrix_rows(); row++) {
phex(row); print(": ");
pbin_reverse(matrix_get_row(row));
- if (matrix_has_ghost_in_row(row)) {
- print(" <ghost");
- }
print("\n");
}
}
@@ -133,22 +129,7 @@ int matrix_key_count(void)
{
int count = 0;
for (int i = 0; i < MATRIX_ROWS; i++) {
- count += bit_pop(matrix[i]);
+ count += bitpop(matrix[i]);
}
return count;
}
-
-inline
-static bool matrix_has_ghost_in_row(int row)
-{
- return false;
-}
-
-inline
-static int bit_pop(uint8_t bits)
-{
- int c;
- for (c = 0; bits; c++)
- bits &= bits -1;
- return c;
-}