forked from kofal.net/zmk
refactor: Replace tabs with spaces
Standardized indentation to use spaces with a new pre-commit hook.
This commit is contained in:
committed by
Pete Johanson
parent
32ae776c42
commit
94061bb916
@@ -175,19 +175,19 @@ do is shift back the settings area and code space `0xC000` bytes. We'll apply
|
||||
this to all of the `.dts` files for the boards that were affected by this issue.
|
||||
|
||||
```diff
|
||||
code_partition: partition@26000 {
|
||||
label = "code_partition";
|
||||
- reg = <0x00026000 0x000d2000>;
|
||||
+ reg = <0x00026000 0x000c6000>;
|
||||
};
|
||||
code_partition: partition@26000 {
|
||||
label = "code_partition";
|
||||
- reg = <0x00026000 0x000d2000>;
|
||||
+ reg = <0x00026000 0x000c6000>;
|
||||
};
|
||||
|
||||
|
||||
- storage_partition: partition@f8000 {
|
||||
+ storage_partition: partition@ec000 {
|
||||
label = "storage";
|
||||
- reg = <0x000f8000 0x00008000>;
|
||||
+ reg = <0x000ec000 0x00008000>;
|
||||
};
|
||||
- storage_partition: partition@f8000 {
|
||||
+ storage_partition: partition@ec000 {
|
||||
label = "storage";
|
||||
- reg = <0x000f8000 0x00008000>;
|
||||
+ reg = <0x000ec000 0x00008000>;
|
||||
};
|
||||
```
|
||||
|
||||
And with those changes, we should no longer run into this issue! In the process
|
||||
|
||||
@@ -57,14 +57,14 @@ For example, the following hold-tap configuration enables `global-quick-tap` wit
|
||||
|
||||
```
|
||||
gqt: global-quick-tap {
|
||||
compatible = "zmk,behavior-hold-tap";
|
||||
label = "GLOBAL_QUICK_TAP";
|
||||
#binding-cells = <2>;
|
||||
flavor = "tap-preferred";
|
||||
tapping-term-ms = <200>;
|
||||
quick-tap-ms = <125>;
|
||||
global-quick-tap;
|
||||
bindings = <&kp>, <&kp>;
|
||||
compatible = "zmk,behavior-hold-tap";
|
||||
label = "GLOBAL_QUICK_TAP";
|
||||
#binding-cells = <2>;
|
||||
flavor = "tap-preferred";
|
||||
tapping-term-ms = <200>;
|
||||
quick-tap-ms = <125>;
|
||||
global-quick-tap;
|
||||
bindings = <&kp>, <&kp>;
|
||||
};
|
||||
```
|
||||
|
||||
@@ -80,7 +80,7 @@ For example, if you press `&mt LEFT_SHIFT A` and then release it without pressin
|
||||
|
||||
```
|
||||
&mt {
|
||||
retro-tap;
|
||||
retro-tap;
|
||||
};
|
||||
```
|
||||
|
||||
@@ -101,28 +101,28 @@ See the following example, which uses a hold-tap behavior definition, configured
|
||||
#include <behaviors.dtsi>
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
pht: positional_hold_tap {
|
||||
compatible = "zmk,behavior-hold-tap";
|
||||
label = "POSITIONAL_HOLD_TAP";
|
||||
#binding-cells = <2>;
|
||||
flavor = "hold-preferred";
|
||||
tapping-term-ms = <400>;
|
||||
quick-tap-ms = <200>;
|
||||
bindings = <&kp>, <&kp>;
|
||||
hold-trigger-key-positions = <1>; // <---[[the W key]]
|
||||
};
|
||||
};
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
label ="Default keymap";
|
||||
default_layer {
|
||||
bindings = <
|
||||
// position 0 position 1 position 2
|
||||
&pht LEFT_SHIFT Q &kp W &kp E
|
||||
>;
|
||||
};
|
||||
};
|
||||
behaviors {
|
||||
pht: positional_hold_tap {
|
||||
compatible = "zmk,behavior-hold-tap";
|
||||
label = "POSITIONAL_HOLD_TAP";
|
||||
#binding-cells = <2>;
|
||||
flavor = "hold-preferred";
|
||||
tapping-term-ms = <400>;
|
||||
quick-tap-ms = <200>;
|
||||
bindings = <&kp>, <&kp>;
|
||||
hold-trigger-key-positions = <1>; // <---[[the W key]]
|
||||
};
|
||||
};
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
label ="Default keymap";
|
||||
default_layer {
|
||||
bindings = <
|
||||
// position 0 position 1 position 2
|
||||
&pht LEFT_SHIFT Q &kp W &kp E
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
@@ -154,28 +154,28 @@ The following are suggested hold-tap configurations that work well with home row
|
||||
#include <behaviors.dtsi>
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
lh_pht: left_hand_positional_hold_tap {
|
||||
compatible = "zmk,behavior-hold-tap";
|
||||
label = "LEFT_POSITIONAL_HOLD_TAP";
|
||||
#binding-cells = <2>;
|
||||
flavor = "tap-unless-interrupted";
|
||||
tapping-term-ms = <100>; // <---[[produces tap if held longer than tapping-term-ms]]
|
||||
quick-tap-ms = <200>;
|
||||
bindings = <&kp>, <&kp>;
|
||||
hold-trigger-key-positions = <5 6 7 8 9 10>; // <---[[right-hand keys]]
|
||||
};
|
||||
};
|
||||
behaviors {
|
||||
lh_pht: left_hand_positional_hold_tap {
|
||||
compatible = "zmk,behavior-hold-tap";
|
||||
label = "LEFT_POSITIONAL_HOLD_TAP";
|
||||
#binding-cells = <2>;
|
||||
flavor = "tap-unless-interrupted";
|
||||
tapping-term-ms = <100>; // <---[[produces tap if held longer than tapping-term-ms]]
|
||||
quick-tap-ms = <200>;
|
||||
bindings = <&kp>, <&kp>;
|
||||
hold-trigger-key-positions = <5 6 7 8 9 10>; // <---[[right-hand keys]]
|
||||
};
|
||||
};
|
||||
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
default_layer {
|
||||
bindings = <
|
||||
// position 0 pos 1 pos 2 pos 3 pos 4 pos 5 pos 6 pos 7 pos 8 pos 9 pos 10
|
||||
&lh_pht LSFT A &lh_pht LGUI S &lh_pht LALT D &lh_pht LCTL F &kp G &kp H &kp I &kp J &kp K &kp L &kp SEMI
|
||||
>;
|
||||
};
|
||||
};
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
default_layer {
|
||||
bindings = <
|
||||
// position 0 pos 1 pos 2 pos 3 pos 4 pos 5 pos 6 pos 7 pos 8 pos 9 pos 10
|
||||
&lh_pht LSFT A &lh_pht LGUI S &lh_pht LALT D &lh_pht LCTL F &kp G &kp H &kp I &kp J &kp K &kp L &kp SEMI
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
@@ -186,26 +186,26 @@ The following are suggested hold-tap configurations that work well with home row
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
hm: homerow_mods {
|
||||
compatible = "zmk,behavior-hold-tap";
|
||||
label = "HOMEROW_MODS";
|
||||
#binding-cells = <2>;
|
||||
tapping-term-ms = <150>;
|
||||
quick-tap-ms = <0>;
|
||||
flavor = "tap-preferred";
|
||||
bindings = <&kp>, <&kp>;
|
||||
};
|
||||
};
|
||||
behaviors {
|
||||
hm: homerow_mods {
|
||||
compatible = "zmk,behavior-hold-tap";
|
||||
label = "HOMEROW_MODS";
|
||||
#binding-cells = <2>;
|
||||
tapping-term-ms = <150>;
|
||||
quick-tap-ms = <0>;
|
||||
flavor = "tap-preferred";
|
||||
bindings = <&kp>, <&kp>;
|
||||
};
|
||||
};
|
||||
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
default_layer {
|
||||
bindings = <
|
||||
&hm LCTRL A &hm LGUI S &hm LALT D &hm LSHIFT F
|
||||
>;
|
||||
};
|
||||
};
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
default_layer {
|
||||
bindings = <
|
||||
&hm LCTRL A &hm LGUI S &hm LALT D &hm LSHIFT F
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
@@ -216,26 +216,26 @@ The following are suggested hold-tap configurations that work well with home row
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
bhm: balanced_homerow_mods {
|
||||
compatible = "zmk,behavior-hold-tap";
|
||||
label = "HOMEROW_MODS";
|
||||
#binding-cells = <2>;
|
||||
tapping-term-ms = <200>; // <---[[moderate duration]]
|
||||
quick-tap-ms = <0>;
|
||||
flavor = "balanced";
|
||||
bindings = <&kp>, <&kp>;
|
||||
};
|
||||
};
|
||||
behaviors {
|
||||
bhm: balanced_homerow_mods {
|
||||
compatible = "zmk,behavior-hold-tap";
|
||||
label = "HOMEROW_MODS";
|
||||
#binding-cells = <2>;
|
||||
tapping-term-ms = <200>; // <---[[moderate duration]]
|
||||
quick-tap-ms = <0>;
|
||||
flavor = "balanced";
|
||||
bindings = <&kp>, <&kp>;
|
||||
};
|
||||
};
|
||||
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
default_layer {
|
||||
bindings = <
|
||||
&bhm LCTRL A &bhm LGUI S &bhm LALT D &bhm LSHIFT F
|
||||
>;
|
||||
};
|
||||
};
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
default_layer {
|
||||
bindings = <
|
||||
&bhm LCTRL A &bhm LGUI S &bhm LALT D &bhm LSHIFT F
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
@@ -264,14 +264,14 @@ A popular method of implementing Autoshift in ZMK involves a C-preprocessor macr
|
||||
};
|
||||
};
|
||||
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
default_layer {
|
||||
bindings = <
|
||||
AS(Q) AS(W) AS(E) AS(R) AS(T) AS(Y) // Autoshift applied for QWERTY keys
|
||||
>;
|
||||
};
|
||||
};
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
default_layer {
|
||||
bindings = <
|
||||
AS(Q) AS(W) AS(E) AS(R) AS(T) AS(Y) // Autoshift applied for QWERTY keys
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
@@ -300,14 +300,14 @@ This hold-tap example implements a [momentary-layer](layers.md/#momentary-layer)
|
||||
};
|
||||
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
default_layer {
|
||||
bindings = <
|
||||
&mo_tog 2 1 // &mo 2 on hold, &tog 1 on tap
|
||||
MO_TOG(3) // &mo 3 on hold, &tog 3 on tap
|
||||
>;
|
||||
};
|
||||
};
|
||||
compatible = "zmk,keymap";
|
||||
default_layer {
|
||||
bindings = <
|
||||
&mo_tog 2 1 // &mo 2 on hold, &tog 1 on tap
|
||||
MO_TOG(3) // &mo 3 on hold, &tog 3 on tap
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
@@ -105,29 +105,29 @@ Example:
|
||||
#define NONE 0
|
||||
|
||||
/ {
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
|
||||
default_layer {
|
||||
bindings = <
|
||||
default_layer {
|
||||
bindings = <
|
||||
&tog NAVI &kp KP_DIVIDE &kp KP_MULTIPLY &kp KP_MINUS
|
||||
&kp NUMBER_7 &kp NUMBER_8 &kp NUMBER_9 &kp KP_PLUS
|
||||
&kp NUMBER_4 &kp NUMBER_5 &kp NUMBER_6 &kp KP_PLUS
|
||||
&kp NUMBER_1 &kp NUMBER_2 &kp NUMBER_3 &kp RETURN
|
||||
&kp NUMBER_0 &kp NUMBER_0 &kp DOT &kp RETURN
|
||||
>;
|
||||
};
|
||||
>;
|
||||
};
|
||||
|
||||
nav_layer {
|
||||
bindings = <
|
||||
nav_layer {
|
||||
bindings = <
|
||||
&tog NAVI &kp KP_DIVIDE &kp KP_MULTIPLY &kp KP_MINUS
|
||||
&kp HOME &kp UP &kp PAGE_UP &kp KP_PLUS
|
||||
&kp LEFT &none &kp RIGHT &kp KP_PLUS
|
||||
&kp END &kp DOWN &kp PAGE_DOWN &kp RETURN
|
||||
&kp INSERT &kp INSERT &kp DEL &kp RETURN
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
@@ -42,25 +42,25 @@ This example configures a tap-dance named `td0` that outputs the number of times
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
td0: tap_dance_0 {
|
||||
behaviors {
|
||||
td0: tap_dance_0 {
|
||||
compatible = "zmk,behavior-tap-dance";
|
||||
label = "TAP_DANCE_0";
|
||||
#binding-cells = <0>;
|
||||
tapping-term-ms = <200>;
|
||||
bindings = <&kp N1>, <&kp N2>, <&kp N3>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
|
||||
default_layer {
|
||||
bindings = <
|
||||
&td0
|
||||
>;
|
||||
};
|
||||
};
|
||||
default_layer {
|
||||
bindings = <
|
||||
&td0
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
@@ -83,25 +83,25 @@ This example configures a mod-tap inside a tap-dance named `td_mt` that outputs
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
td_mt: tap_dance_mod_tap {
|
||||
behaviors {
|
||||
td_mt: tap_dance_mod_tap {
|
||||
compatible = "zmk,behavior-tap-dance";
|
||||
label = "TAP_DANCE_MOD_TAP";
|
||||
#binding-cells = <0>;
|
||||
tapping-term-ms = <200>;
|
||||
bindings = <&mt LSHIFT CAPSLOCK>, <&kp LCTRL>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
|
||||
default_layer {
|
||||
bindings = <
|
||||
&td_mt
|
||||
>;
|
||||
};
|
||||
};
|
||||
default_layer {
|
||||
bindings = <
|
||||
&td_mt
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
@@ -116,14 +116,14 @@ Devicetree files look like this:
|
||||
|
||||
```devicetree
|
||||
/ {
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
};
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
};
|
||||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
label = "KSCAN";
|
||||
};
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
label = "KSCAN";
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
@@ -167,9 +167,9 @@ If the node you want to edit doesn't have a label, you can also write a new tree
|
||||
|
||||
```devicetree
|
||||
/ {
|
||||
kscan {
|
||||
debounce-press-ms = <0>;
|
||||
};
|
||||
kscan {
|
||||
debounce-press-ms = <0>;
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
@@ -244,7 +244,7 @@ Example:
|
||||
some-gpios =
|
||||
<&gpio0 0 GPIO_ACTIVE_HIGH>,
|
||||
<&gpio0 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||
;
|
||||
;
|
||||
```
|
||||
|
||||
#### path
|
||||
|
||||
@@ -367,15 +367,15 @@ For the purpose of this section, we will discuss the structure of `app/dts/behav
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
|
||||
/ {
|
||||
behaviors {
|
||||
/omit-if-no-ref/ gresc: grave_escape {
|
||||
compatible = "zmk,behavior-mod-morph";
|
||||
label = "GRAVE_ESCAPE";
|
||||
#binding-cells = <0>;
|
||||
bindings = <&kp ESC>, <&kp GRAVE>;
|
||||
behaviors {
|
||||
/omit-if-no-ref/ gresc: grave_escape {
|
||||
compatible = "zmk,behavior-mod-morph";
|
||||
label = "GRAVE_ESCAPE";
|
||||
#binding-cells = <0>;
|
||||
bindings = <&kp ESC>, <&kp GRAVE>;
|
||||
mods = <(MOD_LGUI|MOD_LSFT|MOD_RGUI|MOD_RSFT)>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ The `Kconfig.shield` file defines any additional Kconfig settings that may be re
|
||||
|
||||
```
|
||||
config SHIELD_MY_BOARD
|
||||
def_bool $(shields_list_contains,my_board)
|
||||
def_bool $(shields_list_contains,my_board)
|
||||
```
|
||||
|
||||
This will make sure that a new configuration value named `SHIELD_MY_BOARD` is set to true whenever `my_board` is used as the shield name, either as the `SHIELD` variable [in a local build](build-flash.md) or in your `build.yaml` file [when using Github Actions](../customization). Note that this configuration value will be used in `Kconfig.defconfig` to set other properties about your shield, so make sure that they match.
|
||||
@@ -64,10 +64,10 @@ This will make sure that a new configuration value named `SHIELD_MY_BOARD` is se
|
||||
|
||||
```
|
||||
config SHIELD_MY_BOARD_LEFT
|
||||
def_bool $(shields_list_contains,my_board_left)
|
||||
def_bool $(shields_list_contains,my_board_left)
|
||||
|
||||
config SHIELD_MY_BOARD_RIGHT
|
||||
def_bool $(shields_list_contains,my_board_right)
|
||||
def_bool $(shields_list_contains,my_board_right)
|
||||
```
|
||||
|
||||
### Kconfig.defconfig
|
||||
@@ -87,7 +87,7 @@ The keyboard name must be less than or equal to 16 characters in length, otherwi
|
||||
if SHIELD_MY_BOARD
|
||||
|
||||
config ZMK_KEYBOARD_NAME
|
||||
default "My Board"
|
||||
default "My Board"
|
||||
|
||||
endif
|
||||
```
|
||||
@@ -101,17 +101,17 @@ Finally, you'll want to turn on the split option for both sides. This can all be
|
||||
if SHIELD_MY_BOARD_LEFT
|
||||
|
||||
config ZMK_KEYBOARD_NAME
|
||||
default "My Board"
|
||||
default "My Board"
|
||||
|
||||
config ZMK_SPLIT_ROLE_CENTRAL
|
||||
default y
|
||||
default y
|
||||
|
||||
endif
|
||||
|
||||
if SHIELD_MY_BOARD_LEFT || SHIELD_MY_BOARD_RIGHT
|
||||
|
||||
config ZMK_SPLIT
|
||||
default y
|
||||
default y
|
||||
|
||||
endif
|
||||
```
|
||||
@@ -134,13 +134,13 @@ this might look something like:
|
||||
|
||||
```
|
||||
/ {
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
};
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
};
|
||||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
label = "KSCAN";
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
label = "KSCAN";
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
@@ -149,12 +149,12 @@ this might look something like:
|
||||
, <&pro_micro 16 GPIO_ACTIVE_HIGH>
|
||||
;
|
||||
|
||||
row-gpios
|
||||
= <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
row-gpios
|
||||
= <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
;
|
||||
};
|
||||
;
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
@@ -174,43 +174,43 @@ For `col2row` directed boards like the iris, the shared .dtsi file may look like
|
||||
#include <dt-bindings/zmk/matrix_transform.h>
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix_transform = &default_transform;
|
||||
};
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix_transform = &default_transform;
|
||||
};
|
||||
|
||||
default_transform: keymap_transform_0 {
|
||||
compatible = "zmk,matrix-transform";
|
||||
columns = <16>;
|
||||
rows = <4>;
|
||||
default_transform: keymap_transform_0 {
|
||||
compatible = "zmk,matrix-transform";
|
||||
columns = <16>;
|
||||
rows = <4>;
|
||||
// | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 | | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 |
|
||||
// | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 | | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 |
|
||||
// | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 | | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 |
|
||||
// | SW24 | SW23 | SW22 | SW21 | SW20 | SW19 | SW25 | | SW25 | SW19 | SW20 | SW21 | SW22 | SW23 | SW24 |
|
||||
// | SW29 | SW28 | SW27 | SW26 | | SW26 | SW27 | SW28 | SW29 |
|
||||
map = <
|
||||
map = <
|
||||
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10) RC(0,11)
|
||||
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) RC(1,11)
|
||||
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11)
|
||||
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,2) RC(4,9) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11)
|
||||
RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8)
|
||||
>;
|
||||
};
|
||||
RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8)
|
||||
>;
|
||||
};
|
||||
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
label = "KSCAN";
|
||||
kscan0: kscan {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
label = "KSCAN";
|
||||
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
= <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // Row A from the schematic file
|
||||
, <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // Row B from the schematic file
|
||||
, <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // Row C from the schematic file
|
||||
, <&pro_micro 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // Row D from the schematic file
|
||||
, <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // Row E from the schematic file
|
||||
;
|
||||
diode-direction = "col2row";
|
||||
row-gpios
|
||||
= <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // Row A from the schematic file
|
||||
, <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // Row B from the schematic file
|
||||
, <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // Row C from the schematic file
|
||||
, <&pro_micro 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // Row D from the schematic file
|
||||
, <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // Row E from the schematic file
|
||||
;
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
@@ -230,14 +230,14 @@ This is exemplified with the iris .overlay files.
|
||||
#include "iris.dtsi" // Notice that the main dtsi files are included in the overlay.
|
||||
|
||||
&kscan0 {
|
||||
col-gpios
|
||||
= <&pro_micro 19 GPIO_ACTIVE_HIGH> // col1 in the schematic
|
||||
, <&pro_micro 18 GPIO_ACTIVE_HIGH> // col2 in the schematic
|
||||
, <&pro_micro 15 GPIO_ACTIVE_HIGH> // col3 in the schematic
|
||||
, <&pro_micro 14 GPIO_ACTIVE_HIGH> // col4 in the schematic
|
||||
, <&pro_micro 16 GPIO_ACTIVE_HIGH> // col5 in the schematic
|
||||
, <&pro_micro 10 GPIO_ACTIVE_HIGH> // col6 in the schematic
|
||||
;
|
||||
col-gpios
|
||||
= <&pro_micro 19 GPIO_ACTIVE_HIGH> // col1 in the schematic
|
||||
, <&pro_micro 18 GPIO_ACTIVE_HIGH> // col2 in the schematic
|
||||
, <&pro_micro 15 GPIO_ACTIVE_HIGH> // col3 in the schematic
|
||||
, <&pro_micro 14 GPIO_ACTIVE_HIGH> // col4 in the schematic
|
||||
, <&pro_micro 16 GPIO_ACTIVE_HIGH> // col5 in the schematic
|
||||
, <&pro_micro 10 GPIO_ACTIVE_HIGH> // col6 in the schematic
|
||||
;
|
||||
};
|
||||
```
|
||||
|
||||
@@ -247,18 +247,18 @@ This is exemplified with the iris .overlay files.
|
||||
#include "iris.dtsi"
|
||||
|
||||
&default_transform { // The matrix transform for this board is 6 columns over because the left half is 6 columns wide according to the matrix.
|
||||
col-offset = <6>;
|
||||
col-offset = <6>;
|
||||
};
|
||||
|
||||
&kscan0 {
|
||||
col-gpios
|
||||
= <&pro_micro 10 GPIO_ACTIVE_HIGH> // col6 in the schematic
|
||||
, <&pro_micro 16 GPIO_ACTIVE_HIGH> // col5 in the schematic
|
||||
, <&pro_micro 14 GPIO_ACTIVE_HIGH> // col4 in the schematic
|
||||
, <&pro_micro 15 GPIO_ACTIVE_HIGH> // col3 in the schematic
|
||||
, <&pro_micro 18 GPIO_ACTIVE_HIGH> // col2 in the schematic
|
||||
, <&pro_micro 19 GPIO_ACTIVE_HIGH> // col1 in the schematic
|
||||
;
|
||||
col-gpios
|
||||
= <&pro_micro 10 GPIO_ACTIVE_HIGH> // col6 in the schematic
|
||||
, <&pro_micro 16 GPIO_ACTIVE_HIGH> // col5 in the schematic
|
||||
, <&pro_micro 14 GPIO_ACTIVE_HIGH> // col4 in the schematic
|
||||
, <&pro_micro 15 GPIO_ACTIVE_HIGH> // col3 in the schematic
|
||||
, <&pro_micro 18 GPIO_ACTIVE_HIGH> // col2 in the schematic
|
||||
, <&pro_micro 19 GPIO_ACTIVE_HIGH> // col1 in the schematic
|
||||
;
|
||||
};
|
||||
|
||||
```
|
||||
@@ -316,28 +316,28 @@ Here is an example for the [nice60](https://github.com/Nicell/nice60), which use
|
||||
#include <dt-bindings/zmk/matrix_transform.h>
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix_transform = &default_transform;
|
||||
};
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix_transform = &default_transform;
|
||||
};
|
||||
|
||||
default_transform: keymap_transform_0 {
|
||||
compatible = "zmk,matrix-transform";
|
||||
columns = <8>;
|
||||
rows = <8>;
|
||||
default_transform: keymap_transform_0 {
|
||||
compatible = "zmk,matrix-transform";
|
||||
columns = <8>;
|
||||
rows = <8>;
|
||||
// | MX1 | MX2 | MX3 | MX4 | MX5 | MX6 | MX7 | MX8 | MX9 | MX10 | MX11 | MX12 | MX13 | MX14 |
|
||||
// | MX15 | MX16 | MX17 | MX18 | MX19 | MX20 | MX21 | MX22 | MX23 | MX34 | MX25 | MX26 | MX27 | MX28 |
|
||||
// | MX29 | MX30 | MX31 | MX32 | MX33 | MX34 | MX35 | MX36 | MX37 | MX38 | MX39 | MX40 | MX41 |
|
||||
// | MX42 | MX43 | MX44 | MX45 | MX46 | MX47 | MX48 | MX49 | MX50 | MX51 | MX52 | MX53 |
|
||||
// | MX54 | MX55 | MX56 | MX57 | MX58 | MX59 | MX60 | MX61 |
|
||||
map = <
|
||||
map = <
|
||||
RC(3,0) RC(2,0) RC(1,0) RC(0,0) RC(1,1) RC(0,1) RC(0,2) RC(1,3) RC(0,3) RC(1,4) RC(0,4) RC(0,5) RC(1,6) RC(1,7)
|
||||
RC(4,0) RC(4,1) RC(3,1) RC(2,1) RC(2,2) RC(1,2) RC(2,3) RC(3,4) RC(2,4) RC(2,5) RC(1,5) RC(2,6) RC(2,7) RC(3,7)
|
||||
RC(5,0) RC(5,1) RC(5,2) RC(4,2) RC(3,2) RC(4,3) RC(3,3) RC(4,4) RC(4,5) RC(3,5) RC(4,6) RC(3,6) RC(4,7)
|
||||
RC(6,0) RC(6,1) RC(6,2) RC(6,3) RC(5,3) RC(6,4) RC(5,4) RC(6,5) RC(5,5) RC(6,6) RC(5,6) RC(5,7)
|
||||
RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7,5) RC(7,6) RC(6,7) RC(7,7)
|
||||
>;
|
||||
};
|
||||
>;
|
||||
};
|
||||
```
|
||||
|
||||
Some important things to note:
|
||||
@@ -433,13 +433,13 @@ In your device tree file you will need to add the following lines to define the
|
||||
|
||||
```
|
||||
left_encoder: encoder_left {
|
||||
compatible = "alps,ec11";
|
||||
label = "LEFT_ENCODER";
|
||||
a-gpios = <PIN_A (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
|
||||
b-gpios = <PIN_B (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
|
||||
resolution = <4>;
|
||||
status = "disabled";
|
||||
};
|
||||
compatible = "alps,ec11";
|
||||
label = "LEFT_ENCODER";
|
||||
a-gpios = <PIN_A (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
|
||||
b-gpios = <PIN_B (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
|
||||
resolution = <4>;
|
||||
status = "disabled";
|
||||
};
|
||||
```
|
||||
|
||||
Here you will have to replace PIN_A and PIN_B with the appropriate pins that your PCB utilizes for the encoder(s). For keyboards that use the Pro Micro or any of the Pro Micro replacements, Sparkfun's [Pro Micro Hookup Guide](https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide/hardware-overview-pro-micro) has a pinout diagram that can be useful to determine the right pins. Reference either the blue numbers labeled "Arduino" (digital pins) or the green numbers labeled "Analog" (analog pins). For pins that are labeled as both digital and analog, refer to your specific board's .dtsi file to determine how you should refer to that pin.
|
||||
@@ -450,9 +450,9 @@ Once you have defined the encoder sensors, you will have to add them to the list
|
||||
|
||||
```
|
||||
sensors {
|
||||
compatible = "zmk,keymap-sensors";
|
||||
sensors = <&left_encoder &right_encoder>;
|
||||
};
|
||||
compatible = "zmk,keymap-sensors";
|
||||
sensors = <&left_encoder &right_encoder>;
|
||||
};
|
||||
```
|
||||
|
||||
In this example, a left_encoder and right_encoder are both added. Additional encoders can be added with spaces separating each, and the order they are added here determines the order in which you define their behavior in your keymap.
|
||||
@@ -463,7 +463,7 @@ Add the following lines to your overlay file(s) to enable the encoder:
|
||||
|
||||
```
|
||||
&left_encoder {
|
||||
status = "okay";
|
||||
status = "okay";
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
@@ -62,9 +62,9 @@ Then you have to add the following lines to your `.dts` file:
|
||||
|
||||
```
|
||||
&pwm0 {
|
||||
status = "okay";
|
||||
ch0-pin = <45>;
|
||||
/* ch0-inverted; */
|
||||
status = "okay";
|
||||
ch0-pin = <45>;
|
||||
/* ch0-inverted; */
|
||||
};
|
||||
```
|
||||
|
||||
@@ -84,7 +84,7 @@ Then you have to add the following lines inside the root devicetree node on the
|
||||
label = "Backlight LEDs";
|
||||
pwm_led_0 {
|
||||
pwms = <&pwm0 45>;
|
||||
label = "Backlight LED 0";
|
||||
label = "Backlight LED 0";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -129,9 +129,9 @@ Then add the following lines to your `.overlay` file:
|
||||
|
||||
```
|
||||
&pwm0 {
|
||||
status = "okay";
|
||||
ch0-pin = <45>;
|
||||
/* ch0-inverted; */
|
||||
status = "okay";
|
||||
ch0-pin = <45>;
|
||||
/* ch0-inverted; */
|
||||
};
|
||||
```
|
||||
|
||||
@@ -151,7 +151,7 @@ Then you have to add the following lines inside the root devicetree node on the
|
||||
label = "Backlight LEDs";
|
||||
pwm_led_0 {
|
||||
pwms = <&pwm0 45>;
|
||||
label = "Backlight LED 0";
|
||||
label = "Backlight LED 0";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -182,7 +182,7 @@ Optionally, on Pro Micro compatible shields you can add a LED GPIO node to your
|
||||
label = "Backlight LEDs";
|
||||
gpio_led_0 {
|
||||
gpios = <&pro_micro 20 GPIO_ACTIVE_HIGH>;
|
||||
label = "Backlight LED 0";
|
||||
label = "Backlight LED 0";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -201,10 +201,10 @@ In order to do that, first you need to enable PWM for each pin:
|
||||
|
||||
```
|
||||
&pwm0 {
|
||||
status = "okay";
|
||||
ch0-pin = <45>; /* LED 0 */
|
||||
ch1-pin = <46>; /* LED 1 */
|
||||
ch2-pin = <47>; /* LED 2 */
|
||||
status = "okay";
|
||||
ch0-pin = <45>; /* LED 0 */
|
||||
ch1-pin = <46>; /* LED 1 */
|
||||
ch2-pin = <47>; /* LED 2 */
|
||||
...
|
||||
};
|
||||
```
|
||||
|
||||
@@ -12,14 +12,14 @@ Combos configured in your `.keymap` file, but are separate from the `keymap` nod
|
||||
|
||||
```
|
||||
/ {
|
||||
combos {
|
||||
compatible = "zmk,combos";
|
||||
combo_esc {
|
||||
timeout-ms = <50>;
|
||||
key-positions = <0 1>;
|
||||
bindings = <&kp ESC>;
|
||||
};
|
||||
};
|
||||
combos {
|
||||
compatible = "zmk,combos";
|
||||
combo_esc {
|
||||
timeout-ms = <50>;
|
||||
key-positions = <0 1>;
|
||||
bindings = <&kp ESC>;
|
||||
};
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
@@ -113,10 +113,10 @@ Nested under the devicetree root, is the keymap node. The node _name_ itself is
|
||||
|
||||
```
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
compatible = "zmk,keymap";
|
||||
|
||||
// Layer nodes go here!
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
### Layers
|
||||
|
||||
@@ -60,18 +60,18 @@ Here's an example on a definition that uses P0.06:
|
||||
#include <dt-bindings/led/led.h>
|
||||
|
||||
&pinctrl {
|
||||
spi3_default: spi3_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_MOSI, 0, 6)>;
|
||||
};
|
||||
};
|
||||
spi3_default: spi3_default {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_MOSI, 0, 6)>;
|
||||
};
|
||||
};
|
||||
|
||||
spi3_sleep: spi3_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_MOSI, 0, 6)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
spi3_sleep: spi3_sleep {
|
||||
group1 {
|
||||
psels = <NRF_PSEL(SPIM_MOSI, 0, 6)>;
|
||||
low-power-enable;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&spi3 {
|
||||
@@ -149,9 +149,9 @@ Once you have your `led_strip` properly defined you need to add it to the root d
|
||||
|
||||
```
|
||||
/ {
|
||||
chosen {
|
||||
zmk,underglow = &led_strip;
|
||||
};
|
||||
chosen {
|
||||
zmk,underglow = &led_strip;
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
@@ -3,24 +3,24 @@
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
|
||||
/ {
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
|
||||
default_layer {
|
||||
default_layer {
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// | ESC | Q | W | E | R | T | | Y | U | I | O | P | \ |
|
||||
// | TAB | A | S | D | F | G | | H | J | K | L | ; | ' |
|
||||
// | SHIFT | Z | X | C | V | B | CTRL+A | CTRL+C | | CTRL+V | CTRL+X | N | M | , | . | / | R CTRL |
|
||||
// | GUI | DEL | RETURN | SPACE | ESCAPE | | RETURN | SPACE | TAB | BSPC | R ALT |
|
||||
bindings = <
|
||||
bindings = <
|
||||
&kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH
|
||||
&kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT
|
||||
&kp LSHIFT &kp Z &kp X &kp C &kp V &kp B &kp LC(A) &kp LC(C) &kp LC(V) &kp LC(X) &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RCTRL
|
||||
&kp LGUI &kp DEL &kp RET &kp SPACE &kp ESC &kp RET &kp SPACE &kp TAB &kp BSPC &kp RALT
|
||||
>;
|
||||
>;
|
||||
|
||||
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN>;
|
||||
};
|
||||
};
|
||||
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN>;
|
||||
};
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
```
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
|
||||
default_layer {
|
||||
default_layer {
|
||||
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// | ESC | Q | W | E | R | T | | Y | U | I | O | P | \ |
|
||||
// | TAB | A | S | D | F | G | | H | J | K | L | ; | ' |
|
||||
// | SHIFT | Z | X | C | V | B | CTRL+A | CTRL+C | | CTRL+V | CTRL+X | N | M | , | . | / | R CTRL |
|
||||
// | GUI | DEL | RETURN | SPACE | ESCAPE | | RETURN | SPACE | TAB | BSPC | R ALT |
|
||||
bindings = <
|
||||
bindings = <
|
||||
&kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH
|
||||
&kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT
|
||||
&kp LSHIFT &kp Z &kp X &kp C &kp V &kp B &kp LC(A) &kp LC(C) &kp LC(V) &kp LC(X) &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RCTRL
|
||||
&kp LGUI &kp DEL &kp RET &kp SPACE &kp ESC &kp RET &kp SPACE &kp TAB &kp BSPC &kp RALT
|
||||
>;
|
||||
>;
|
||||
|
||||
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN>;
|
||||
};
|
||||
};
|
||||
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN>;
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user