Merge branch 'zmkfirmware:main' into lotus58
This commit is contained in:
commit
f33c32eff6
41 changed files with 1001 additions and 629 deletions
|
@ -48,6 +48,7 @@ if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c)
|
target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_sticky_key.c)
|
target_sources(app PRIVATE src/behaviors/behavior_sticky_key.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_caps_word.c)
|
target_sources(app PRIVATE src/behaviors/behavior_caps_word.c)
|
||||||
|
target_sources(app PRIVATE src/behaviors/behavior_key_repeat.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_momentary_layer.c)
|
target_sources(app PRIVATE src/behaviors/behavior_momentary_layer.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_mod_morph.c)
|
target_sources(app PRIVATE src/behaviors/behavior_mod_morph.c)
|
||||||
target_sources(app PRIVATE src/behaviors/behavior_outputs.c)
|
target_sources(app PRIVATE src/behaviors/behavior_outputs.c)
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse")
|
board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse")
|
||||||
board_runner_args(jlink "--device=STM32F303CC" "--speed=4000")
|
board_runner_args(jlink "--device=STM32F303CC" "--speed=4000")
|
||||||
|
|
||||||
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
|
include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake)
|
||||||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
|
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
ext-power {
|
ext-power {
|
||||||
compatible = "zmk,ext-power-generic";
|
compatible = "zmk,ext-power-generic";
|
||||||
label = "EXT_POWER";
|
label = "EXT_POWER";
|
||||||
control-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
|
control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
|
||||||
|
init-delay-ms = <50>;
|
||||||
};
|
};
|
||||||
|
|
||||||
vbatt {
|
vbatt {
|
||||||
|
|
19
app/boards/shields/clog/Kconfig.defconfig
Normal file
19
app/boards/shields/clog/Kconfig.defconfig
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Copyright (c) 2022 The ZMK Contributors
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
if SHIELD_CLOG_LEFT
|
||||||
|
|
||||||
|
config ZMK_KEYBOARD_NAME
|
||||||
|
default "Clog"
|
||||||
|
|
||||||
|
config ZMK_SPLIT_BLE_ROLE_CENTRAL
|
||||||
|
default y
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
if SHIELD_CLOG_LEFT || SHIELD_CLOG_RIGHT
|
||||||
|
|
||||||
|
config ZMK_SPLIT
|
||||||
|
default y
|
||||||
|
|
||||||
|
endif
|
8
app/boards/shields/clog/Kconfig.shield
Normal file
8
app/boards/shields/clog/Kconfig.shield
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Copyright (c) 2022 The ZMK Contributors
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
config SHIELD_CLOG_LEFT
|
||||||
|
def_bool $(shields_list_contains,clog_left)
|
||||||
|
|
||||||
|
config SHIELD_CLOG_RIGHT
|
||||||
|
def_bool $(shields_list_contains,clog_right)
|
8
app/boards/shields/clog/README.md
Normal file
8
app/boards/shields/clog/README.md
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# The Clog
|
||||||
|
|
||||||
|
The Clog is a 34-key choc v1 split board by S'mores. This firmware works for both the [Clog][clog],
|
||||||
|
as well as the [Sephirette][sephirette], the MX version. You can purchase kits for both boards
|
||||||
|
at smoresboards.com.
|
||||||
|
|
||||||
|
[clog]: https://github.com/smores56/clog
|
||||||
|
[sephirette]: https://github.com/smores56/sephirette
|
0
app/boards/shields/clog/clog.conf
Normal file
0
app/boards/shields/clog/clog.conf
Normal file
51
app/boards/shields/clog/clog.dtsi
Normal file
51
app/boards/shields/clog/clog.dtsi
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* 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 = <34>;
|
||||||
|
rows = <1>;
|
||||||
|
map = <
|
||||||
|
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,20) RC(0,19) RC(0,18) RC(0,17)
|
||||||
|
RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,26) RC(0,25) RC(0,24) RC(0,23) RC(0,22) RC(0,21)
|
||||||
|
RC(0,10) RC(0,11) RC(0,12) RC(0,13) RC(0,14) RC(0,31) RC(0,30) RC(0,29) RC(0,28) RC(0,27)
|
||||||
|
RC(0,15) RC(0,16) RC(0,33) RC(0,32)
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
kscan0: kscan {
|
||||||
|
compatible = "zmk,kscan-gpio-direct";
|
||||||
|
label = "KSCAN";
|
||||||
|
|
||||||
|
input-gpios
|
||||||
|
= <&pro_micro 18 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 19 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 20 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 21 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
, <&pro_micro 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
|
;
|
||||||
|
};
|
||||||
|
};
|
113
app/boards/shields/clog/clog.keymap
Normal file
113
app/boards/shields/clog/clog.keymap
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <behaviors.dtsi>
|
||||||
|
#include <dt-bindings/zmk/keys.h>
|
||||||
|
#include <dt-bindings/zmk/bt.h>
|
||||||
|
|
||||||
|
#define MAIN 0
|
||||||
|
#define SYM 1
|
||||||
|
#define NAV 2
|
||||||
|
#define BT 3
|
||||||
|
|
||||||
|
&mt {
|
||||||
|
flavor = "tap-preferred";
|
||||||
|
tapping_term_ms = <140>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/ {
|
||||||
|
combos {
|
||||||
|
compatible = "zmk,combos";
|
||||||
|
|
||||||
|
combo_esc {
|
||||||
|
timeout-ms = <100>;
|
||||||
|
key-positions = <21 22>;
|
||||||
|
bindings = <&kp ESC>;
|
||||||
|
};
|
||||||
|
|
||||||
|
combo_tab {
|
||||||
|
timeout-ms = <100>;
|
||||||
|
key-positions = <22 23>;
|
||||||
|
bindings = <&kp TAB>;
|
||||||
|
};
|
||||||
|
|
||||||
|
combo_minus {
|
||||||
|
timeout-ms = <100>;
|
||||||
|
key-positions = <26 27>;
|
||||||
|
bindings = <&kp MINUS>;
|
||||||
|
};
|
||||||
|
|
||||||
|
combo_underscore {
|
||||||
|
timeout-ms = <100>;
|
||||||
|
key-positions = <26 28>;
|
||||||
|
bindings = <&kp UNDERSCORE>;
|
||||||
|
};
|
||||||
|
|
||||||
|
combo_colon {
|
||||||
|
timeout-ms = <100>;
|
||||||
|
key-positions = <7 8>;
|
||||||
|
bindings = <&kp COLON>;
|
||||||
|
};
|
||||||
|
|
||||||
|
combo_semicolon {
|
||||||
|
timeout-ms = <100>;
|
||||||
|
key-positions = <6 8>;
|
||||||
|
bindings = <&kp SEMICOLON>;
|
||||||
|
};
|
||||||
|
|
||||||
|
combo_backslash {
|
||||||
|
timeout-ms = <100>;
|
||||||
|
key-positions = <27 28>;
|
||||||
|
bindings = <&kp BSLH>;
|
||||||
|
};
|
||||||
|
|
||||||
|
combo_grave {
|
||||||
|
timeout-ms = <100>;
|
||||||
|
key-positions = <8 9>;
|
||||||
|
bindings = <&kp GRAVE>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
keymap {
|
||||||
|
compatible = "zmk,keymap";
|
||||||
|
|
||||||
|
MAIN_layer {
|
||||||
|
bindings = <
|
||||||
|
&kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O
|
||||||
|
&kp Q &kp A &kp S &kp D < SYM F &kp G &kp H < SYM J &kp K &kp L &kp SQT &kp P
|
||||||
|
&mt LSHFT Z &mt LALT X &mt LCTRL C &mt LGUI V &kp B &kp N &mt RGUI M &mt RCTRL COMMA &mt RALT DOT &mt RSHFT FSLH
|
||||||
|
< BT ENTER < NAV SPACE &sk RSHFT &kp BSPC
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
SYM_layer {
|
||||||
|
bindings = <
|
||||||
|
&kp N7 &kp N8 &kp N9 &kp STAR &kp DLLR &kp LBRC &kp RBRC &kp HASH
|
||||||
|
&kp AMPS &kp EXCL &kp N1 &kp N2 &kp N3 &kp EQUAL &kp LT &kp LPAR &kp RPAR &kp GT &kp PIPE &none
|
||||||
|
&kp CARET &kp N4 &kp N5 &kp N6 &kp PLUS &kp TILDE &kp LBKT &kp RBKT &kp AT &kp PRCNT
|
||||||
|
&kp DOT &kp N0 &trans &none
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
NAV_layer {
|
||||||
|
bindings = <
|
||||||
|
&kp C_VOL_DN &kp C_VOL_UP &kp C_NEXT &kp C_PP &none &kp F7 &kp F8 &kp F9
|
||||||
|
&kp C_PREV &kp LEFT &kp DOWN &kp UP &kp RIGHT &kp LC(TAB) &kp PSCRN &kp F1 &kp F2 &kp F3 &kp F10 &kp F12
|
||||||
|
&kp HOME &kp PG_DN &kp PG_UP &kp END &kp LS(LC(TAB)) &kp CAPS &kp F4 &kp F5 &kp F6 &kp F11
|
||||||
|
&none &none &trans &kp DEL
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
BT_layer {
|
||||||
|
bindings = <
|
||||||
|
&none &none &none &none &none &none &none &none
|
||||||
|
&none &none &none &none &none &none &none &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &none
|
||||||
|
&none &none &none &none &none &none &bt BT_CLR &none &none &none
|
||||||
|
&none &none &none &none
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
11
app/boards/shields/clog/clog.zmk.yml
Normal file
11
app/boards/shields/clog/clog.zmk.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
file_format: "1"
|
||||||
|
id: clog
|
||||||
|
name: Clog
|
||||||
|
type: shield
|
||||||
|
url: https://github.com/smores56/clog
|
||||||
|
requires: [pro_micro]
|
||||||
|
features:
|
||||||
|
- keys
|
||||||
|
siblings:
|
||||||
|
- clog_left
|
||||||
|
- clog_right
|
7
app/boards/shields/clog/clog_left.overlay
Normal file
7
app/boards/shields/clog/clog_left.overlay
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "clog.dtsi"
|
11
app/boards/shields/clog/clog_right.overlay
Normal file
11
app/boards/shields/clog/clog_right.overlay
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "clog.dtsi"
|
||||||
|
|
||||||
|
&default_transform {
|
||||||
|
col-offset = <17>;
|
||||||
|
};
|
9
app/boards/shields/contra/Kconfig.defconfig
Normal file
9
app/boards/shields/contra/Kconfig.defconfig
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# Copyright (c) 2021 The ZMK Contributors
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
if SHIELD_CONTRA
|
||||||
|
|
||||||
|
config ZMK_KEYBOARD_NAME
|
||||||
|
default "Contra Keyboard"
|
||||||
|
|
||||||
|
endif
|
5
app/boards/shields/contra/Kconfig.shield
Normal file
5
app/boards/shields/contra/Kconfig.shield
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Copyright (c) 2021 The ZMK Contributors
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
config SHIELD_CONTRA
|
||||||
|
def_bool $(shields_list_contains,contra)
|
0
app/boards/shields/contra/contra.conf
Normal file
0
app/boards/shields/contra/contra.conf
Normal file
46
app/boards/shields/contra/contra.keymap
Normal file
46
app/boards/shields/contra/contra.keymap
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <behaviors.dtsi>
|
||||||
|
#include <dt-bindings/zmk/keys.h>
|
||||||
|
#include <dt-bindings/zmk/bt.h>
|
||||||
|
|
||||||
|
#define DEFAULT 0
|
||||||
|
#define NUM_MODS 1
|
||||||
|
#define BT_CTRL 2
|
||||||
|
|
||||||
|
/ {
|
||||||
|
keymap {
|
||||||
|
compatible = "zmk,keymap";
|
||||||
|
|
||||||
|
default_layer {
|
||||||
|
bindings = <
|
||||||
|
&kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSPC
|
||||||
|
&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 LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp ENTER
|
||||||
|
&kp LCTRL &kp LGUI &kp LALT &kp BSLH &to DEFAULT &kp SPACE &trans &to NUM_MODS &kp LEFT &kp RIGHT &kp UP &kp DOWN
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
num_mods {
|
||||||
|
bindings = <
|
||||||
|
&kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp DEL
|
||||||
|
&kp TAB &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp MINUS &kp PG_UP &kp LBKT &kp RBKT &kp BSLH
|
||||||
|
&kp LSHFT &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp EQUAL &kp PG_DN &kp HOME &kp END &kp ENTER
|
||||||
|
&kp LCTRL &kp LGUI &kp LALT &reset &to DEFAULT &kp SPACE &trans &mo BT_CTRL &kp LEFT &kp RIGHT &kp UP &kp DOWN
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
|
||||||
|
bt_control {
|
||||||
|
bindings = <
|
||||||
|
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &trans &trans &trans &trans &trans &trans
|
||||||
|
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
|
||||||
|
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
|
||||||
|
&trans &trans &trans &trans &trans &trans &trans &trans &bt BT_PRV &bt BT_NXT &trans &trans
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
39
app/boards/shields/contra/contra.overlay
Normal file
39
app/boards/shields/contra/contra.overlay
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/ {
|
||||||
|
chosen {
|
||||||
|
zmk,kscan = &kscan0;
|
||||||
|
};
|
||||||
|
|
||||||
|
kscan0: kscan_0 {
|
||||||
|
compatible = "zmk,kscan-gpio-matrix";
|
||||||
|
label = "KSCAN";
|
||||||
|
diode-direction = "col2row";
|
||||||
|
|
||||||
|
col-gpios
|
||||||
|
= <&pro_micro 21 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro 20 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro 9 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro 8 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro 7 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro 6 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro 5 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro 4 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro 3 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro 2 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro 0 GPIO_ACTIVE_HIGH>
|
||||||
|
, <&pro_micro 1 GPIO_ACTIVE_HIGH>
|
||||||
|
;
|
||||||
|
|
||||||
|
row-gpios
|
||||||
|
= <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
, <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
, <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
, <&pro_micro 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
|
;
|
||||||
|
};
|
||||||
|
};
|
8
app/boards/shields/contra/contra.zmk.yml
Normal file
8
app/boards/shields/contra/contra.zmk.yml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
file_format: "1"
|
||||||
|
id: contra
|
||||||
|
name: Contra
|
||||||
|
type: shield
|
||||||
|
url: https://github.com/ai03-2725/Contra
|
||||||
|
requires: [pro_micro]
|
||||||
|
features:
|
||||||
|
- keys
|
|
@ -15,3 +15,4 @@
|
||||||
#include <behaviors/ext_power.dtsi>
|
#include <behaviors/ext_power.dtsi>
|
||||||
#include <behaviors/outputs.dtsi>
|
#include <behaviors/outputs.dtsi>
|
||||||
#include <behaviors/caps_word.dtsi>
|
#include <behaviors/caps_word.dtsi>
|
||||||
|
#include <behaviors/key_repeat.dtsi>
|
||||||
|
|
19
app/dts/behaviors/key_repeat.dtsi
Normal file
19
app/dts/behaviors/key_repeat.dtsi
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <dt-bindings/zmk/keys.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
behaviors {
|
||||||
|
/omit-if-no-ref/ key_repeat: behavior_key_repeat {
|
||||||
|
compatible = "zmk,behavior-key-repeat";
|
||||||
|
label = "KEY_REPEAT";
|
||||||
|
#binding-cells = <0>;
|
||||||
|
usage-pages = <HID_USAGE_KEY>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
13
app/dts/bindings/behaviors/zmk,behavior-key-repeat.yaml
Normal file
13
app/dts/bindings/behaviors/zmk,behavior-key-repeat.yaml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# Copyright (c) 2021 The ZMK Contributors
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
description: Key repeat behavior
|
||||||
|
|
||||||
|
compatible: "zmk,behavior-key-repeat"
|
||||||
|
|
||||||
|
include: zero_param.yaml
|
||||||
|
|
||||||
|
properties:
|
||||||
|
usage-pages:
|
||||||
|
type: array
|
||||||
|
required: true
|
|
@ -21,8 +21,7 @@ bool zmk_ble_active_profile_is_connected();
|
||||||
char *zmk_ble_active_profile_name();
|
char *zmk_ble_active_profile_name();
|
||||||
|
|
||||||
int zmk_ble_unpair_all();
|
int zmk_ble_unpair_all();
|
||||||
bool zmk_ble_handle_key_user(struct zmk_key_event *key_event);
|
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
||||||
void zmk_ble_set_peripheral_addr(bt_addr_le_t *addr);
|
void zmk_ble_set_peripheral_addr(bt_addr_le_t *addr);
|
||||||
#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL) */
|
#endif /* IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL) */
|
||||||
|
|
126
app/src/behaviors/behavior_key_repeat.c
Normal file
126
app/src/behaviors/behavior_key_repeat.c
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021 The ZMK Contributors
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DT_DRV_COMPAT zmk_behavior_key_repeat
|
||||||
|
|
||||||
|
#include <device.h>
|
||||||
|
#include <drivers/behavior.h>
|
||||||
|
#include <logging/log.h>
|
||||||
|
#include <zmk/behavior.h>
|
||||||
|
#include <zmk/hid.h>
|
||||||
|
|
||||||
|
#include <zmk/event_manager.h>
|
||||||
|
#include <zmk/events/keycode_state_changed.h>
|
||||||
|
|
||||||
|
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||||
|
|
||||||
|
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
|
||||||
|
|
||||||
|
struct behavior_key_repeat_config {
|
||||||
|
uint8_t index;
|
||||||
|
uint8_t usage_pages_count;
|
||||||
|
uint16_t usage_pages[];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct behavior_key_repeat_data {
|
||||||
|
struct zmk_keycode_state_changed last_keycode_pressed;
|
||||||
|
struct zmk_keycode_state_changed current_keycode_pressed;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int on_key_repeat_binding_pressed(struct zmk_behavior_binding *binding,
|
||||||
|
struct zmk_behavior_binding_event event) {
|
||||||
|
const struct device *dev = device_get_binding(binding->behavior_dev);
|
||||||
|
struct behavior_key_repeat_data *data = dev->data;
|
||||||
|
|
||||||
|
if (data->last_keycode_pressed.usage_page == 0) {
|
||||||
|
return ZMK_BEHAVIOR_OPAQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(&data->current_keycode_pressed, &data->last_keycode_pressed,
|
||||||
|
sizeof(struct zmk_keycode_state_changed));
|
||||||
|
data->current_keycode_pressed.timestamp = k_uptime_get();
|
||||||
|
|
||||||
|
ZMK_EVENT_RAISE(new_zmk_keycode_state_changed(data->current_keycode_pressed));
|
||||||
|
|
||||||
|
return ZMK_BEHAVIOR_OPAQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int on_key_repeat_binding_released(struct zmk_behavior_binding *binding,
|
||||||
|
struct zmk_behavior_binding_event event) {
|
||||||
|
const struct device *dev = device_get_binding(binding->behavior_dev);
|
||||||
|
struct behavior_key_repeat_data *data = dev->data;
|
||||||
|
|
||||||
|
if (data->current_keycode_pressed.usage_page == 0) {
|
||||||
|
return ZMK_BEHAVIOR_OPAQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
data->current_keycode_pressed.timestamp = k_uptime_get();
|
||||||
|
data->current_keycode_pressed.state = false;
|
||||||
|
|
||||||
|
ZMK_EVENT_RAISE(new_zmk_keycode_state_changed(data->current_keycode_pressed));
|
||||||
|
return ZMK_BEHAVIOR_OPAQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct behavior_driver_api behavior_key_repeat_driver_api = {
|
||||||
|
.binding_pressed = on_key_repeat_binding_pressed,
|
||||||
|
.binding_released = on_key_repeat_binding_released,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int key_repeat_keycode_state_changed_listener(const zmk_event_t *eh);
|
||||||
|
|
||||||
|
ZMK_LISTENER(behavior_key_repeat, key_repeat_keycode_state_changed_listener);
|
||||||
|
ZMK_SUBSCRIPTION(behavior_key_repeat, zmk_keycode_state_changed);
|
||||||
|
|
||||||
|
static const struct device *devs[DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT)];
|
||||||
|
|
||||||
|
static int key_repeat_keycode_state_changed_listener(const zmk_event_t *eh) {
|
||||||
|
struct zmk_keycode_state_changed *ev = as_zmk_keycode_state_changed(eh);
|
||||||
|
if (ev == NULL || !ev->state) {
|
||||||
|
return ZMK_EV_EVENT_BUBBLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT); i++) {
|
||||||
|
const struct device *dev = devs[i];
|
||||||
|
if (dev == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct behavior_key_repeat_data *data = dev->data;
|
||||||
|
const struct behavior_key_repeat_config *config = dev->config;
|
||||||
|
|
||||||
|
for (int u = 0; u < config->usage_pages_count; u++) {
|
||||||
|
if (config->usage_pages[u] == ev->usage_page) {
|
||||||
|
memcpy(&data->last_keycode_pressed, ev, sizeof(struct zmk_keycode_state_changed));
|
||||||
|
data->last_keycode_pressed.implicit_modifiers |= zmk_hid_get_explicit_mods();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ZMK_EV_EVENT_BUBBLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int behavior_key_repeat_init(const struct device *dev) {
|
||||||
|
const struct behavior_key_repeat_config *config = dev->config;
|
||||||
|
devs[config->index] = dev;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define KR_INST(n) \
|
||||||
|
static struct behavior_key_repeat_data behavior_key_repeat_data_##n = {}; \
|
||||||
|
static struct behavior_key_repeat_config behavior_key_repeat_config_##n = { \
|
||||||
|
.index = n, \
|
||||||
|
.usage_pages = DT_INST_PROP(n, usage_pages), \
|
||||||
|
.usage_pages_count = DT_INST_PROP_LEN(n, usage_pages), \
|
||||||
|
}; \
|
||||||
|
DEVICE_DT_INST_DEFINE(n, behavior_key_repeat_init, device_pm_control_nop, \
|
||||||
|
&behavior_key_repeat_data_##n, &behavior_key_repeat_config_##n, \
|
||||||
|
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
|
||||||
|
&behavior_key_repeat_driver_api);
|
||||||
|
|
||||||
|
DT_INST_FOREACH_STATUS_OKAY(KR_INST)
|
||||||
|
|
||||||
|
#endif
|
|
@ -36,10 +36,24 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||||
#include <zmk/event_manager.h>
|
#include <zmk/event_manager.h>
|
||||||
#include <zmk/events/ble_active_profile_changed.h>
|
#include <zmk/events/ble_active_profile_changed.h>
|
||||||
|
|
||||||
|
#define IS_HOST_PERIPHERAL \
|
||||||
|
(!IS_ENABLED(CONFIG_ZMK_SPLIT) || IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL))
|
||||||
|
#define IS_SPLIT_PERIPHERAL \
|
||||||
|
(IS_ENABLED(CONFIG_ZMK_SPLIT) && !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL))
|
||||||
|
|
||||||
|
#define DO_PASSKEY_ENTRY (IS_ENABLED(CONFIG_ZMK_BLE_PASSKEY_ENTRY) && !IS_SPLIT_PERIPHERAL)
|
||||||
|
|
||||||
|
#if DO_PASSKEY_ENTRY
|
||||||
|
#include <zmk/events/keycode_state_changed.h>
|
||||||
|
|
||||||
|
#define PASSKEY_DIGITS 6
|
||||||
|
|
||||||
static struct bt_conn *auth_passkey_entry_conn;
|
static struct bt_conn *auth_passkey_entry_conn;
|
||||||
static uint8_t passkey_entries[6] = {0, 0, 0, 0, 0, 0};
|
static uint8_t passkey_entries[PASSKEY_DIGITS] = {};
|
||||||
static uint8_t passkey_digit = 0;
|
static uint8_t passkey_digit = 0;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
|
||||||
#define PROFILE_COUNT (CONFIG_BT_MAX_PAIRED - 1)
|
#define PROFILE_COUNT (CONFIG_BT_MAX_PAIRED - 1)
|
||||||
#else
|
#else
|
||||||
|
@ -66,11 +80,6 @@ static uint8_t active_profile;
|
||||||
|
|
||||||
BUILD_ASSERT(DEVICE_NAME_LEN <= 16, "ERROR: BLE device name is too long. Max length: 16");
|
BUILD_ASSERT(DEVICE_NAME_LEN <= 16, "ERROR: BLE device name is too long. Max length: 16");
|
||||||
|
|
||||||
#define IS_HOST_PERIPHERAL \
|
|
||||||
(!IS_ENABLED(CONFIG_ZMK_SPLIT) || IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL))
|
|
||||||
#define IS_SPLIT_PERIPHERAL \
|
|
||||||
(IS_ENABLED(CONFIG_ZMK_SPLIT) && !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL))
|
|
||||||
|
|
||||||
static const struct bt_data zmk_ble_ad[] = {
|
static const struct bt_data zmk_ble_ad[] = {
|
||||||
#if IS_HOST_PERIPHERAL
|
#if IS_HOST_PERIPHERAL
|
||||||
BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
|
BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
|
||||||
|
@ -456,7 +465,7 @@ static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_ZMK_BLE_PASSKEY_ENTRY
|
#if DO_PASSKEY_ENTRY
|
||||||
|
|
||||||
static void auth_passkey_entry(struct bt_conn *conn) {
|
static void auth_passkey_entry(struct bt_conn *conn) {
|
||||||
char addr[BT_ADDR_LE_STR_LEN];
|
char addr[BT_ADDR_LE_STR_LEN];
|
||||||
|
@ -464,6 +473,7 @@ static void auth_passkey_entry(struct bt_conn *conn) {
|
||||||
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
|
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
|
||||||
|
|
||||||
LOG_DBG("Passkey entry requested for %s", log_strdup(addr));
|
LOG_DBG("Passkey entry requested for %s", log_strdup(addr));
|
||||||
|
passkey_digit = 0;
|
||||||
auth_passkey_entry_conn = bt_conn_ref(conn);
|
auth_passkey_entry_conn = bt_conn_ref(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,12 +484,14 @@ static void auth_cancel(struct bt_conn *conn) {
|
||||||
|
|
||||||
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
|
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
|
||||||
|
|
||||||
|
#if DO_PASSKEY_ENTRY
|
||||||
if (auth_passkey_entry_conn) {
|
if (auth_passkey_entry_conn) {
|
||||||
bt_conn_unref(auth_passkey_entry_conn);
|
bt_conn_unref(auth_passkey_entry_conn);
|
||||||
auth_passkey_entry_conn = NULL;
|
auth_passkey_entry_conn = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
passkey_digit = 0;
|
passkey_digit = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
LOG_DBG("Pairing cancelled: %s", log_strdup(addr));
|
LOG_DBG("Pairing cancelled: %s", log_strdup(addr));
|
||||||
}
|
}
|
||||||
|
@ -532,7 +544,7 @@ static struct bt_conn_auth_cb zmk_ble_auth_cb_display = {
|
||||||
.pairing_complete = auth_pairing_complete,
|
.pairing_complete = auth_pairing_complete,
|
||||||
// .passkey_display = auth_passkey_display,
|
// .passkey_display = auth_passkey_display,
|
||||||
|
|
||||||
#ifdef CONFIG_ZMK_BLE_PASSKEY_ENTRY
|
#if DO_PASSKEY_ENTRY
|
||||||
.passkey_entry = auth_passkey_entry,
|
.passkey_entry = auth_passkey_entry,
|
||||||
#endif
|
#endif
|
||||||
.cancel = auth_cancel,
|
.cancel = auth_cancel,
|
||||||
|
@ -612,32 +624,79 @@ int zmk_ble_unpair_all() {
|
||||||
return resp;
|
return resp;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool zmk_ble_handle_key_user(struct zmk_key_event *key_event) {
|
#if DO_PASSKEY_ENTRY
|
||||||
zmk_key_t key = key_event->key;
|
|
||||||
|
static bool zmk_ble_numeric_usage_to_value(const zmk_key_t key, const zmk_key_t one,
|
||||||
|
const zmk_key_t zero, uint32_t *value) {
|
||||||
|
if (key < one || key > zero) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
*value = (key == zero) ? 0 : (key - one + 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int zmk_ble_handle_key_user(struct zmk_keycode_state_changed *event) {
|
||||||
|
zmk_key_t key = event->keycode;
|
||||||
|
|
||||||
|
LOG_DBG("key %d", key);
|
||||||
|
|
||||||
if (!auth_passkey_entry_conn) {
|
if (!auth_passkey_entry_conn) {
|
||||||
return true;
|
LOG_DBG("No connection for passkey entry");
|
||||||
|
return ZMK_EV_EVENT_BUBBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key < NUMBER_1 || key > NUMBER_0) {
|
if (!event->state) {
|
||||||
return true;
|
LOG_DBG("Key released, ignoring");
|
||||||
|
return ZMK_EV_EVENT_BUBBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t val = (key == NUMBER_0) ? 0 : (key - NUMBER_1 + 1);
|
if (key == HID_USAGE_KEY_KEYBOARD_ESCAPE) {
|
||||||
|
bt_conn_auth_cancel(auth_passkey_entry_conn);
|
||||||
|
return ZMK_EV_EVENT_HANDLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t val;
|
||||||
|
if (!(zmk_ble_numeric_usage_to_value(key, HID_USAGE_KEY_KEYBOARD_1_AND_EXCLAMATION,
|
||||||
|
HID_USAGE_KEY_KEYBOARD_0_AND_RIGHT_PARENTHESIS, &val) ||
|
||||||
|
zmk_ble_numeric_usage_to_value(key, HID_USAGE_KEY_KEYPAD_1_AND_END,
|
||||||
|
HID_USAGE_KEY_KEYPAD_0_AND_INSERT, &val))) {
|
||||||
|
LOG_DBG("Key not a number, ignoring");
|
||||||
|
return ZMK_EV_EVENT_BUBBLE;
|
||||||
|
}
|
||||||
|
|
||||||
passkey_entries[passkey_digit++] = val;
|
passkey_entries[passkey_digit++] = val;
|
||||||
|
LOG_DBG("value entered: %d, digits collected so far: %d", val, passkey_digit);
|
||||||
|
|
||||||
if (passkey_digit == 6) {
|
if (passkey_digit == PASSKEY_DIGITS) {
|
||||||
uint32_t passkey = 0;
|
uint32_t passkey = 0;
|
||||||
for (int i = 5; i >= 0; i--) {
|
for (int i = 0; i < PASSKEY_DIGITS; i++) {
|
||||||
passkey = (passkey * 10) + val;
|
passkey = (passkey * 10) + passkey_entries[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_DBG("Final passkey: %d", passkey);
|
||||||
bt_conn_auth_passkey_entry(auth_passkey_entry_conn, passkey);
|
bt_conn_auth_passkey_entry(auth_passkey_entry_conn, passkey);
|
||||||
bt_conn_unref(auth_passkey_entry_conn);
|
bt_conn_unref(auth_passkey_entry_conn);
|
||||||
auth_passkey_entry_conn = NULL;
|
auth_passkey_entry_conn = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return ZMK_EV_EVENT_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int zmk_ble_listener(const zmk_event_t *eh) {
|
||||||
|
struct zmk_keycode_state_changed *kc_state;
|
||||||
|
|
||||||
|
kc_state = as_zmk_keycode_state_changed(eh);
|
||||||
|
|
||||||
|
if (kc_state != NULL) {
|
||||||
|
return zmk_ble_handle_key_user(kc_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZMK_LISTENER(zmk_ble, zmk_ble_listener);
|
||||||
|
ZMK_SUBSCRIPTION(zmk_ble, zmk_keycode_state_changed);
|
||||||
|
#endif /* DO_PASSKEY_ENTRY */
|
||||||
|
|
||||||
SYS_INIT(zmk_ble_init, APPLICATION, CONFIG_ZMK_BLE_INIT_PRIORITY);
|
SYS_INIT(zmk_ble_init, APPLICATION, CONFIG_ZMK_BLE_INIT_PRIORITY);
|
||||||
|
|
17
app/tests/key-repeat/behavior_keymap.dtsi
Normal file
17
app/tests/key-repeat/behavior_keymap.dtsi
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#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 = <
|
||||||
|
&key_repeat &kp A
|
||||||
|
&kp LCTRL &kp C_VOL_UP
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,2 @@
|
||||||
|
s/.*hid_listener_keycode_//p
|
||||||
|
s/.*hid_implicit_modifiers_//p
|
|
@ -0,0 +1,12 @@
|
||||||
|
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
press: Modifiers set to 0x00
|
||||||
|
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
release: Modifiers set to 0x00
|
||||||
|
pressed: usage_page 0x0c keycode 0xe9 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
press: Modifiers set to 0x00
|
||||||
|
released: usage_page 0x0c keycode 0xe9 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
release: Modifiers set to 0x00
|
||||||
|
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
press: Modifiers set to 0x00
|
||||||
|
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
release: Modifiers set to 0x00
|
|
@ -0,0 +1,15 @@
|
||||||
|
#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(1,1,10)
|
||||||
|
ZMK_MOCK_RELEASE(1,1,10)
|
||||||
|
ZMK_MOCK_PRESS(0,0,10)
|
||||||
|
ZMK_MOCK_RELEASE(0,0,10)
|
||||||
|
>;
|
||||||
|
};
|
|
@ -0,0 +1,2 @@
|
||||||
|
s/.*hid_listener_keycode_//p
|
||||||
|
s/.*hid_implicit_modifiers_//p
|
|
@ -0,0 +1,8 @@
|
||||||
|
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
press: Modifiers set to 0x00
|
||||||
|
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
release: Modifiers set to 0x00
|
||||||
|
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
press: Modifiers set to 0x00
|
||||||
|
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
release: Modifiers set to 0x00
|
|
@ -0,0 +1,13 @@
|
||||||
|
#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)
|
||||||
|
>;
|
||||||
|
};
|
|
@ -0,0 +1,2 @@
|
||||||
|
s/.*hid_listener_keycode_//p
|
||||||
|
s/.*hid_implicit_modifiers_//p
|
|
@ -0,0 +1,12 @@
|
||||||
|
pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
press: Modifiers set to 0x01
|
||||||
|
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
press: Modifiers set to 0x01
|
||||||
|
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
release: Modifiers set to 0x01
|
||||||
|
released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00
|
||||||
|
release: Modifiers set to 0x00
|
||||||
|
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x01 explicit_mods 0x00
|
||||||
|
press: Modifiers set to 0x01
|
||||||
|
released: usage_page 0x07 keycode 0x04 implicit_mods 0x01 explicit_mods 0x00
|
||||||
|
release: Modifiers set to 0x00
|
|
@ -0,0 +1,15 @@
|
||||||
|
#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(1,0,10)
|
||||||
|
ZMK_MOCK_PRESS(0,1,10)
|
||||||
|
ZMK_MOCK_RELEASE(0,1,10)
|
||||||
|
ZMK_MOCK_RELEASE(1,0,10)
|
||||||
|
ZMK_MOCK_PRESS(0,0,10)
|
||||||
|
ZMK_MOCK_RELEASE(0,0,10)
|
||||||
|
>;
|
||||||
|
};
|
|
@ -0,0 +1,2 @@
|
||||||
|
s/.*hid_listener_keycode_//p
|
||||||
|
s/.*hid_implicit_modifiers_//p
|
|
@ -0,0 +1,11 @@
|
||||||
|
#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)
|
||||||
|
>;
|
||||||
|
};
|
38
docs/docs/behaviors/key-repeat.md
Normal file
38
docs/docs/behaviors/key-repeat.md
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
---
|
||||||
|
title: Key Repeat Behavior
|
||||||
|
sidebar_label: Key Repeat
|
||||||
|
---
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
The key repeat behavior when triggered will send whatever keycode was last sent/triggered.
|
||||||
|
|
||||||
|
### Behavior Binding
|
||||||
|
|
||||||
|
- Reference: `&key_repeat`
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
&key_repeat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
#### Usage Pages
|
||||||
|
|
||||||
|
By default, the key repeat will only track the last pressed key from the HID "Key" usage page, and ignore events from other usages, e.g. Consumer page.
|
||||||
|
|
||||||
|
If you'd rather have the repeat also capture and send Consumer page usages, you can update the existing behavior:
|
||||||
|
|
||||||
|
```
|
||||||
|
&key_repeat {
|
||||||
|
usage-pages = <HID_USAGE_KEY HID_USAGE_CONSUMER>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/ {
|
||||||
|
keymap {
|
||||||
|
...
|
||||||
|
};
|
||||||
|
};
|
||||||
|
```
|
|
@ -143,6 +143,10 @@ GitHub Repo: https://github.com/petejohanson/zmk-config.git
|
||||||
|
|
||||||
Only the GitHub username is required; if you are happy with the defaults offered in the square brackets, you can simply hit `Enter`.
|
Only the GitHub username is required; if you are happy with the defaults offered in the square brackets, you can simply hit `Enter`.
|
||||||
|
|
||||||
|
:::note
|
||||||
|
If you are using SSH keys for git push, change GitHub Repo field to the SSH scheme, e.g. `git@github.com:petejohanson/zmk-config.git`.
|
||||||
|
:::
|
||||||
|
|
||||||
### Confirming Selections
|
### Confirming Selections
|
||||||
|
|
||||||
The setup script will confirm all of your selections one last time, before performing the setup:
|
The setup script will confirm all of your selections one last time, before performing the setup:
|
||||||
|
|
877
docs/package-lock.json
generated
877
docs/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -51,7 +51,7 @@
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.3.0",
|
||||||
"eslint-plugin-mdx": "^1.13.0",
|
"eslint-plugin-mdx": "^1.13.0",
|
||||||
"eslint-plugin-react": "^7.23.2",
|
"eslint-plugin-react": "^7.28.0",
|
||||||
"json-schema-to-typescript": "^10.1.3",
|
"json-schema-to-typescript": "^10.1.3",
|
||||||
"mustache": "^4.2.0",
|
"mustache": "^4.2.0",
|
||||||
"null-loader": "^4.0.0",
|
"null-loader": "^4.0.0",
|
||||||
|
|
Loading…
Add table
Reference in a new issue