aboutsummaryrefslogtreecommitdiffstats
path: root/src/keymat.h
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2022-12-18 14:53:27 +0100
committerLouis Burda <quent.burda@gmail.com>2022-12-18 14:53:27 +0100
commit4995cfc61e7d2d0c05cf493959456b5bc9a74f19 (patch)
tree2c8b21d211340f7e74ae9ceaeb8dbd685051b157 /src/keymat.h
parent8e8c972cbec56d8de31847981149cde4a8fc16cd (diff)
downloadsxkbd-4995cfc61e7d2d0c05cf493959456b5bc9a74f19.tar.gz
sxkbd-4995cfc61e7d2d0c05cf493959456b5bc9a74f19.zip
Rename matrix to keymat and refactor key matrix access
Diffstat (limited to 'src/keymat.h')
-rw-r--r--src/keymat.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/keymat.h b/src/keymat.h
new file mode 100644
index 0000000..c8cf816
--- /dev/null
+++ b/src/keymat.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "util.h"
+
+#include <stdint.h>
+
+#define KEY_ROWS 4
+#define KEY_COLS 6
+#define KEY_COUNT (KEY_ROWS * KEY_COLS)
+
+#define KEYMAT_HALF(side) ((side) == LEFT ? &keymat[0] : &keymat[KEY_ROWS])
+
+void keymat_init(void);
+void keymat_scan(void);
+uint32_t keymat_encode_half(int side);
+void keymat_decode_half(int side, uint32_t);
+
+extern bool keymat_prev[KEY_ROWS * 2][KEY_COLS];
+extern bool keymat[KEY_ROWS * 2][KEY_COLS];
+