summaryrefslogtreecommitdiff
path: root/include/zmk/kscan-mock.h
diff options
context:
space:
mode:
authorPete Johanson <peter@peterjohanson.com>2020-05-24 18:22:16 -0400
committerPete Johanson <peter@peterjohanson.com>2020-05-24 18:22:16 -0400
commited5532bf94e93d25e35498cfd7a9040b0c69597b (patch)
tree9ed29552fb54e94ecc2062f0db3b6321d24b7c4a /include/zmk/kscan-mock.h
parent9d5de4e9229ad363a54bbcab0a6a60b07d5f19f5 (diff)
Add a mock kscan driver, working native_posix.
* Unified logging to one module. * Mock kscan driver that simulates events. * Working native_posix board target for testing.
Diffstat (limited to 'include/zmk/kscan-mock.h')
-rw-r--r--include/zmk/kscan-mock.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/zmk/kscan-mock.h b/include/zmk/kscan-mock.h
new file mode 100644
index 0000000..b19cafb
--- /dev/null
+++ b/include/zmk/kscan-mock.h
@@ -0,0 +1,8 @@
+#pragma once
+
+#define ZMK_MOCK_IS_PRESS(v) (v & (0x01 << 31))
+#define ZMK_MOCK_PRESS(row, col, msec) (row + (col << 8) + (msec << 16) + (0x01 << 31))
+#define ZMK_MOCK_RELEASE(row, col, msec) (row + (col << 8) + (msec << 16))
+#define ZMK_MOCK_ROW(v) (v & 0xFF)
+#define ZMK_MOCK_COL(v) ((v >> 8) & 0xFF)
+#define ZMK_MOCK_MSEC(v) ((v & ~(0x01 << 31)) >> 16)