Browse Source

Merge branch 'main' into CrossR/Sofle

xmkb
CrossR 4 years ago
parent
commit
6be07b5b24
  1. 1
      .github/workflows/build.yml
  2. 5
      app/boards/arm/nrfmicro/Kconfig
  3. 9
      app/boards/arm/nrfmicro/Kconfig.defconfig
  4. 6
      app/boards/arm/nrfmicro/pinmux.c
  5. 3
      app/boards/native_posix.conf
  6. 73
      app/boards/native_posix.overlay
  7. 2
      app/boards/shields/lily58/lily58.dtsi
  8. 9
      app/boards/shields/qaz/Kconfig.defconfig
  9. 5
      app/boards/shields/qaz/Kconfig.shield
  10. 44
      app/boards/shields/qaz/qaz.keymap
  11. 53
      app/boards/shields/qaz/qaz.overlay
  12. 10
      app/boards/shields/romac/Kconfig.defconfig
  13. 5
      app/boards/shields/romac/Kconfig.shield
  14. 0
      app/boards/shields/romac/romac.conf
  15. 46
      app/boards/shields/romac/romac.keymap
  16. 40
      app/boards/shields/romac/romac.overlay
  17. 22
      app/boards/shields/splitreus62/Kconfig.defconfig
  18. 8
      app/boards/shields/splitreus62/Kconfig.shield
  19. 0
      app/boards/shields/splitreus62/splitreus62.conf
  20. 50
      app/boards/shields/splitreus62/splitreus62.dtsi
  21. 31
      app/boards/shields/splitreus62/splitreus62.keymap
  22. 2
      app/boards/shields/splitreus62/splitreus62_left.conf
  23. 18
      app/boards/shields/splitreus62/splitreus62_left.overlay
  24. 2
      app/boards/shields/splitreus62/splitreus62_right.conf
  25. 22
      app/boards/shields/splitreus62/splitreus62_right.overlay
  26. 2
      app/dts/bindings/zmk,kscan-mock.yaml
  27. 0
      app/include/dt-bindings/zmk/kscan-mock.h
  28. 0
      app/prj.conf
  29. 40
      app/run-test.sh
  30. 4
      app/src/behaviors/behavior_mod_tap.c
  31. 4
      app/src/behaviors/behavior_none.c
  32. 19
      app/src/behaviors/behavior_toggle_layer.c
  33. 15
      app/src/kscan_mock.c
  34. 28
      app/tests/keypress/behavior_keymap.dtsi
  35. 1
      app/tests/keypress/cp-press-release/events.patterns
  36. 2
      app/tests/keypress/cp-press-release/keycode_events.snapshot
  37. 5
      app/tests/keypress/cp-press-release/native_posix.keymap
  38. 1
      app/tests/keypress/kp-press-release/events.patterns
  39. 2
      app/tests/keypress/kp-press-release/keycode_events.snapshot
  40. 8
      app/tests/keypress/kp-press-release/native_posix.keymap
  41. 28
      app/tests/momentary-layer/behavior_keymap.dtsi
  42. 2
      app/tests/momentary-layer/early-key-release/events.patterns
  43. 4
      app/tests/momentary-layer/early-key-release/keycode_events.snapshot
  44. 8
      app/tests/momentary-layer/early-key-release/native_posix.keymap
  45. 0
      app/tests/momentary-layer/early-key-release/pending
  46. 2
      app/tests/momentary-layer/normal/events.patterns
  47. 4
      app/tests/momentary-layer/normal/keycode_events.snapshot
  48. 8
      app/tests/momentary-layer/normal/native_posix.keymap
  49. 22
      app/tests/none/behavior_keymap.dtsi
  50. 1
      app/tests/none/layered/events.patterns
  51. 0
      app/tests/none/layered/keycode_events.snapshot
  52. 8
      app/tests/none/layered/native_posix.keymap
  53. 1
      app/tests/none/normal/events.patterns
  54. 0
      app/tests/none/normal/keycode_events.snapshot
  55. 8
      app/tests/none/normal/native_posix.keymap
  56. 28
      app/tests/toggle-layer/behavior_keymap.dtsi
  57. 2
      app/tests/toggle-layer/early-key-release/events.patterns
  58. 6
      app/tests/toggle-layer/early-key-release/keycode_events.snapshot
  59. 9
      app/tests/toggle-layer/early-key-release/native_posix.keymap
  60. 0
      app/tests/toggle-layer/early-key-release/pending
  61. 2
      app/tests/toggle-layer/normal/events.patterns
  62. 4
      app/tests/toggle-layer/normal/keycode_events.snapshot
  63. 8
      app/tests/toggle-layer/normal/native_posix.keymap
  64. 22
      app/tests/transparent/behavior_keymap.dtsi
  65. 1
      app/tests/transparent/layered/events.patterns
  66. 2
      app/tests/transparent/layered/keycode_events.snapshot
  67. 8
      app/tests/transparent/layered/native_posix.keymap
  68. 1
      app/tests/transparent/normal/events.patterns
  69. 0
      app/tests/transparent/normal/keycode_events.snapshot
  70. 8
      app/tests/transparent/normal/native_posix.keymap
  71. 3
      docs/docs/dev-setup.md
  72. 20
      docs/docs/dev-tests.md
  73. 1
      docs/sidebars.js
  74. 3
      docs/static/setup.sh

