diff options
author | Pete Johanson <peter@peterjohanson.com> | 2020-05-24 18:22:16 -0400 |
---|---|---|
committer | Pete Johanson <peter@peterjohanson.com> | 2020-05-24 18:22:16 -0400 |
commit | ed5532bf94e93d25e35498cfd7a9040b0c69597b (patch) | |
tree | 9ed29552fb54e94ecc2062f0db3b6321d24b7c4a /include/zmk | |
parent | 9d5de4e9229ad363a54bbcab0a6a60b07d5f19f5 (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')
-rw-r--r-- | include/zmk/kscan-mock.h | 8 | ||||
-rw-r--r-- | include/zmk/matrix.h | 6 |
2 files changed, 14 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) diff --git a/include/zmk/matrix.h b/include/zmk/matrix.h index 83a8e2d..783c98e 100644 --- a/include/zmk/matrix.h +++ b/include/zmk/matrix.h @@ -1,6 +1,12 @@ #pragma once #define ZMK_MATRIX_NODE_ID DT_CHOSEN(zmk_kscan) + +#if DT_NODE_HAS_PROP(ZMK_MATRIX_NODE_ID,row_gpios) #define ZMK_MATRIX_ROWS DT_PROP_LEN(ZMK_MATRIX_NODE_ID,row_gpios) #define ZMK_MATRIX_COLS DT_PROP_LEN(ZMK_MATRIX_NODE_ID,col_gpios) +#else +#define ZMK_MATRIX_ROWS DT_PROP(ZMK_MATRIX_NODE_ID,rows) +#define ZMK_MATRIX_COLS DT_PROP(ZMK_MATRIX_NODE_ID,columns) +#endif |