aboutsummaryrefslogtreecommitdiffstats
path: root/src/keymat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keymat.c')
-rw-r--r--src/keymat.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/keymat.c b/src/keymat.c
index ebdba3a..3686053 100644
--- a/src/keymat.c
+++ b/src/keymat.c
@@ -5,6 +5,7 @@
#include "pico/types.h"
#include "hardware/gpio.h"
#include "hardware/timer.h"
+#include "util.h"
#include <string.h>
@@ -88,3 +89,21 @@ keymat_decode_half(int side, uint32_t mask)
}
}
}
+
+void
+keymat_debug(void)
+{
+ uint x, y;
+
+ if (log_level_min > LOG_DEBUG)
+ return;
+
+ for (y = 0; y < KEY_ROWS; y++) {
+ for (x = 0; x < KEY_COLS; x++) {
+ if (!keymat_prev[y][x] && keymat[y][x])
+ DEBUG(LOG_KEYMAT, "Key pressed: %u %u", x, y);
+ else if (keymat_prev[y][x] && !keymat[y][x])
+ DEBUG(LOG_KEYMAT, "Key released: %u %u", x, y);
+ }
+ }
+}