1
.github/workflows/build.yml

@ -16,6 +16,7 @@ jobs: @@ -16,6 +16,7 @@ jobs:
- kyria_right
- lily58_left
- lily58_right
- romac
include:
- board: proton_c
shield: clueboard_california

5
app/boards/arm/nrfmicro/Kconfig

@ -3,3 +3,8 @@ config BOARD_ENABLE_DCDC @@ -3,3 +3,8 @@ config BOARD_ENABLE_DCDC
select SOC_DCDC_NRF52X
default y
depends on (BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13)
config BOARD_NRFMICRO_CHARGER
bool "Enable battery charger"
default y
depends on (BOARD_NRFMICRO_13)

9
app/boards/arm/nrfmicro/Kconfig.defconfig

@ -29,5 +29,12 @@ config ZMK_USB @@ -29,5 +29,12 @@ config ZMK_USB
config PINMUX
default y
if BOARD_NRFMICRO_13
config BOARD_NRFMICRO_CHARGER
default y
endif # BOARD_NRFMICRO_13
endif # BOARD_NRFMICRO_11 || BOARD_NRFMICRO_11_FLIPPED || BOARD_NRFMICRO_13

6
app/boards/arm/nrfmicro/pinmux.c

@ -23,9 +23,13 @@ static int pinmux_nrfmicro_init(struct device *port) @@ -23,9 +23,13 @@ static int pinmux_nrfmicro_init(struct device *port)
gpio_pin_configure(p1, 9, GPIO_OUTPUT);
gpio_pin_set(p1, 9, 0);
// enable charger (nRFMicro 1.3 only)
#if CONFIG_BOARD_NRFMICRO_CHARGER
gpio_pin_configure(p0, 5, GPIO_OUTPUT);
gpio_pin_set(p0, 5, 0);
#else
gpio_pin_configure(p0, 5, GPIO_INPUT);
#endif
#else
// enable EXT_VCC (use 0 for nRFMicro 1.3, use 1 for nRFMicro 1.1)
gpio_pin_configure(p1, 9, GPIO_OUTPUT);

3
app/boards/native_posix.conf

@ -1,9 +1,8 @@ @@ -1,9 +1,8 @@
CONFIG_KSCAN=n
CONFIG_ZMK_KSCAN_MOCK_DRIVER=y
CONFIG_ZMK_KSCAN_COMPOSITE_DRIVER=y
CONFIG_ZMK_KSCAN_GPIO_DRIVER=n
CONFIG_GPIO=n
CONFIG_ZMK_BLE=n
CONFIG_LOG=y
CONFIG_KSCAN_LOG_LEVEL_DBG=y
CONFIG_LOG_BACKEND_SHOW_COLOR=n
CONFIG_ZMK_LOG_LEVEL_DBG=y

73
app/boards/native_posix.overlay

