forked from kofal.net/zmk
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.
This commit is contained in:
8
include/zmk/kscan-mock.h
Normal file
8
include/zmk/kscan-mock.h
Normal file
@@ -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)
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user