Pete Johanson
5 years ago
9 changed files with 113 additions and 13 deletions
@ -0,0 +1,13 @@ |
|||||||
|
description: | |
||||||
|
Allows defining a keymap composed of multiple layers |
||||||
|
|
||||||
|
compatible: "zmk,keymap" |
||||||
|
|
||||||
|
properties: |
||||||
|
label: |
||||||
|
type: string |
||||||
|
required: true |
||||||
|
|
||||||
|
layers: |
||||||
|
type: phandles |
||||||
|
required: true |
@ -0,0 +1,14 @@ |
|||||||
|
description: | |
||||||
|
Allows defining the various keymap layers for use. |
||||||
|
|
||||||
|
compatible: "zmk,layers" |
||||||
|
|
||||||
|
child-binding: |
||||||
|
description: "A layer to be used in a keymap" |
||||||
|
|
||||||
|
properties: |
||||||
|
label: |
||||||
|
type: string |
||||||
|
keys: |
||||||
|
type: array |
||||||
|
|
@ -0,0 +1,34 @@ |
|||||||
|
|
||||||
|
#include "keymap.h" |
||||||
|
|
||||||
|
static enum hid_kbd_code zmk_keymap[ZMK_KEYMAP_LAYERS_LEN][ZMK_MATRIX_ROWS * ZMK_MATRIX_COLS] = { |
||||||
|
#if DT_PROP_HAS_IDX(ZMK_KEYMAP_NODE,layers,0) |
||||||
|
DT_PROP_BY_PHANDLE_IDX(ZMK_KEYMAP_NODE,layers,0,keys), |
||||||
|
#endif |
||||||
|
#if DT_PROP_HAS_IDX(ZMK_KEYMAP_NODE,layers,1) |
||||||
|
DT_PROP_BY_PHANDLE_IDX(ZMK_KEYMAP_NODE,layers,1,keys), |
||||||
|
#endif |
||||||
|
#if DT_PROP_HAS_IDX(ZMK_KEYMAP_NODE,layers,2) |
||||||
|
DT_PROP_BY_PHANDLE_IDX(ZMK_KEYMAP_NODE,layers,2,keys), |
||||||
|
#endif |
||||||
|
#if DT_PROP_HAS_IDX(ZMK_KEYMAP_NODE,layers,3) |
||||||
|
DT_PROP_BY_PHANDLE_IDX(ZMK_KEYMAP_NODE,layers,3,keys), |
||||||
|
#endif |
||||||
|
#if DT_PROP_HAS_IDX(ZMK_KEYMAP_NODE,layers,4) |
||||||
|
DT_PROP_BY_PHANDLE_IDX(ZMK_KEYMAP_NODE,layers,4,keys), |
||||||
|
#endif |
||||||
|
#if DT_PROP_HAS_IDX(ZMK_KEYMAP_NODE,layers,5) |
||||||
|
DT_PROP_BY_PHANDLE_IDX(ZMK_KEYMAP_NODE,layers,5,keys), |
||||||
|
#endif |
||||||
|
#if DT_PROP_HAS_IDX(ZMK_KEYMAP_NODE,layers,6) |
||||||
|
DT_PROP_BY_PHANDLE_IDX(ZMK_KEYMAP_NODE,layers,6,keys), |
||||||
|
#endif |
||||||
|
#if DT_PROP_HAS_IDX(ZMK_KEYMAP_NODE,layers,7) |
||||||
|
DT_PROP_BY_PHANDLE_IDX(ZMK_KEYMAP_NODE,layers,7,keys), |
||||||
|
#endif |
||||||
|
}; |
||||||
|
|
||||||
|
enum hid_kbd_code zmk_keymap_keycode_from_position(u32_t row, u32_t column) |
||||||
|
{ |
||||||
|
return zmk_keymap[0][(row * ZMK_MATRIX_ROWS) + column]; |
||||||
|
} |
Loading…
Reference in new issue