@ -1,79 +1,18 @@ @@ -1,79 +1,18 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <zmk/kscan-mock.h>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/kscan-mock.h>
/ {
chosen {
zmk,kscan = &kscan0;
zmk,keymap = &keymap0;
};
kscan0: kscan_0 {
compatible = "zmk,kscan-composite";
label = "KSCAN_COMP";
rows = <2>;
columns = <4>;
left: left {
kscan = <&left_hand>;
};
right: right {
kscan = <&right_hand>;
column-offset = <2>;
};
zmk,kscan = &kscan;
};
left_hand: kscan_1 {
kscan: kscan {
compatible = "zmk,kscan-mock";
label = "KSCAN_LEFT";
label = "KSCAN_MOCK";
rows = <2>;
columns = <2>;
events = <ZMK_MOCK_PRESS(0,1,300) ZMK_MOCK_PRESS(0,0,300) ZMK_MOCK_RELEASE(0,0,300) ZMK_MOCK_RELEASE(0,1,300)>;
// events = <ZMK_MOCK_PRESS(0,0,800) ZMK_MOCK_RELEASE(0,0,800) ZMK_MOCK_PRESS(0,1,800) ZMK_MOCK_RELEASE(0,1,800)>;
};
right_hand: kscan_2 {
compatible = "zmk,kscan-mock";
label = "KSCAN_RIGHT";
rows = <2>;
columns = <2>;
events = <ZMK_MOCK_PRESS(1,1,800) ZMK_MOCK_RELEASE(1,1,100) ZMK_MOCK_PRESS(0,1,800) ZMK_MOCK_RELEASE(0,1,100)>;
};
keymap0: keymap {
compatible = "zmk,keymap";
label ="Default keymap";
layers = <&default &lower &raise>;
};
layers {
compatible = "zmk,layers";
default: layer_0 {
label = "DEFAULT";
bindings = <
&kp B &mo 1 &kp C &kp E
&kp D &kp G &kp F &kp Q>;
};
lower: layer_1 {
label = "LOWER";
bindings = <
&cp M_NEXT &trans &kp O &kp Q
&kp L &kp J &kp P &kp K>;
};
raise: layer_2 {
label = "RAISE";
bindings = <
&kp W &kp U &kp I &kp N
&kp X &kp M &kp C &kp B>;
};
exit-after;
};
};

2
app/boards/shields/lily58/lily58.dtsi

@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <16>;
rows = <4>;
rows = <5>;
// | 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 |

9
app/boards/shields/qaz/Kconfig.defconfig

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
# Copyright (c) 2020 TJ Campie
# SPDX-License-Identifier: MIT
if SHIELD_QAZ
config ZMK_KEYBOARD_NAME
default "QAZ"
endif

5
app/boards/shields/qaz/Kconfig.shield

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
# Copyright (c) 2020 TJ Campie
# SPDX-License-Identifier: MIT
config SHIELD_MY_BOARD
def_bool $(shields_list_contains,qaz)

44
app/boards/shields/qaz/qaz.keymap

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
/*
* Copyright (c) 2020 TJ Campie
*
* SPDX-License-Identifier: MIT
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#define DEFAULT 0
#define NUM_SYM 1
#define NAV 2
/ {
keymap {
compatible = "zmk,keymap";
default_layer {
bindings = <
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P
&kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp RET
&kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp CMMA &kp DOT
&kp LSFT &kp LGUI &kp LALT &mo NAV &kp SPC &mo NUM_SYM &kp QUOT &kp FSLH
>;
};
num_sym {
bindings = <
&kp NUM_1 &kp NUM_2 &kp NUM_3 &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp NUM_0
&trans &trans &trans &trans &trans &trans &trans &trans &kp EQL &kp MINUS
&kp DEL &none &none &none &none &none &none &none &kp DOT
&bootloader &reset &none &trans &trans &kp RET &trans &kp FSLH
>;
};
nav {
bindings = <
&none &none &none &none &none &none &none &kp UARW &none &kp BKSP
&trans &trans &trans &trans &none &none &kp LARW &kp DARW &kp RARW &none
&none &none &none &none &none &none &none &none &none
&none &none &none &none &none &trans &trans &kp RET &trans &kp FSLH
>;
};
};
};

53
app/boards/shields/qaz/qaz.overlay

@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
/*
* Copyright (c) 2020 TJ Campie
*
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/zmk/matrix-transform.h>
/ {
chosen {
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;
};
default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <7>;
rows = <6>;
map = <
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(4,0) RC(4,1) RC(4,2)
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(5,0) RC(5,1) RC(5,2)
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(4,3) RC(5,3)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(4,4)
>;
};
kscan0: kscan_0 {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
col-gpios
= <&pro_micro_d 8 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 1 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 0 GPIO_ACTIVE_HIGH>
, <&pro_micro_a 2 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 9 GPIO_ACTIVE_HIGH>
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 6 GPIO_ACTIVE_HIGH>
;
row-gpios
= <&pro_micro_a 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
};

10
app/boards/shields/romac/Kconfig.defconfig

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
# Copyright (c) 2020 Pete Johanson, Richard Jones
# SPDX-License-Identifier: MIT
if SHIELD_ROMAC
config ZMK_KEYBOARD_NAME
default "RoMac"
endif

5
app/boards/shields/romac/Kconfig.shield

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
# Copyright (c) 2020 Pete Johanson, Richard Jones
# SPDX-License-Identifier: MIT
config SHIELD_ROMAC
def_bool $(shields_list_contains,romac)

0
app/boards/shields/romac/romac.conf

46
app/boards/shields/romac/romac.keymap

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
/*
* Copyright (c) 2020 Pete Johanson, Richard Jones
*
* SPDX-License-Identifier: MIT
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
/ {
keymap {
compatible = "zmk,keymap";
default_layer {
// -------------------
// | 7 | 8 | 9 |
// | 4 | 5 | 6 |
// | 1 | 2 | 3 |
// | MO(1) | 0 | . |
// ----------------------
bindings = <
&kp NUM_7 &kp NUM_8 &kp NUM_9
&kp NUM_4 &kp NUM_5 &kp NUM_6
&kp NUM_1 &kp NUM_2 &kp NUM_3
&mo 1 &kp NUM_0 &kp DOT
>;
};
nav_layer {
// -----------------------
// | _ | HOME | PGUP |
// | _ | END | PGDN |
// | _ | _ | _ |
// | _ | _ | RET |
// -----------------------
bindings = <
&trans &kp HOME &kp PGUP
&trans &kp END &kp PGDN
&trans &trans &trans
&trans &trans &kp RET
>;
};
};
};

40
app/boards/shields/romac/romac.overlay

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
/*
* Copyright (c) 2020 Pete Johanson, Richard Jones
*
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/zmk/matrix-transform.h>
/ {
chosen {
zmk,kscan = &kscan0;
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
row-gpios
= <&pro_micro_d 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
col-gpios
= <&pro_micro_a 0 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 15 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 14 GPIO_ACTIVE_HIGH>
;
};
bt_unpair_combo: bt_unpair_combo {
compatible = "zmk,bt-unpair-combo";
key-positions = <0 11>;
};
};

22
app/boards/shields/splitreus62/Kconfig.defconfig

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
#Copyright (c) 2020 Derek Schmell
#SPDX-License-Identifier: MIT
if SHIELD_SPLITREUS62_LEFT
config ZMK_KEYBOARD_NAME
default "Splitreus62 Left"
endif
if SHIELD_SPLITREUS62_RIGHT
config ZMK_KEYBOARD_NAME
default "Splitreus62 Right"
endif
if SHIELD_SPLITREUS62_LEFT || SHIELD_SPLITREUS62_RIGHT
endif

8
app/boards/shields/splitreus62/Kconfig.shield

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
# Copyright (c) 2020 Derek Schmell
# SPDX-License-Identifier: MIT
config SHIELD_SPLITREUS62_LEFT
def_bool $(shields_list_contains,splitreus62_left)
config SHIELD_SPLITREUS62_RIGHT
def_bool $(shields_list_contains,splitreus62_right)

0
app/boards/shields/splitreus62/splitreus62.conf

50
app/boards/shields/splitreus62/splitreus62.dtsi

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
/*
* Copyright (c) 2020 Derek Schmell
*
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/zmk/matrix-transform.h>
/ {
chosen {
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;
};
default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <12>;
rows = <6>;
// | SW0 | SW5 | SW10 | SW15 | SW20 | SW25 | SW25 | SW20 | SW15 | SW10 | SW5 | SW1 |
// | SW1 | SW6 | SW11 | SW16 | SW21 | SW26 | SW26 | SW21 | SW16 | SW11 | SW6 | SW2 |
// | SW2 | SW7 | SW12 | SW17 | SW22 | SW27 | SW27 | SW22 | SW17 | SW12 | SW7 | SW3 |
// | SW3 | SW8 | SW13 | SW18 | SW23 | SW28 | SW28 | SW23 | SW18 | SW13 | SW8 | SW4 |
// | SW4 | SW9 | SW14 | SW19 | SW24 | SW29 | SW29 | SW24 | SW19 | SW14 | SW9 | SW5 |
// SW30 | SW30
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(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11)
RC(5,5) RC(5,6)
>;
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "row2col";
row-gpios
= <&pro_micro_d 1 GPIO_ACTIVE_HIGH >
, <&pro_micro_d 0 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 2 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 4 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 5 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 6 GPIO_ACTIVE_HIGH>
;
};
};

31
app/boards/shields/splitreus62/splitreus62.keymap

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
/*
* Copyright (c) 2020 Derek Schmell
*
* SPDX-License-Identifier: MIT
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
/ {
keymap {
compatible = "zmk,keymap";
default_layer {
// ------------------------------------------------------------------------------------------------------------
// | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - |
// | TAB | Q | W | E | R | T | | Y | U | I | O | P | \ |
// | CTRL | A | S | D | F | G | | H | J | K | L | ; | ' |
// | SHIFT | Z | X | C | V | B | | N | M | , | . | / | SHIFT |
// | LCTL | LGUI | LALT | GRAV | | EQL | DEL | BKSP| | RET | SPC | LBKT | RBKT | LBKT | HOME | END |
bindings = <
&kp ESC &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp NUM_0 &kp MINUS
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSLH
&kp LCTL &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SCLN &kp QUOT
&kp LSFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp CMMA &kp DOT &kp FSLH &kp RSFT
&kp LCTL &kp LGUI &kp LALT &kp GRAV &kp EQL &kp DEL &kp SPC &kp LBKT &kp RBKT &kp MINUS &kp HOME &kp END
&kp BKSP &kp RET
>;
};
};
};

2
app/boards/shields/splitreus62/splitreus62_left.conf

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y

18
app/boards/shields/splitreus62/splitreus62_left.overlay

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
/*
* Copyright (c) 2020 Derek Schmell
*
* SPDX-License-Identifier: MIT
*/
#include "splitreus62.dtsi"
&kscan0 {
col-gpios
= <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};

2
app/boards/shields/splitreus62/splitreus62_right.conf

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y

22
app/boards/shields/splitreus62/splitreus62_right.overlay

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
/*
* Copyright (c) 2020 Derek Schmell
*
* SPDX-License-Identifier: MIT
*/
#include "splitreus62.dtsi"
&default_transform {
col-offset = <6>;
};
&kscan0 {
col-gpios
= <&pro_micro_d 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};

2
app/dts/bindings/zmk,kscan-mock.yaml

@ -15,3 +15,5 @@ properties: @@ -15,3 +15,5 @@ properties:
type: int
columns:
type: int
exit-after:
type: boolean

0
app/include/zmk/kscan-mock.h → app/include/dt-bindings/zmk/kscan-mock.h

0
app/prj.conf

40
app/run-test.sh

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
#!/bin/sh
#
# Copyright (c) 2020 Peter Johanson; Cody McGinnis
#
# SPDX-License-Identifier: MIT
#
if [ -z "$1" ]; then
echo "Usage: ./run-test.sh <path to testcase>"
exit 1
elif [ "$1" = "all" ]; then
echo "" > ./build/tests/pass-fail.log
find tests -name native_posix.keymap -exec dirname \{\} \; | xargs -l -P 4 ./run-test.sh
err=$?
sort -k2 ./build/tests/pass-fail.log
exit $err
fi
testcase="$1"
echo "Running $testcase:"
west build -d build/$testcase -b native_posix -- -DZMK_CONFIG=$testcase > /dev/null 2>&1
if [ $? -gt 0 ]; then
echo "FAIL: $testcase did not build" >> ./build/tests/pass-fail.log
else
./build/$testcase/zephyr/zmk.exe | sed -e "s/.*> //" | tee build/$testcase/keycode_events_full.log | sed -n -f $testcase/events.patterns > build/$testcase/keycode_events.log
diff -au $testcase/keycode_events.snapshot build/$testcase/keycode_events.log
if [ $? -gt 0 ]; then
if [ -f $testcase/pending ]; then
echo "PEND: $testcase" >> ./build/tests/pass-fail.log
exit 0
else
echo "FAIL: $testcase" >> ./build/tests/pass-fail.log
exit 1
fi
else
echo "PASS: $testcase" >> ./build/tests/pass-fail.log
exit 0
fi
fi

4
app/src/behaviors/behavior_mod_tap.c

@ -193,8 +193,8 @@ static int on_keymap_binding_released(struct device *dev, u32_t position, u32_t @@ -193,8 +193,8 @@ static int on_keymap_binding_released(struct device *dev, u32_t position, u32_t
}
struct keycode_state_changed *ev = data->captured_keycode_events[j].event;
data->captured_keycode_events[i].event = NULL;
data->captured_keycode_events[i].active_mods = 0;
data->captured_keycode_events[j].event = NULL;
data->captured_keycode_events[j].active_mods = 0;
LOG_DBG("Re-sending latched key press for usage page 0x%02X keycode 0x%02X state %s", ev->usage_page, ev->keycode, (ev->state ? "pressed" : "released"));
ZMK_EVENT_RELEASE(ev);
k_msleep(10);

4
app/src/behaviors/behavior_none.c

@ -23,12 +23,12 @@ static int behavior_none_init(struct device *dev) @@ -23,12 +23,12 @@ static int behavior_none_init(struct device *dev)
static int on_keymap_binding_pressed(struct device *dev, u32_t position, u32_t _param1, u32_t _param2)
{
return 1;
return 0;
}
static int on_keymap_binding_released(struct device *dev, u32_t position, u32_t _param1, u32_t _param2)
{
return 1;
return 0;
}
static const struct behavior_driver_api behavior_none_driver_api = {

19
app/src/behaviors/behavior_toggle_layer.c

@ -14,28 +14,35 @@ @@ -14,28 +14,35 @@
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
struct behavior_tog_config { };
struct behavior_tog_data { };
struct behavior_tog_config
{
};
struct behavior_tog_data
{
};
static int behavior_tog_init(struct device *dev)
{
return 0;
return 0;
};
static int tog_keymap_binding_pressed(struct device *dev, u32_t position, u32_t layer, u32_t _)
{
LOG_DBG("position %d layer %d", position, layer);
return zmk_keymap_layer_toggle(layer);
}
static int tog_keymap_binding_released(struct device *dev, u32_t position, u32_t layer, u32_t _)
{
LOG_DBG("position %d layer %d", position, layer);
return 0;
}
static const struct behavior_driver_api behavior_tog_driver_api = {
.binding_pressed = tog_keymap_binding_pressed,
.binding_released = tog_keymap_binding_released,
.binding_pressed = tog_keymap_binding_pressed,
.binding_released = tog_keymap_binding_released,
};
static const struct behavior_tog_config behavior_tog_config = {};

15
app/src/kscan_mock.c

@ -6,13 +6,14 @@ @@ -6,13 +6,14 @@
#define DT_DRV_COMPAT zmk_kscan_mock
#include <stdlib.h>
#include <device.h>
#include <drivers/kscan.h>
#include <logging/log.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <zmk/kscan-mock.h>
#include <dt-bindings/zmk/kscan-mock.h>
struct kscan_mock_data
{
@ -50,6 +51,7 @@ static int kscan_mock_configure(struct device *dev, kscan_callback_t callback) @@ -50,6 +51,7 @@ static int kscan_mock_configure(struct device *dev, kscan_callback_t callback)
struct kscan_mock_config_##n \
{ \
u32_t events[DT_INST_PROP_LEN(n, events)]; \
bool exit_after; \
}; \
static void kscan_mock_schedule_next_event_##n(struct device *dev) \
{ \
@ -60,6 +62,9 @@ static int kscan_mock_configure(struct device *dev, kscan_callback_t callback) @@ -60,6 +62,9 @@ static int kscan_mock_configure(struct device *dev, kscan_callback_t callback)
u32_t ev = cfg->events[data->event_index]; \
LOG_DBG("delaying next keypress: %d", ZMK_MOCK_MSEC(ev)); \
k_delayed_work_submit(&data->work, K_MSEC(ZMK_MOCK_MSEC(ev))); \
} else if (cfg->exit_after) { \
LOG_DBG("Exiting"); \
exit(0); \
} \
} \
static void kscan_mock_work_handler_##n(struct k_work *work) \
@ -67,12 +72,13 @@ static int kscan_mock_configure(struct device *dev, kscan_callback_t callback) @@ -67,12 +72,13 @@ static int kscan_mock_configure(struct device *dev, kscan_callback_t callback)
struct kscan_mock_data *data = \
CONTAINER_OF(work, struct kscan_mock_data, work); \
const struct kscan_mock_config_##n *cfg = data->dev->config_info; \
u32_t ev = cfg->events[data->event_index++]; \
u32_t ev = cfg->events[data->event_index]; \
LOG_DBG("ev %u row %d column %d state %d\n", ev, \
ZMK_MOCK_ROW(ev), ZMK_MOCK_COL(ev), ZMK_MOCK_IS_PRESS(ev)); \
data->callback(data->dev, \
ZMK_MOCK_ROW(ev), ZMK_MOCK_COL(ev), ZMK_MOCK_IS_PRESS(ev)); \
kscan_mock_schedule_next_event_##n(data->dev); \
data->event_index++; \
} \
static int kscan_mock_init_##n(struct device *dev) \
{ \
@ -93,11 +99,12 @@ static int kscan_mock_configure(struct device *dev, kscan_callback_t callback) @@ -93,11 +99,12 @@ static int kscan_mock_configure(struct device *dev, kscan_callback_t callback)
}; \
static struct kscan_mock_data kscan_mock_data_##n; \
static const struct kscan_mock_config_##n kscan_mock_config_##n = { \
.events = DT_INST_PROP(n, events)}; \
.events = DT_INST_PROP(n, events), \
.exit_after = DT_INST_PROP(n, exit_after) }; \
DEVICE_AND_API_INIT(kscan_mock_##n, DT_INST_LABEL(n), kscan_mock_init_##n, \
&kscan_mock_data_##n, \
&kscan_mock_config_##n, \
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
&mock_driver_api_##n);
DT_INST_FOREACH_STATUS_OKAY(MOCK_INST_INIT)
DT_INST_FOREACH_STATUS_OKAY(MOCK_INST_INIT)

28
app/tests/keypress/behavior_keymap.dtsi

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
/ {
keymap {
compatible = "zmk,keymap";
label ="Default keymap";
default_layer {
bindings = <
&kp B &mo 1
&kp D &kp G>;
};
lower_layer {
bindings = <
&cp M_NEXT &trans
&kp L &kp J>;
};
raise_layer {
bindings = <
&kp W &kp U
&kp X &kp M>;
};
};
};

1
app/tests/keypress/cp-press-release/events.patterns

@ -0,0 +1 @@ @@ -0,0 +1 @@
s/.*hid_listener_keycode_//p

2
app/tests/keypress/cp-press-release/keycode_events.snapshot

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
pressed: usage_page 0x0c keycode 0xb5
released: usage_page 0x0c keycode 0xb5

5
app/tests/keypress/cp-press-release/native_posix.keymap

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
#include "../behavior_keymap.dtsi"
&kscan {
events = <ZMK_MOCK_PRESS(0,1,10) ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_RELEASE(0,0,10) ZMK_MOCK_RELEASE(0,1,10)>;
};

1
app/tests/keypress/kp-press-release/events.patterns

@ -0,0 +1 @@ @@ -0,0 +1 @@
s/.*hid_listener_keycode_//p

2
app/tests/keypress/kp-press-release/keycode_events.snapshot

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
pressed: usage_page 0x0c keycode 0xb5
released: usage_page 0x0c keycode 0xb5

8
app/tests/keypress/kp-press-release/native_posix.keymap

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
#include "../behavior_keymap.dtsi"
&kscan {
events = <ZMK_MOCK_PRESS(0,1,10) ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_RELEASE(0,0,10) ZMK_MOCK_RELEASE(0,1,10)>;
};

28
app/tests/momentary-layer/behavior_keymap.dtsi

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
/ {
keymap {
compatible = "zmk,keymap";
label ="Default keymap";
default_layer {
bindings = <
&kp B &mo 1
&kp D &kp G>;
};
lower_layer {
bindings = <
&cp M_NEXT &trans
&kp L &kp J>;
};
raise_layer {
bindings = <
&kp W &kp U
&kp X &kp M>;
};
};
};

2
app/tests/momentary-layer/early-key-release/events.patterns

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
s/.*hid_listener_keycode/kp/p
s/.*mo_keymap_binding/mo/p

4
app/tests/momentary-layer/early-key-release/keycode_events.snapshot

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
kp_pressed: usage_page 0x07 keycode 0x05
mo_pressed: position 1 layer 1
kp_released: usage_page 0x07 keycode 0x05
mo_released: position 1 layer 1

8
app/tests/momentary-layer/early-key-release/native_posix.keymap

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
#include "../behavior_keymap.dtsi"
&kscan {
events = <ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_PRESS(0,1,10) ZMK_MOCK_RELEASE(0,0,10) ZMK_MOCK_RELEASE(0,1,10)>;
};

0
app/tests/momentary-layer/early-key-release/pending

2
app/tests/momentary-layer/normal/events.patterns

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
s/.*hid_listener_keycode/kp/p
s/.*mo_keymap_binding/mo/p

4
app/tests/momentary-layer/normal/keycode_events.snapshot

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
mo_pressed: position 1 layer 1
kp_pressed: usage_page 0x0c keycode 0xb5
kp_released: usage_page 0x0c keycode 0xb5
mo_released: position 1 layer 1

8
app/tests/momentary-layer/normal/native_posix.keymap

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
#include "../behavior_keymap.dtsi"
&kscan {
events = <ZMK_MOCK_PRESS(0,1,10) ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_RELEASE(0,0,10) ZMK_MOCK_RELEASE(0,1,10)>;
};

22
app/tests/none/behavior_keymap.dtsi

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
/ {
keymap {
compatible = "zmk,keymap";
label ="Default keymap";
default_layer {
bindings = <
&none &mo 1
&kp A &none>;
};
lower_layer {
bindings = <
&none &trans
&none &kp A>;
};
};
};

1
app/tests/none/layered/events.patterns

@ -0,0 +1 @@ @@ -0,0 +1 @@
s/.*hid_listener_keycode/kp/p

0
app/tests/none/layered/keycode_events.snapshot

8
app/tests/none/layered/native_posix.keymap

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
#include "../behavior_keymap.dtsi"
&kscan {
events = <ZMK_MOCK_PRESS(0,1,10) ZMK_MOCK_PRESS(1,0,10) ZMK_MOCK_RELEASE(1,0,10) ZMK_MOCK_RELEASE(0,1,10)>;
};

1
app/tests/none/normal/events.patterns

@ -0,0 +1 @@ @@ -0,0 +1 @@
s/.*hid_listener_keycode/kp/p

0
app/tests/none/normal/keycode_events.snapshot

8
app/tests/none/normal/native_posix.keymap

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
#include "../behavior_keymap.dtsi"
&kscan {
events = <ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_RELEASE(0,0,10)>;
};

28
app/tests/toggle-layer/behavior_keymap.dtsi

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
/ {
keymap {
compatible = "zmk,keymap";
label ="Default keymap";
default_layer {
bindings = <
&kp B &tog 1
&kp D &kp G>;
};
lower_layer {
bindings = <
&cp M_NEXT &trans
&kp L &kp J>;
};
raise_layer {
bindings = <
&kp W &kp U
&kp X &kp M>;
};
};
};

2
app/tests/toggle-layer/early-key-release/events.patterns

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
s/.*hid_listener_keycode/kp/p
s/.*tog_keymap_binding/tog/p

6
app/tests/toggle-layer/early-key-release/keycode_events.snapshot

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
kp_pressed: usage_page 0x07 keycode 0x05
tog_pressed: position 1 layer 1
kp_released: usage_page 0x07 keycode 0x05
tog_released: position 1 layer 1
kp_pressed: usage_page 0x0c keycode 0xb5
kp_released: usage_page 0x0c keycode 0xb5

9
app/tests/toggle-layer/early-key-release/native_posix.keymap

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
#include "../behavior_keymap.dtsi"
&kscan {
events = <ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_PRESS(0,1,10) ZMK_MOCK_RELEASE(0,0,10) ZMK_MOCK_RELEASE(0,1,10)
ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_RELEASE(0,0,10)>;
};

0
app/tests/toggle-layer/early-key-release/pending

2
app/tests/toggle-layer/normal/events.patterns

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
s/.*hid_listener_keycode/kp/p
s/.*tog_keymap_binding/tog/p

4
app/tests/toggle-layer/normal/keycode_events.snapshot

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
tog_pressed: position 1 layer 1
tog_released: position 1 layer 1
kp_pressed: usage_page 0x0c keycode 0xb5
kp_released: usage_page 0x0c keycode 0xb5

8
app/tests/toggle-layer/normal/native_posix.keymap

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
#include "../behavior_keymap.dtsi"
&kscan {
events = <ZMK_MOCK_PRESS(0,1,10) ZMK_MOCK_RELEASE(0,1,10) ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_RELEASE(0,0,10)>;
};

22
app/tests/transparent/behavior_keymap.dtsi

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
/ {
keymap {
compatible = "zmk,keymap";
label ="Default keymap";
default_layer {
bindings = <
&trans &mo 1
&kp A &none>;
};
lower_layer {
bindings = <
&trans &trans
&trans &kp A>;
};
};
};

1
app/tests/transparent/layered/events.patterns

@ -0,0 +1 @@ @@ -0,0 +1 @@
s/.*hid_listener_keycode/kp/p

2
app/tests/transparent/layered/keycode_events.snapshot

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
kp_pressed: usage_page 0x07 keycode 0x04
kp_released: usage_page 0x07 keycode 0x04

8
app/tests/transparent/layered/native_posix.keymap

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
#include "../behavior_keymap.dtsi"
&kscan {
events = <ZMK_MOCK_PRESS(0,1,10) ZMK_MOCK_PRESS(1,0,10) ZMK_MOCK_RELEASE(1,0,10) ZMK_MOCK_RELEASE(0,1,10)>;
};

1
app/tests/transparent/normal/events.patterns

@ -0,0 +1 @@ @@ -0,0 +1 @@
s/.*hid_listener_keycode/kp/p

0
app/tests/transparent/normal/keycode_events.snapshot

8
app/tests/transparent/normal/native_posix.keymap

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
#include "../behavior_keymap.dtsi"
&kscan {
events = <ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_RELEASE(0,0,10)>;
};

3
docs/docs/dev-setup.md

@ -52,6 +52,7 @@ sudo apt install -y \ @@ -52,6 +52,7 @@ sudo apt install -y \
autoconf \
automake \
build-essential \
bzip2 \
ccache \
device-tree-compiler \
dfu-util \
@ -91,6 +92,7 @@ sudo apt install -y \ @@ -91,6 +92,7 @@ sudo apt install -y \
autoconf \
automake \
build-essential \
bzip2 \
ccache \
device-tree-compiler \
dfu-util \
@ -130,6 +132,7 @@ sudo dnf install -y \ @@ -130,6 +132,7 @@ sudo dnf install -y \
wget \
autoconf \
automake \
bzip2 \
ccache \
dtc \
dfu-util \

20
docs/docs/dev-tests.md

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
---
id: dev-tests
title: Tests
sidebar_label: Tests
---
Running tests requires [native posix support](./dev-posix-board). Any folder under `/app/tests`
containing `native_posix.keymap` will be selected when running `./run-test.sh all`.
## Creating a New Test Set
1. Copy the test set that most closely resembles the tests you will be creating.
2. Rename the newly created test set to the behavior you're testing e.g, toggle-layer
3. Modify `behavior_keymap.dtsi` to create a keymap using the behavior and related behaviors
4. Modify `test_case/native_posix.keymap` for a simulated use case
5. Modify `test_case/events.patterns` to collect relevant logs to the test
- See: [sed manual](https://www.gnu.org/software/sed/manual/sed.html) and
[tutorial](https://www.digitalocean.com/community/tutorials/the-basics-of-using-the-sed-stream-editor-to-manipulate-text-in-linux)
6. Modify `test_case/keycode_events.snapshot` for to include the expected output
7. Rename the `test_case` folder to describe the test.
8. Repeat steps 4 to 7 for every test case

1
docs/sidebars.js

@ -20,6 +20,7 @@ module.exports = { @@ -20,6 +20,7 @@ module.exports = {
"dev-setup",
"dev-boards-shields-keymaps",
"dev-posix-board",
"dev-tests",
],
"Dev Guides": ["dev-guide-new-shield", "dev-guide-usb-logging"],
},

3
docs/static/setup.sh vendored

@ -38,7 +38,7 @@ echo "" @@ -38,7 +38,7 @@ echo ""
echo "Keyboard Shield Selection:"
prompt="Pick an keyboard:"
options=("Kyria" "Lily58" "Corne")
options=("Kyria" "Lily58" "Corne" "Splitreus62")
PS3="$prompt "
# TODO: Add support for "Other" and linking to docs on adding custom shields in user config repos.
@ -50,6 +50,7 @@ select opt in "${options[@]}" "Quit"; do @@ -50,6 +50,7 @@ select opt in "${options[@]}" "Quit"; do
1 ) shield_title="Kyria" shield="kyria"; split="y"; break;;
2 ) shield_title="Lily58" shield="lily58"; split="y"; break;;
3 ) shield_title="Corne" shield="corne"; split="y"; break;;
4 ) shield_title="Splitreus62" shield="splitreus62"; split="y"; break;;
# Add link to docs on adding your own custom shield in your ZMK config!
# $(( ${#options[@]}+1 )) ) echo "Other!"; break;;

Loading…
Cancel
Save