This commit is contained in:
Jack Hartstein 2021-02-08 01:09:14 -08:00
commit 7f6cb482a5
176 changed files with 1652 additions and 622 deletions

View file

@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: DoozyX/clang-format-lint-action@v0.9
- uses: DoozyX/clang-format-lint-action@v0.11
with:
source: "./app"
extensions: "h,c"

12
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,12 @@
fail_fast: false
repos:
- repo: https://github.com/pocc/pre-commit-hooks
rev: master
hooks:
- id: clang-format
args:
- -i
- repo: https://github.com/prettier/prettier
rev: master
hooks:
- id: prettier

View file

@ -81,6 +81,11 @@ documentation to areas not currently covered are greatly appreciated.
- To get started, from the `docs/` directory, run `npm ci` and then `npm start`.
- Enhancements should be submitted as pull requests to the `main` branch of ZMK.
### Formatting
ZMK uses `prettier` to format documentation files. You can run prettier with `npm run prettier:format`.
You can setup git to run prettier automatically when you commit by installing the pre-commit hooks: `pip3 install pre-commit`, `pre-commit install`.
## Code Contributions
### Development Setup
@ -95,6 +100,8 @@ ZMK uses `clang-format` to ensure consist formatting for our source code. Before
changes, make sure you've manually run `clang-format`, or have your IDE configured to auto-format
on save.
You can setup git to run `clang-format` automatically when you commit by installing the pre-commit hooks: `pip3 install pre-commit`, `pre-commit install`.
### Commit Messages
The ZMK project is working towards, but not yet enforcing, the use of

View file

@ -337,11 +337,9 @@ config ZMK_KSCAN_EVENT_QUEUE_SIZE
config ZMK_KSCAN_MOCK_DRIVER
bool "Enable mock kscan driver to simulate key presses"
default n
config ZMK_KSCAN_COMPOSITE_DRIVER
bool "Enable composite kscan driver to combine kscan devices"
default n
#KSCAN Settings
endmenu

View file

@ -0,0 +1,3 @@
# Uncomment lines below to enable encoder
# CONFIG_EC11=y
# CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y

View file

@ -24,32 +24,37 @@
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp BSLH &kp RET
&trans &kp LGUI &kp LALT &kp LCTRL &mo 1 &kp SPACE &trans &mo 2 &kp LEFT &kp DOWN &kp UP &kp RIGHT
>;
sensor-bindings = <&inc_dec_kp PG_UP PG_DN>;
};
lower {
lower {
bindings = <
&kp LS(GRAVE) &kp LS(N1) &kp LS(N2) &kp LS(N3) &kp LS(N4) &kp LS(N5) &kp LS(N6) &kp LS(N7) &kp LS(N8) &kp LS(N9) &kp LS(N0) &kp DEL
&kp DEL &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp UNDER &kp PLUS &kp LT &kp GT &kp PIPE
&trans &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp LS(HASH) &kp LS(BSLH) &kp HOME &kp END &trans
&trans &trans &trans &trans &trans &trans &trans &mo 3 &kp C_NEXT &kp C_VOL_DN &kp C_VOL_UP &kp C_PP
>;
};
raise {
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
raise {
bindings = <
&kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSPC
&kp DEL &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp BSLH
&trans &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp HASH &kp BSLH &kp PG_UP &kp PG_DN &trans
&trans &trans &trans &trans &mo 3 &trans &trans &trans &kp C_NEXT &kp C_VOL_DN &kp C_VOL_UP &kp C_PP
>;
};
>;
};
control {
bindings = <
&reset &bootloader &bt BT_CLR &bt BT_PRV &bt BT_NXT &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 &trans &trans &trans &trans &trans
>;
};
};
>;
};
};
};

View file

@ -11,31 +11,45 @@
zmk,kscan = &kscan0;
};
kscan0: kscan_0 {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
kscan0: kscan_0 {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
col-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 3 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 4 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 5 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 6 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 7 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 8 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 9 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 10 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 16 GPIO_ACTIVE_HIGH>
;
col-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 3 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 4 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 5 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 6 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 7 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 8 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 9 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 10 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 16 GPIO_ACTIVE_HIGH>
;
row-gpios
= <&pro_micro_d 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_a 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_a 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
row-gpios
= <&pro_micro_d 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_a 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_a 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
encoder: encoder {
compatible = "alps,ec11";
label = "ENCODER";
a-gpios = <&pro_micro_a 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro_a 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <2>;
status = "okay";
};
sensors {
compatible = "zmk,keymap-sensors";
sensors = <&encoder>;
};
};

View file

@ -11,3 +11,38 @@ config ZMK_USB
endif
if ZMK_DISPLAY
config I2C
default y
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
config LVGL_HOR_RES_MAX
default 128
config LVGL_VER_RES_MAX
default 32
config LVGL_VDB_SIZE
default 64
config LVGL_DPI
default 148
config LVGL_BITS_PER_PIXEL
default 1
choice LVGL_COLOR_DEPTH
default LVGL_COLOR_DEPTH_1
endchoice
endif # LVGL

View file

@ -0,0 +1,29 @@
# Building ZMK for the Nibble
Some general notes/commands for building standard nibble layouts from the assembly documentation.
## LED Notes
If you built your nibble without the LEDs _and_ are using a nice!nano board, you'll need to change the following in your local nibble config or add them to the end of the file.
```
CONFIG_ZMK_RGB_UNDERGLOW=n
CONFIG_WS2812_STRIP=n
```
## Encoder Notes
If you built your nibble without an encoder, you'll need to change the following in your local nibble config or add them to the end of the file.
```
CONFIG_EC11=n
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=n
```
## OLED Builds
If using an OLED screen, you'll need to change the following in your local nibble config or add them to the end of the file.
```
CONFIG_ZMK_DISPLAY=y
```

View file

@ -0,0 +1,4 @@
# Enable underglow
CONFIG_ZMK_RGB_UNDERGLOW=y
# Use the STRIP config specific to the LEDs you're using
CONFIG_WS2812_STRIP=y

View file

@ -0,0 +1,34 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
&spi1 {
compatible = "nordic,nrf-spim";
status = "okay";
mosi-pin = <11>;
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
sck-pin = <5>;
miso-pin = <7>;
led_strip: ws2812@0 {
compatible = "worldsemi,ws2812-spi";
label = "WS2812";
/* SPI */
reg = <0>; /* ignored, but necessary for SPI bindings */
spi-max-frequency = <4000000>;
/* WS2812 */
chain-length = <10>; /* number of LEDs */
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;
};
};
/ {
chosen {
zmk,underglow = &led_strip;
};
};

View file

@ -0,0 +1 @@
CONFIG_SENSOR=y

View file

@ -0,0 +1,6 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
# Enable Encoders
CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y

View file

@ -8,30 +8,40 @@
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#define DEFAULT 0
#define FUNC 1
/ {
keymap {
compatible = "zmk,keymap";
sensors {
compatible = "zmk,keymap-sensors";
sensors = <&encoder_1>;
};
default_layer {
bindings = <
&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC &kp HOME
&kp C_VOL_UP &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH &kp DEL
&kp C_VOL_DN &kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp RET &kp PG_UP
&trans &kp LSHFT &trans &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT &kp UP &kp PG_DN
&trans &kp LCTRL &kp LGUI &kp LALT &kp SPACE &mo FUNC &kp RALT &kp RCTRL &kp LEFT &kp DOWN &kp RIGHT
>;
};
func {
bindings = <
&kp TILDE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &trans &kp END
&bt BT_CLR &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &bootloader
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&bt BT_PRV &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&bt BT_NXT &trans &trans &trans &trans &trans &trans &trans &kp C_PREV &kp C_PP &kp C_NEXT
>;
};
};
keymap {
compatible = "zmk,keymap";
default_layer {
label = "Default";
sensor-bindings = <&inc_dec_kp C_VOLUME_UP C_VOLUME_DOWN>;
bindings = <
&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC &kp HOME
&kp C_MUTE &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH &kp DEL
&trans &kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp RET &kp PG_UP
&trans &kp LSHFT &trans &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT &kp UP &kp PG_DN
&trans &kp LCTRL &kp LGUI &kp LALT &kp SPACE &mo 1 &kp RALT &kp RCTRL &kp LEFT &kp DOWN &kp RIGHT
>;
};
function_layer {
label = "Function";
sensor-bindings = <&inc_dec_kp C_VOLUME_UP C_VOLUME_DOWN>;
bindings = <
&kp TILDE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &trans &kp END
&kp C_MUTE &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &bootloader
&bt BT_CLR &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&bt BT_PRV &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&bt BT_NXT &trans &trans &trans &trans &trans &trans &trans &kp C_PREV &kp C_PP &kp C_NEXT
>;
};
};
};

View file

@ -12,6 +12,15 @@
zmk,matrix_transform = &default_transform;
};
encoder_1: encoder_1 {
compatible = "alps,ec11";
label = "Encoder 1";
a-gpios = <&pro_micro_d 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro_d 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
resolution = <4>;
status = "okay";
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-demux";
label = "KSCAN";
@ -36,14 +45,30 @@
columns = <16>;
rows = <5>;
//TODO: Add a keymap graphic here
map = <
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(0,12) RC(0,13) RC(0,14) RC(0,15)
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(1,12) RC(1,13) RC(1,14) RC(1,15)
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(2,12) RC(2,14) RC(2,15)
RC(3,0) RC(3,1) RC(0,0) 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(3,12) RC(3,14) RC(3,15)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,6) RC(4,9) RC(4,10) RC(4,11) RC(4,12) RC(4,14) RC(4,15)
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(0,12) RC(0,13) RC(0,14) RC(0,15)
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(1,12) RC(1,13) RC(1,14) RC(1,15)
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(2,12) RC(2,14) RC(2,15)
RC(3,0) RC(3,1) RC(0,0) 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(3,12) RC(3,14) RC(3,15)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,6) RC(4,9) RC(4,10) RC(4,11) RC(4,12) RC(4,14) RC(4,15)
>;
};
};
&pro_micro_i2c {
status = "okay";
oled: ssd1306@3c {
compatible = "solomon,ssd1306fb";
reg = <0x3c>;
label = "DISPLAY";
width = <128>;
height = <32>;
segment-offset = <0>;
page-offset = <0>;
display-offset = <0>;
multiplex-ratio = <31>;
com-sequential;
prechargep = <0x22>;
};
};

View file

@ -16,7 +16,7 @@ endif
if SHIELD_SPLITREUS62_RIGHT
config ZMK_KEYBOARD_NAME
default "Splitreus62 Right"
default "Splitreus62 Rt"
endif

View file

@ -10,11 +10,9 @@ if ZMK_KSCAN_GPIO_DRIVER
config ZMK_KSCAN_MATRIX_POLLING
bool "Poll for key event triggers instead of using interrupts on matrix boards."
default n
config ZMK_KSCAN_DIRECT_POLLING
bool "Poll for key event triggers instead of using interrupts on direct wired boards."
default n
endif

View file

@ -51,6 +51,11 @@ static int kscan_gpio_config_interrupts(const struct device **devices,
}
#endif
#define COND_POLLING(code) COND_CODE_1(CONFIG_ZMK_KSCAN_MATRIX_POLLING, (code), ())
#define COND_INTERRUPTS(code) COND_CODE_1(CONFIG_ZMK_KSCAN_MATRIX_POLLING, (), (code))
#define COND_POLL_OR_INTERRUPTS(pollcode, intcode) \
COND_CODE_1(CONFIG_ZMK_KSCAN_MATRIX_POLLING, pollcode, intcode)
#define INST_MATRIX_ROWS(n) DT_INST_PROP_LEN(n, row_gpios)
#define INST_MATRIX_COLS(n) DT_INST_PROP_LEN(n, col_gpios)
#define INST_OUTPUT_LEN(n) \
@ -61,19 +66,21 @@ static int kscan_gpio_config_interrupts(const struct device **devices,
(INST_MATRIX_ROWS(n)))
#define GPIO_INST_INIT(n) \
struct kscan_gpio_irq_callback_##n { \
struct COND_CODE_0(DT_INST_PROP(n, debounce_period), (k_work), (k_delayed_work)) * work; \
struct gpio_callback callback; \
const struct device *dev; \
}; \
static struct kscan_gpio_irq_callback_##n irq_callbacks_##n[INST_INPUT_LEN(n)]; \
COND_INTERRUPTS( \
struct kscan_gpio_irq_callback_##n { \
struct COND_CODE_0(DT_INST_PROP(n, debounce_period), (k_work), (k_delayed_work)) * \
work; \
struct gpio_callback callback; \
const struct device *dev; \
}; \
static struct kscan_gpio_irq_callback_##n irq_callbacks_##n[INST_INPUT_LEN(n)];) \
struct kscan_gpio_config_##n { \
struct kscan_gpio_item_config rows[INST_MATRIX_ROWS(n)]; \
struct kscan_gpio_item_config cols[INST_MATRIX_COLS(n)]; \
}; \
struct kscan_gpio_data_##n { \
kscan_callback_t callback; \
COND_CODE_1(CONFIG_ZMK_KSCAN_MATRIX_POLLING, (struct k_timer poll_timer;), ()) \
COND_POLLING(struct k_timer poll_timer;) \
struct COND_CODE_0(DT_INST_PROP(n, debounce_period), (k_work), (k_delayed_work)) work; \
bool matrix_state[INST_MATRIX_ROWS(n)][INST_MATRIX_COLS(n)]; \
const struct device *rows[INST_MATRIX_ROWS(n)]; \
@ -102,17 +109,16 @@ static int kscan_gpio_config_interrupts(const struct device **devices,
return ( \
COND_CODE_0(DT_ENUM_IDX(DT_DRV_INST(n), diode_direction), (cfg->rows), (cfg->cols))); \
} \
COND_CODE_1(CONFIG_ZMK_KSCAN_MATRIX_POLLING, (), \
( \
static int kscan_gpio_enable_interrupts_##n(const struct device *dev) { \
return kscan_gpio_config_interrupts( \
kscan_gpio_input_devices_##n(dev), kscan_gpio_input_configs_##n(dev), \
INST_INPUT_LEN(n), GPIO_INT_LEVEL_ACTIVE); \
} static int kscan_gpio_disable_interrupts_##n(const struct device *dev) { \
return kscan_gpio_config_interrupts(kscan_gpio_input_devices_##n(dev), \
kscan_gpio_input_configs_##n(dev), \
INST_INPUT_LEN(n), GPIO_INT_DISABLE); \
})) \
COND_INTERRUPTS( \
static int kscan_gpio_enable_interrupts_##n(const struct device *dev) { \
return kscan_gpio_config_interrupts(kscan_gpio_input_devices_##n(dev), \
kscan_gpio_input_configs_##n(dev), \
INST_INPUT_LEN(n), GPIO_INT_LEVEL_ACTIVE); \
} static int kscan_gpio_disable_interrupts_##n(const struct device *dev) { \
return kscan_gpio_config_interrupts(kscan_gpio_input_devices_##n(dev), \
kscan_gpio_input_configs_##n(dev), \
INST_INPUT_LEN(n), GPIO_INT_DISABLE); \
}) \
static void kscan_gpio_set_output_state_##n(const struct device *dev, int value) { \
int err; \
for (int i = 0; i < INST_OUTPUT_LEN(n); i++) { \
@ -132,17 +138,22 @@ static int kscan_gpio_config_interrupts(const struct device **devices,
(output_index))] = value; \
} \
static int kscan_gpio_read_##n(const struct device *dev) { \
bool submit_follow_up_read = false; \
COND_INTERRUPTS(bool submit_follow_up_read = false;) \
struct kscan_gpio_data_##n *data = dev->data; \
static bool read_state[INST_MATRIX_ROWS(n)][INST_MATRIX_COLS(n)]; \
int err; \
/* Disable our interrupts temporarily while we scan, to avoid */ \
/* re-entry while we iterate columns and set them active one by one */ \
/* to get pressed state for each matrix cell. */ \
kscan_gpio_set_output_state_##n(dev, 0); \
COND_INTERRUPTS(kscan_gpio_set_output_state_##n(dev, 0);) \
for (int o = 0; o < INST_OUTPUT_LEN(n); o++) { \
const struct device *out_dev = kscan_gpio_output_devices_##n(dev)[o]; \
const struct kscan_gpio_item_config *out_cfg = &kscan_gpio_output_configs_##n(dev)[o]; \
gpio_pin_set(out_dev, out_cfg->pin, 1); \
err = gpio_pin_set(out_dev, out_cfg->pin, 1); \
if (err) { \
LOG_ERR("Failed to set output active (err %d)", err); \
return err; \
} \
for (int i = 0; i < INST_INPUT_LEN(n); i++) { \
const struct device *in_dev = kscan_gpio_input_devices_##n(dev)[i]; \
const struct kscan_gpio_item_config *in_cfg = \
@ -150,16 +161,20 @@ static int kscan_gpio_config_interrupts(const struct device **devices,
kscan_gpio_set_matrix_state_##n(read_state, i, o, \
gpio_pin_get(in_dev, in_cfg->pin) > 0); \
} \
gpio_pin_set(out_dev, out_cfg->pin, 0); \
err = gpio_pin_set(out_dev, out_cfg->pin, 0); \
if (err) { \
LOG_ERR("Failed to set output inactive (err %d)", err); \
return err; \
} \
} \
/* Set all our outputs as active again. */ \
kscan_gpio_set_output_state_##n(dev, 1); \
COND_INTERRUPTS(kscan_gpio_set_output_state_##n(dev, 1);) \
for (int r = 0; r < INST_MATRIX_ROWS(n); r++) { \
for (int c = 0; c < INST_MATRIX_COLS(n); c++) { \
bool pressed = read_state[r][c]; \
/* Follow up reads needed because further interrupts won't fire on already tripped \
* input GPIO pins */ \
submit_follow_up_read = (submit_follow_up_read || pressed); \
COND_INTERRUPTS(submit_follow_up_read = (submit_follow_up_read || pressed);) \
if (pressed != data->matrix_state[r][c]) { \
LOG_DBG("Sending event at %d,%d state %s", r, c, (pressed ? "on" : "off")); \
data->matrix_state[r][c] = pressed; \
@ -167,33 +182,31 @@ static int kscan_gpio_config_interrupts(const struct device **devices,
} \
} \
} \
if (submit_follow_up_read) { \
COND_CODE_0(DT_INST_PROP(n, debounce_period), ({ k_work_submit(&data->work); }), ({ \
k_delayed_work_cancel(&data->work); \
k_delayed_work_submit(&data->work, K_MSEC(5)); \
})) \
} else { \
COND_CODE_1(CONFIG_ZMK_KSCAN_MATRIX_POLLING, (), \
(kscan_gpio_enable_interrupts_##n(dev);)) \
} \
COND_INTERRUPTS( \
if (submit_follow_up_read) { \
COND_CODE_0(DT_INST_PROP(n, debounce_period), ({ k_work_submit(&data->work); }), \
({ \
k_delayed_work_cancel(&data->work); \
k_delayed_work_submit(&data->work, K_MSEC(5)); \
})) \
} else { kscan_gpio_enable_interrupts_##n(dev); }) \
return 0; \
} \
static void kscan_gpio_work_handler_##n(struct k_work *work) { \
struct kscan_gpio_data_##n *data = CONTAINER_OF(work, struct kscan_gpio_data_##n, work); \
kscan_gpio_read_##n(data->dev); \
} \
static void kscan_gpio_irq_callback_handler_##n( \
COND_INTERRUPTS(static void kscan_gpio_irq_callback_handler_##n( \
const struct device *dev, struct gpio_callback *cb, gpio_port_pins_t pin) { \
struct kscan_gpio_irq_callback_##n *data = \
CONTAINER_OF(cb, struct kscan_gpio_irq_callback_##n, callback); \
COND_CODE_1(CONFIG_ZMK_KSCAN_MATRIX_POLLING, (), \
(kscan_gpio_disable_interrupts_##n(data->dev);)) \
kscan_gpio_disable_interrupts_##n(data->dev); \
COND_CODE_0(DT_INST_PROP(n, debounce_period), ({ k_work_submit(data->work); }), ({ \
k_delayed_work_cancel(data->work); \
k_delayed_work_submit(data->work, \
K_MSEC(DT_INST_PROP(n, debounce_period))); \
})) \
} \
}) \
\
static struct kscan_gpio_data_##n kscan_gpio_data_##n = { \
.rows = {[INST_MATRIX_ROWS(n) - 1] = NULL}, .cols = {[INST_MATRIX_COLS(n) - 1] = NULL}}; \
@ -207,25 +220,22 @@ static int kscan_gpio_config_interrupts(const struct device **devices,
return 0; \
}; \
static int kscan_gpio_enable_##n(const struct device *dev) { \
COND_CODE_1(CONFIG_ZMK_KSCAN_MATRIX_POLLING, \
(struct kscan_gpio_data_##n *data = dev->data; \
k_timer_start(&data->poll_timer, K_MSEC(10), K_MSEC(10)); return 0;), \
(int err = kscan_gpio_enable_interrupts_##n(dev); \
if (err) { return err; } return kscan_gpio_read_##n(dev);)) \
COND_POLL_OR_INTERRUPTS((struct kscan_gpio_data_##n *data = dev->data; \
k_timer_start(&data->poll_timer, K_MSEC(10), K_MSEC(10)); \
return 0;), \
(int err = kscan_gpio_enable_interrupts_##n(dev); \
if (err) { return err; } return kscan_gpio_read_##n(dev);)) \
}; \
static int kscan_gpio_disable_##n(const struct device *dev) { \
COND_CODE_1(CONFIG_ZMK_KSCAN_MATRIX_POLLING, \
(struct kscan_gpio_data_##n *data = dev->data; \
k_timer_stop(&data->poll_timer); return 0;), \
(return kscan_gpio_disable_interrupts_##n(dev);)) \
COND_POLL_OR_INTERRUPTS((struct kscan_gpio_data_##n *data = dev->data; \
k_timer_stop(&data->poll_timer); return 0;), \
(return kscan_gpio_disable_interrupts_##n(dev);)) \
}; \
COND_CODE_1(CONFIG_ZMK_KSCAN_MATRIX_POLLING, \
(static void kscan_gpio_timer_handler(struct k_timer *timer) { \
struct kscan_gpio_data_##n *data = \
CONTAINER_OF(timer, struct kscan_gpio_data_##n, poll_timer); \
k_work_submit(&data->work.work); \
}), \
()) \
COND_POLLING(static void kscan_gpio_timer_handler_##n(struct k_timer *timer) { \
struct kscan_gpio_data_##n *data = \
CONTAINER_OF(timer, struct kscan_gpio_data_##n, poll_timer); \
k_work_submit(&data->work.work); \
}) \
static int kscan_gpio_init_##n(const struct device *dev) { \
struct kscan_gpio_data_##n *data = dev->data; \
int err; \
@ -244,15 +254,15 @@ static int kscan_gpio_config_interrupts(const struct device **devices,
} else { \
LOG_DBG("Configured pin %d on %s for input", in_cfg->pin, in_cfg->label); \
} \
irq_callbacks_##n[i].work = &data->work; \
irq_callbacks_##n[i].dev = dev; \
gpio_init_callback(&irq_callbacks_##n[i].callback, \
kscan_gpio_irq_callback_handler_##n, BIT(in_cfg->pin)); \
err = gpio_add_callback(input_devices[i], &irq_callbacks_##n[i].callback); \
if (err) { \
LOG_ERR("Error adding the callback to the column device"); \
return err; \
} \
COND_INTERRUPTS( \
irq_callbacks_##n[i].work = &data->work; irq_callbacks_##n[i].dev = dev; \
gpio_init_callback(&irq_callbacks_##n[i].callback, \
kscan_gpio_irq_callback_handler_##n, BIT(in_cfg->pin)); \
err = gpio_add_callback(input_devices[i], &irq_callbacks_##n[i].callback); \
if (err) { \
LOG_ERR("Error adding the callback to the input device"); \
return err; \
}) \
} \
const struct device **output_devices = kscan_gpio_output_devices_##n(dev); \
for (int o = 0; o < INST_OUTPUT_LEN(n); o++) { \
@ -262,8 +272,8 @@ static int kscan_gpio_config_interrupts(const struct device **devices,
LOG_ERR("Unable to find output GPIO device"); \
return -EINVAL; \
} \
err = gpio_pin_configure(output_devices[o], out_cfg->pin, \
GPIO_OUTPUT_ACTIVE | out_cfg->flags); \
err = \
gpio_pin_configure(output_devices[o], out_cfg->pin, GPIO_OUTPUT | out_cfg->flags); \
if (err) { \
LOG_ERR("Unable to configure pin %d on %s for output", out_cfg->pin, \
out_cfg->label); \
@ -271,10 +281,12 @@ static int kscan_gpio_config_interrupts(const struct device **devices,
} \
} \
data->dev = dev; \
COND_CODE_1(CONFIG_ZMK_KSCAN_MATRIX_POLLING, \
(k_timer_init(&data->poll_timer, kscan_gpio_timer_handler, NULL);), ()) \
(COND_CODE_0(DT_INST_PROP(n, debounce_period), (k_work_init), (k_delayed_work_init)))( \
&data->work, kscan_gpio_work_handler_##n); \
COND_POLL_OR_INTERRUPTS( \
(k_timer_init(&data->poll_timer, kscan_gpio_timer_handler_##n, NULL); \
kscan_gpio_set_output_state_##n(dev, 0);), \
(kscan_gpio_set_output_state_##n(dev, 1);)) \
return 0; \
} \
static const struct kscan_driver_api gpio_driver_api_##n = { \

View file

@ -77,6 +77,9 @@ static int bvd_sample_fetch(const struct device *dev, enum sensor_channel chan)
LOG_DBG("Failed to enable ADC power GPIO: %d", rc);
return rc;
}
// wait for any capacitance to charge up
k_sleep(K_MSEC(10));
}
// Read ADC

View file

@ -6,7 +6,7 @@
/ {
behaviors {
bt: behavior_bluetooth {
/omit-if-no-ref/ bt: behavior_bluetooth {
compatible = "zmk,behavior-bluetooth";
label = "BLUETOOTH";
#binding-cells = <2>;

View file

@ -6,7 +6,7 @@
/ {
behaviors {
ext_power: behavior_ext_power {
/omit-if-no-ref/ ext_power: behavior_ext_power {
compatible = "zmk,behavior-ext-power";
label = "EXT_POWER_BEHAVIOR";
#binding-cells = <1>;

View file

@ -7,7 +7,7 @@
/ {
behaviors {
/* DEPRECATED: `cp` will be removed in the future */
cp: kp: behavior_key_press {
/omit-if-no-ref/ cp: kp: behavior_key_press {
compatible = "zmk,behavior-key-press";
label = "KEY_PRESS";
#binding-cells = <1>;

View file

@ -6,7 +6,7 @@
/ {
behaviors {
lt: behavior_layer_tap {
/omit-if-no-ref/ lt: behavior_layer_tap {
compatible = "zmk,behavior-hold-tap";
label = "LAYER_TAP";
#binding-cells = <2>;

View file

@ -6,7 +6,7 @@
/ {
behaviors {
mt: behavior_mod_tap {
/omit-if-no-ref/ mt: behavior_mod_tap {
compatible = "zmk,behavior-hold-tap";
label = "MOD_TAP";
#binding-cells = <2>;

View file

@ -6,7 +6,7 @@
/ {
behaviors {
mo: behavior_momentary_layer {
/omit-if-no-ref/ mo: behavior_momentary_layer {
compatible = "zmk,behavior-momentary-layer";
label = "MO";
#binding-cells = <1>;

View file

@ -6,7 +6,7 @@
/ {
behaviors {
none: behavior_none {
/omit-if-no-ref/ none: behavior_none {
compatible = "zmk,behavior-none";
label = "NONE";
#binding-cells = <0>;

View file

@ -6,7 +6,7 @@
/ {
behaviors {
out: behavior_outputs {
/omit-if-no-ref/ out: behavior_outputs {
compatible = "zmk,behavior-outputs";
label = "OUTPUTS";
#binding-cells = <1>;

View file

@ -8,13 +8,13 @@
/ {
behaviors {
reset: behavior_reset {
/omit-if-no-ref/ reset: behavior_reset {
compatible = "zmk,behavior-reset";
label = "RESET";
#binding-cells = <0>;
};
bootloader: behavior_reset_dfu {
/omit-if-no-ref/ bootloader: behavior_reset_dfu {
compatible = "zmk,behavior-reset";
label = "BOOTLOADER_RESET";
type = <RST_UF2>;

View file

@ -6,7 +6,7 @@
/ {
behaviors {
rgb_ug: behavior_rgb_underglow {
/omit-if-no-ref/ rgb_ug: behavior_rgb_underglow {
compatible = "zmk,behavior-rgb-underglow";
label = "RGB_UNDERGLOW";
#binding-cells = <2>;

View file

@ -7,7 +7,7 @@
/ {
behaviors {
/* DEPRECATED: `inc_dec_cp` will be removed in the future */
inc_dec_cp: inc_dec_kp: behavior_sensor_rotate_key_press {
/omit-if-no-ref/ inc_dec_cp: inc_dec_kp: behavior_sensor_rotate_key_press {
compatible = "zmk,behavior-sensor-rotate-key-press";
label = "ENC_KEY_PRESS";
#sensor-binding-cells = <2>;

View file

@ -6,19 +6,20 @@
/ {
behaviors {
sk: behavior_sticky_key {
/omit-if-no-ref/ sk: behavior_sticky_key {
compatible = "zmk,behavior-sticky-key";
label = "STICKY_KEY";
#binding-cells = <1>;
release-after-ms = <1000>;
bindings = <&kp>;
};
sl: behavior_sticky_layer {
/omit-if-no-ref/ sl: behavior_sticky_layer {
compatible = "zmk,behavior-sticky-key";
label = "STICKY_LAYER";
#binding-cells = <1>;
release-after-ms = <1000>;
bindings = <&mo>;
quick-release;
};
};

View file

@ -6,7 +6,7 @@
/ {
behaviors {
to: behavior_to_layer {
/omit-if-no-ref/ to: behavior_to_layer {
compatible = "zmk,behavior-to-layer";
label = "TO_LAYER";
#binding-cells = <1>;

View file

@ -6,7 +6,7 @@
/ {
behaviors {
tog: behavior_toggle_layer {
/omit-if-no-ref/ tog: behavior_toggle_layer {
compatible = "zmk,behavior-toggle-layer";
label = "TOGGLE_LAYER";
#binding-cells = <1>;

View file

@ -6,7 +6,7 @@
/ {
behaviors {
trans: behavior_transparent {
/omit-if-no-ref/ trans: behavior_transparent {
compatible = "zmk,behavior-transparent";
label = "TRANS";
#binding-cells = <0>;

View file

@ -13,6 +13,9 @@ properties:
required: true
tapping_term_ms:
type: int
quick_tap_ms:
type: int
default: -1
flavor:
type: string
required: false

View file

@ -13,3 +13,5 @@ properties:
required: true
release-after-ms:
type: int
quick-release:
type: boolean

View file

@ -20,3 +20,6 @@ child-binding:
default: 50
slow-release:
type: boolean
layers:
type: array
default: [-1]

View file

@ -7,8 +7,6 @@
#pragma once
#include <zephyr.h>
#include <dt-bindings/zmk/modifiers.h>
#include <dt-bindings/zmk/hid_usage_pages.h>
#include <zmk/event_manager.h>
#include <zmk/keys.h>
@ -16,6 +14,7 @@ struct zmk_keycode_state_changed {
uint16_t usage_page;
uint32_t keycode;
uint8_t implicit_modifiers;
uint8_t explicit_modifiers;
bool state;
int64_t timestamp;
};
@ -26,16 +25,24 @@ static inline struct zmk_keycode_state_changed_event *
zmk_keycode_state_changed_from_encoded(uint32_t encoded, bool pressed, int64_t timestamp) {
uint16_t page = HID_USAGE_PAGE(encoded) & 0xFF;
uint16_t id = HID_USAGE_ID(encoded);
zmk_mod_flags_t implicit_mods = SELECT_MODS(encoded);
uint8_t implicit_modifiers = 0x00;
uint8_t explicit_modifiers = 0x00;
if (!page) {
page = HID_USAGE_KEY;
}
if (is_mod(page, id)) {
explicit_modifiers = SELECT_MODS(encoded);
} else {
implicit_modifiers = SELECT_MODS(encoded);
}
return new_zmk_keycode_state_changed(
(struct zmk_keycode_state_changed){.usage_page = page,
.keycode = id,
.implicit_modifiers = implicit_mods,
.implicit_modifiers = implicit_modifiers,
.explicit_modifiers = explicit_modifiers,
.state = pressed,
.timestamp = timestamp});
}

View file

@ -169,6 +169,8 @@ struct zmk_hid_consumer_report {
zmk_mod_flags_t zmk_hid_get_explicit_mods();
int zmk_hid_register_mod(zmk_mod_t modifier);
int zmk_hid_unregister_mod(zmk_mod_t modifier);
int zmk_hid_register_mods(zmk_mod_flags_t explicit_modifiers);
int zmk_hid_unregister_mods(zmk_mod_flags_t explicit_modifiers);
int zmk_hid_implicit_modifiers_press(zmk_mod_flags_t implicit_modifiers);
int zmk_hid_implicit_modifiers_release();
int zmk_hid_keyboard_press(zmk_key_t key);

View file

@ -19,3 +19,12 @@ int zmk_keymap_layer_to(uint8_t layer);
const char *zmk_keymap_layer_label(uint8_t layer);
int zmk_keymap_position_state_changed(uint32_t position, bool pressed, int64_t timestamp);
#define ZMK_KEYMAP_EXTRACT_BINDING(idx, drv_inst) \
{ \
.behavior_dev = DT_LABEL(DT_PHANDLE_BY_IDX(drv_inst, bindings, idx)), \
.param1 = COND_CODE_0(DT_PHA_HAS_CELL_AT_IDX(drv_inst, bindings, idx, param1), (0), \
(DT_PHA_BY_IDX(drv_inst, bindings, idx, param1))), \
.param2 = COND_CODE_0(DT_PHA_HAS_CELL_AT_IDX(drv_inst, bindings, idx, param2), (0), \
(DT_PHA_BY_IDX(drv_inst, bindings, idx, param2))), \
}

View file

@ -18,4 +18,9 @@ struct zmk_key_event {
uint32_t row;
zmk_key_t key;
bool pressed;
};
};
static inline bool is_mod(uint8_t usage_page, uint32_t keycode) {
return (keycode >= HID_USAGE_KEY_KEYBOARD_LEFTCONTROL &&
keycode <= HID_USAGE_KEY_KEYBOARD_RIGHT_GUI && usage_page == HID_USAGE_KEY);
}

View file

@ -17,6 +17,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <zmk/ble.h>
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
switch (binding->param1) {
@ -49,3 +51,5 @@ static const struct behavior_driver_api behavior_bt_driver_api = {
DEVICE_AND_API_INIT(behavior_bt, DT_INST_LABEL(0), behavior_bt_init, NULL, NULL, APPLICATION,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_bt_driver_api);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -16,6 +16,8 @@
#include <logging/log.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
const struct device *ext_power = device_get_binding("EXT_POWER");
@ -55,3 +57,5 @@ static const struct behavior_driver_api behavior_ext_power_driver_api = {
DEVICE_AND_API_INIT(behavior_ext_power, DT_INST_LABEL(0), behavior_ext_power_init, NULL, NULL,
APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY, &behavior_ext_power_driver_api);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -8,8 +8,8 @@
#include <device.h>
#include <drivers/behavior.h>
#include <zmk/keys.h>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/hid_usage_pages.h>
#include <logging/log.h>
#include <zmk/behavior.h>
#include <zmk/matrix.h>
@ -17,12 +17,12 @@
#include <zmk/event_manager.h>
#include <zmk/events/position_state_changed.h>
#include <zmk/events/keycode_state_changed.h>
#include <zmk/events/modifiers_state_changed.h>
#include <zmk/behavior.h>
#include <zmk/keymap.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#if DT_NODE_EXISTS(DT_DRV_INST(0))
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
#define ZMK_BHV_HOLD_TAP_MAX_HELD 10
#define ZMK_BHV_HOLD_TAP_MAX_CAPTURED_EVENTS 40
@ -36,14 +36,11 @@ enum flavor {
ZMK_BHV_HOLD_TAP_FLAVOR_TAP_PREFERRED = 2,
};
struct behavior_hold_tap_behaviors {
struct zmk_behavior_binding tap;
struct zmk_behavior_binding hold;
};
struct behavior_hold_tap_config {
int tapping_term_ms;
struct behavior_hold_tap_behaviors *behaviors;
char *hold_behavior_dev;
char *tap_behavior_dev;
int quick_tap_ms;
enum flavor flavor;
};
@ -71,6 +68,24 @@ struct active_hold_tap active_hold_taps[ZMK_BHV_HOLD_TAP_MAX_HELD] = {};
// We capture most position_state_changed events and some modifiers_state_changed events.
const zmk_event_t *captured_events[ZMK_BHV_HOLD_TAP_MAX_CAPTURED_EVENTS] = {};
// Keep track of which key was tapped most recently for 'quick_tap_ms'
struct last_tapped {
int32_t position;
int64_t tap_deadline;
};
struct last_tapped last_tapped;
static void store_last_tapped(struct active_hold_tap *hold_tap) {
last_tapped.position = hold_tap->position;
last_tapped.tap_deadline = hold_tap->timestamp + hold_tap->config->quick_tap_ms;
}
static bool is_quick_tap(struct active_hold_tap *hold_tap) {
return last_tapped.position == hold_tap->position &&
last_tapped.tap_deadline > hold_tap->timestamp;
}
static int capture_event(const zmk_event_t *event) {
for (int i = 0; i < ZMK_BHV_HOLD_TAP_MAX_CAPTURED_EVENTS; i++) {
if (captured_events[i] == NULL) {
@ -195,6 +210,7 @@ enum decision_moment {
HT_OTHER_KEY_DOWN = 1,
HT_OTHER_KEY_UP = 2,
HT_TIMER_EVENT = 3,
HT_QUICK_TAP = 4,
};
static void decide_balanced(struct active_hold_tap *hold_tap, enum decision_moment event) {
@ -208,6 +224,10 @@ static void decide_balanced(struct active_hold_tap *hold_tap, enum decision_mome
hold_tap->is_hold = 1;
hold_tap->is_decided = true;
break;
case HT_QUICK_TAP:
hold_tap->is_hold = 0;
hold_tap->is_decided = true;
break;
default:
return;
}
@ -223,6 +243,10 @@ static void decide_tap_preferred(struct active_hold_tap *hold_tap, enum decision
hold_tap->is_hold = 1;
hold_tap->is_decided = true;
break;
case HT_QUICK_TAP:
hold_tap->is_hold = 0;
hold_tap->is_decided = true;
break;
default:
return;
}
@ -239,6 +263,10 @@ static void decide_hold_preferred(struct active_hold_tap *hold_tap, enum decisio
hold_tap->is_hold = 1;
hold_tap->is_decided = true;
break;
case HT_QUICK_TAP:
hold_tap->is_hold = 0;
hold_tap->is_decided = true;
break;
default:
return;
}
@ -290,13 +318,14 @@ static void decide_hold_tap(struct active_hold_tap *hold_tap, enum decision_mome
struct zmk_behavior_binding binding;
if (hold_tap->is_hold) {
binding.behavior_dev = hold_tap->config->behaviors->hold.behavior_dev;
binding.behavior_dev = hold_tap->config->hold_behavior_dev;
binding.param1 = hold_tap->param_hold;
binding.param2 = 0;
} else {
binding.behavior_dev = hold_tap->config->behaviors->tap.behavior_dev;
binding.behavior_dev = hold_tap->config->tap_behavior_dev;
binding.param1 = hold_tap->param_tap;
binding.param2 = 0;
store_last_tapped(hold_tap);
}
behavior_keymap_binding_pressed(&binding, event);
release_captured_events();
@ -324,6 +353,10 @@ static int on_hold_tap_binding_pressed(struct zmk_behavior_binding *binding,
LOG_DBG("%d new undecided hold_tap", event.position);
undecided_hold_tap = hold_tap;
if (is_quick_tap(hold_tap)) {
decide_hold_tap(hold_tap, HT_QUICK_TAP);
}
// if this behavior was queued we have to adjust the timer to only
// wait for the remaining time.
int32_t tapping_term_ms_left = (hold_tap->timestamp + cfg->tapping_term_ms) - k_uptime_get();
@ -351,7 +384,8 @@ static int on_hold_tap_binding_released(struct zmk_behavior_binding *binding,
decide_hold_tap(hold_tap, HT_KEY_UP);
// todo: set up the binding and data items inside of the active_hold_tap struct
// todo: set up the binding and data items inside of the
// active_hhold_tap->config->behaviors->tap.behavior_dev;old_tap struct
struct zmk_behavior_binding_event sub_behavior_data = {
.position = hold_tap->position,
.timestamp = hold_tap->timestamp,
@ -359,11 +393,11 @@ static int on_hold_tap_binding_released(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding sub_behavior_binding;
if (hold_tap->is_hold) {
sub_behavior_binding.behavior_dev = hold_tap->config->behaviors->hold.behavior_dev;
sub_behavior_binding.behavior_dev = hold_tap->config->hold_behavior_dev;
sub_behavior_binding.param1 = hold_tap->param_hold;
sub_behavior_binding.param2 = 0;
} else {
sub_behavior_binding.behavior_dev = hold_tap->config->behaviors->tap.behavior_dev;
sub_behavior_binding.behavior_dev = hold_tap->config->tap_behavior_dev;
sub_behavior_binding.param1 = hold_tap->param_tap;
sub_behavior_binding.param2 = 0;
}
@ -428,11 +462,6 @@ static int position_state_changed_listener(const zmk_event_t *eh) {
return ZMK_EV_EVENT_CAPTURED;
}
static inline bool only_mods(struct zmk_keycode_state_changed *ev) {
return ev->usage_page == HID_USAGE_KEY && ev->keycode >= HID_USAGE_KEY_KEYBOARD_LEFTCONTROL &&
ev->keycode <= HID_USAGE_KEY_KEYBOARD_RIGHT_GUI;
}
static int keycode_state_changed_listener(const zmk_event_t *eh) {
// we want to catch layer-up events too... how?
struct zmk_keycode_state_changed *ev = as_zmk_keycode_state_changed(eh);
@ -442,7 +471,7 @@ static int keycode_state_changed_listener(const zmk_event_t *eh) {
return ZMK_EV_EVENT_BUBBLE;
}
if (!only_mods(ev)) {
if (!is_mod(ev->usage_page, ev->keycode)) {
// LOG_DBG("0x%02X bubble (not a mod)", ev->keycode);
return ZMK_EV_EVENT_BUBBLE;
}
@ -495,22 +524,12 @@ static int behavior_hold_tap_init(const struct device *dev) {
struct behavior_hold_tap_data {};
static struct behavior_hold_tap_data behavior_hold_tap_data;
/* todo: get rid of unused param1 and param2. */
#define _TRANSFORM_ENTRY(idx, node) \
{ \
.behavior_dev = DT_LABEL(DT_INST_PHANDLE_BY_IDX(node, bindings, idx)), \
.param1 = COND_CODE_0(DT_INST_PHA_HAS_CELL_AT_IDX(node, bindings, idx, param1), (0), \
(DT_INST_PHA_BY_IDX(node, bindings, idx, param1))), \
.param2 = COND_CODE_0(DT_INST_PHA_HAS_CELL_AT_IDX(node, bindings, idx, param2), (0), \
(DT_INST_PHA_BY_IDX(node, bindings, idx, param2))), \
},
#define KP_INST(n) \
static struct behavior_hold_tap_behaviors behavior_hold_tap_behaviors_##n = { \
.hold = _TRANSFORM_ENTRY(0, n).tap = _TRANSFORM_ENTRY(1, n)}; \
static struct behavior_hold_tap_config behavior_hold_tap_config_##n = { \
.behaviors = &behavior_hold_tap_behaviors_##n, \
.tapping_term_ms = DT_INST_PROP(n, tapping_term_ms), \
.hold_behavior_dev = DT_LABEL(DT_INST_PHANDLE_BY_IDX(n, bindings, 0)), \
.tap_behavior_dev = DT_LABEL(DT_INST_PHANDLE_BY_IDX(n, bindings, 1)), \
.quick_tap_ms = DT_INST_PROP(n, quick_tap_ms), \
.flavor = DT_ENUM_IDX(DT_DRV_INST(n), flavor), \
}; \
DEVICE_AND_API_INIT(behavior_hold_tap_##n, DT_INST_LABEL(n), behavior_hold_tap_init, \
@ -519,4 +538,4 @@ static struct behavior_hold_tap_data behavior_hold_tap_data;
DT_INST_FOREACH_STATUS_OKAY(KP_INST)
#endif
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -15,8 +15,7 @@
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
struct behavior_none_config {};
struct behavior_none_data {};
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
static int behavior_none_init(const struct device *dev) { return 0; };
@ -35,10 +34,7 @@ static const struct behavior_driver_api behavior_none_driver_api = {
.binding_released = on_keymap_binding_released,
};
static const struct behavior_none_config behavior_none_config = {};
DEVICE_AND_API_INIT(behavior_none, DT_INST_LABEL(0), behavior_none_init, NULL, NULL, APPLICATION,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_none_driver_api);
static struct behavior_none_data behavior_none_data;
DEVICE_AND_API_INIT(behavior_none, DT_INST_LABEL(0), behavior_none_init, &behavior_none_data,
&behavior_none_config, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
&behavior_none_driver_api);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -18,6 +18,8 @@
#include <logging/log.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
switch (binding->param1) {
@ -42,3 +44,5 @@ static const struct behavior_driver_api behavior_outputs_driver_api = {
DEVICE_AND_API_INIT(behavior_out, DT_INST_LABEL(0), behavior_out_init, NULL, NULL, APPLICATION,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_outputs_driver_api);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -15,6 +15,7 @@
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
struct behavior_reset_config {
int type;
};
@ -44,4 +45,6 @@ static const struct behavior_driver_api behavior_reset_driver_api = {
&behavior_reset_config_##n, APPLICATION, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_reset_driver_api);
DT_INST_FOREACH_STATUS_OKAY(RST_INST)
DT_INST_FOREACH_STATUS_OKAY(RST_INST)
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -16,6 +16,8 @@
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
static int behavior_rgb_underglow_init(const struct device *dev) { return 0; }
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
@ -63,4 +65,6 @@ static const struct behavior_driver_api behavior_rgb_underglow_driver_api = {
DEVICE_AND_API_INIT(behavior_rgb_underglow, DT_INST_LABEL(0), behavior_rgb_underglow_init, NULL,
NULL, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
&behavior_rgb_underglow_driver_api);
&behavior_rgb_underglow_driver_api);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -16,6 +16,8 @@
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
static int behavior_sensor_rotate_key_press_init(const struct device *dev) { return 0; };
static int on_sensor_binding_triggered(struct zmk_behavior_binding *binding,
@ -62,4 +64,6 @@ static const struct behavior_driver_api behavior_sensor_rotate_key_press_driver_
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
&behavior_sensor_rotate_key_press_driver_api);
DT_INST_FOREACH_STATUS_OKAY(KP_INST)
DT_INST_FOREACH_STATUS_OKAY(KP_INST)
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -18,6 +18,7 @@
#include <zmk/events/keycode_state_changed.h>
#include <zmk/events/modifiers_state_changed.h>
#include <zmk/hid.h>
#include <zmk/keymap.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
@ -29,6 +30,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
struct behavior_sticky_key_config {
uint32_t release_after_ms;
bool quick_release;
struct zmk_behavior_binding behavior;
};
@ -209,10 +211,12 @@ static int sticky_key_keycode_state_changed_listener(const zmk_event_t *eh) {
}
if (sticky_key->timer_started) {
stop_timer(sticky_key);
if (sticky_key->config->quick_release) {
release_sticky_key_behavior(sticky_key, ev->timestamp);
}
}
sticky_key->modified_key_usage_page = ev->usage_page;
sticky_key->modified_key_keycode = ev->keycode;
} else { // key up
if (sticky_key->timer_started &&
sticky_key->modified_key_usage_page == ev->usage_page &&
@ -257,18 +261,11 @@ static int behavior_sticky_key_init(const struct device *dev) {
struct behavior_sticky_key_data {};
static struct behavior_sticky_key_data behavior_sticky_key_data;
#define _TRANSFORM_ENTRY(idx, node) \
{ \
.behavior_dev = DT_LABEL(DT_INST_PHANDLE_BY_IDX(node, bindings, idx)), \
.param1 = COND_CODE_0(DT_INST_PHA_HAS_CELL_AT_IDX(node, bindings, idx, param1), (0), \
(DT_INST_PHA_BY_IDX(node, bindings, idx, param1))), \
.param2 = COND_CODE_0(DT_INST_PHA_HAS_CELL_AT_IDX(node, bindings, idx, param2), (0), \
(DT_INST_PHA_BY_IDX(node, bindings, idx, param2))), \
},
#define KP_INST(n) \
static struct behavior_sticky_key_config behavior_sticky_key_config_##n = { \
.behavior = _TRANSFORM_ENTRY(0, n).release_after_ms = DT_INST_PROP(n, release_after_ms), \
.behavior = ZMK_KEYMAP_EXTRACT_BINDING(0, DT_DRV_INST(n)), \
.release_after_ms = DT_INST_PROP(n, release_after_ms), \
.quick_release = DT_INST_PROP(n, quick_release), \
}; \
DEVICE_AND_API_INIT(behavior_sticky_key_##n, DT_INST_LABEL(n), behavior_sticky_key_init, \
&behavior_sticky_key_data, &behavior_sticky_key_config_##n, APPLICATION, \
@ -276,4 +273,4 @@ static struct behavior_sticky_key_data behavior_sticky_key_data;
DT_INST_FOREACH_STATUS_OKAY(KP_INST)
#endif
#endif

View file

@ -15,6 +15,8 @@
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
static int behavior_to_init(const struct device *dev) { return 0; };
static int to_keymap_binding_pressed(struct zmk_behavior_binding *binding,
@ -37,3 +39,5 @@ static const struct behavior_driver_api behavior_to_driver_api = {
DEVICE_AND_API_INIT(behavior_to, DT_INST_LABEL(0), behavior_to_init, NULL, NULL, APPLICATION,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_to_driver_api);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -15,6 +15,8 @@
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
struct behavior_tog_config {};
struct behavior_tog_data {};
@ -44,3 +46,5 @@ static struct behavior_tog_data behavior_tog_data;
DEVICE_AND_API_INIT(behavior_tog, DT_INST_LABEL(0), behavior_tog_init, &behavior_tog_data,
&behavior_tog_config, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
&behavior_tog_driver_api);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -15,8 +15,7 @@
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
struct behavior_transparent_config {};
struct behavior_transparent_data {};
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
static int behavior_transparent_init(const struct device *dev) { return 0; };
@ -35,10 +34,8 @@ static const struct behavior_driver_api behavior_transparent_driver_api = {
.binding_released = on_keymap_binding_released,
};
static const struct behavior_transparent_config behavior_transparent_config = {};
DEVICE_AND_API_INIT(behavior_transparent, DT_INST_LABEL(0), behavior_transparent_init, NULL, NULL,
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
&behavior_transparent_driver_api);
static struct behavior_transparent_data behavior_transparent_data;
DEVICE_AND_API_INIT(behavior_transparent, DT_INST_LABEL(0), behavior_transparent_init,
&behavior_transparent_data, &behavior_transparent_config, APPLICATION,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_transparent_driver_api);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -63,6 +63,8 @@ static uint8_t active_profile;
#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
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 \
@ -429,7 +431,7 @@ static void le_param_updated(struct bt_conn *conn, uint16_t interval, uint16_t l
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
LOG_DBG("%s: interval %d latency %d timeout %d", addr, interval, latency, timeout);
LOG_DBG("%s: interval %d latency %d timeout %d", log_strdup(addr), interval, latency, timeout);
}
static struct bt_conn_cb conn_callbacks = {

View file

@ -17,6 +17,7 @@
#include <zmk/events/position_state_changed.h>
#include <zmk/hid.h>
#include <zmk/matrix.h>
#include <zmk/keymap.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
@ -33,6 +34,8 @@ struct combo_cfg {
// the virtual key position is a key position outside the range used by the keyboard.
// it is necessary so hold-taps can uniquely identify a behavior.
int32_t virtual_key_position;
int32_t layers_len;
int8_t layers[];
};
struct active_combo {
@ -104,17 +107,35 @@ static int initialize_combo(struct combo_cfg *new_combo) {
return 0;
}
static bool combo_active_on_layer(struct combo_cfg *combo, uint8_t layer) {
if (combo->layers[0] == -1) {
// -1 in the first layer position is global layer scope
return true;
}
for (int j = 0; j < combo->layers_len; j++) {
if (combo->layers[j] == layer) {
return true;
}
}
return false;
}
static int setup_candidates_for_first_keypress(int32_t position, int64_t timestamp) {
int number_of_combo_candidates = 0;
uint8_t highest_active_layer = zmk_keymap_highest_layer_active();
for (int i = 0; i < CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY; i++) {
struct combo_cfg *combo = combo_lookup[position][i];
if (combo == NULL) {
return i;
return number_of_combo_candidates;
}
if (combo_active_on_layer(combo, highest_active_layer)) {
candidates[number_of_combo_candidates].combo = combo;
candidates[number_of_combo_candidates].timeout_at = timestamp + combo->timeout_ms;
number_of_combo_candidates++;
}
candidates[i].combo = combo;
candidates[i].timeout_at = timestamp + combo->timeout_ms;
// LOG_DBG("combo timeout %d %d %d", position, i, candidates[i].timeout_at);
}
return CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY;
return number_of_combo_candidates;
}
static int filter_candidates(int32_t position) {
@ -451,6 +472,8 @@ ZMK_SUBSCRIPTION(combo, zmk_position_state_changed);
.behavior = KEY_BINDING_TO_STRUCT(0, n), \
.virtual_key_position = ZMK_KEYMAP_LEN + __COUNTER__, \
.slow_release = DT_PROP(n, slow_release), \
.layers = DT_PROP(n, layers), \
.layers_len = DT_PROP_LEN(n, layers), \
};
#define INITIALIZE_COMBO(n) initialize_combo(&combo_config_##n);

View file

@ -51,6 +51,24 @@ int zmk_hid_unregister_mod(zmk_mod_t modifier) {
return 0;
}
int zmk_hid_register_mods(zmk_mod_flags_t modifiers) {
for (zmk_mod_t i = 0; i < 8; i++) {
if (modifiers & (1 << i)) {
zmk_hid_register_mod(i);
}
}
return 0;
}
int zmk_hid_unregister_mods(zmk_mod_flags_t modifiers) {
for (zmk_mod_t i = 0; i < 8; i++) {
if (modifiers & (1 << i)) {
zmk_hid_unregister_mod(i);
}
}
return 0;
}
#define TOGGLE_KEYBOARD(match, val) \
for (int idx = 0; idx < ZMK_HID_KEYBOARD_NKRO_SIZE; idx++) { \
if (keyboard_report.body.keys[idx] != match) { \

View file

@ -16,67 +16,67 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <dt-bindings/zmk/hid_usage_pages.h>
#include <zmk/endpoints.h>
static int hid_listener_keycode_pressed(uint16_t usage_page, uint32_t keycode,
zmk_mod_flags_t implicit_modifiers) {
static int hid_listener_keycode_pressed(const struct zmk_keycode_state_changed *ev) {
int err;
LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode,
implicit_modifiers);
switch (usage_page) {
LOG_DBG("usage_page 0x%02X keycode 0x%02X implicit_mods 0x%02X explicit_mods 0x%02X",
ev->usage_page, ev->keycode, ev->implicit_modifiers, ev->explicit_modifiers);
switch (ev->usage_page) {
case HID_USAGE_KEY:
err = zmk_hid_keyboard_press(keycode);
err = zmk_hid_keyboard_press(ev->keycode);
if (err) {
LOG_ERR("Unable to press keycode");
return err;
}
break;
case HID_USAGE_CONSUMER:
err = zmk_hid_consumer_press(keycode);
err = zmk_hid_consumer_press(ev->keycode);
if (err) {
LOG_ERR("Unable to press keycode");
return err;
}
break;
}
zmk_hid_implicit_modifiers_press(implicit_modifiers);
return zmk_endpoints_send_report(usage_page);
zmk_hid_register_mods(ev->explicit_modifiers);
zmk_hid_implicit_modifiers_press(ev->implicit_modifiers);
return zmk_endpoints_send_report(ev->usage_page);
}
static int hid_listener_keycode_released(uint16_t usage_page, uint32_t keycode,
zmk_mod_flags_t implicit_modifiers) {
static int hid_listener_keycode_released(const struct zmk_keycode_state_changed *ev) {
int err;
LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode,
implicit_modifiers);
switch (usage_page) {
LOG_DBG("usage_page 0x%02X keycode 0x%02X implicit_mods 0x%02X explicit_mods 0x%02X",
ev->usage_page, ev->keycode, ev->implicit_modifiers, ev->explicit_modifiers);
switch (ev->usage_page) {
case HID_USAGE_KEY:
err = zmk_hid_keyboard_release(keycode);
err = zmk_hid_keyboard_release(ev->keycode);
if (err) {
LOG_ERR("Unable to release keycode");
return err;
}
break;
case HID_USAGE_CONSUMER:
err = zmk_hid_consumer_release(keycode);
err = zmk_hid_consumer_release(ev->keycode);
if (err) {
LOG_ERR("Unable to release keycode");
return err;
}
}
zmk_hid_unregister_mods(ev->explicit_modifiers);
// There is a minor issue with this code.
// If LC(A) is pressed, then LS(B), then LC(A) is released, the shift for B will be released
// prematurely. This causes if LS(B) to repeat like Bbbbbbbb when pressed for a long time.
// Solving this would require keeping track of which key's implicit modifiers are currently
// active and only releasing modifiers at that time.
zmk_hid_implicit_modifiers_release();
return zmk_endpoints_send_report(usage_page);
return zmk_endpoints_send_report(ev->usage_page);
}
int hid_listener(const zmk_event_t *eh) {
const struct zmk_keycode_state_changed *ev = as_zmk_keycode_state_changed(eh);
if (ev) {
if (ev->state) {
hid_listener_keycode_pressed(ev->usage_page, ev->keycode, ev->implicit_modifiers);
hid_listener_keycode_pressed(ev);
} else {
hid_listener_keycode_released(ev->usage_page, ev->keycode, ev->implicit_modifiers);
hid_listener_keycode_released(ev);
}
}
return 0;

View file

@ -28,18 +28,10 @@ static uint8_t _zmk_keymap_layer_default = 0;
#define ZMK_KEYMAP_NODE DT_DRV_INST(0)
#define ZMK_KEYMAP_LAYERS_LEN (DT_INST_FOREACH_CHILD(0, LAYER_CHILD_LEN) 0)
#define LAYER_NODE(l) DT_PHANDLE_BY_IDX(ZMK_KEYMAP_NODE, layers, l)
#define BINDING_WITH_COMMA(idx, drv_inst) ZMK_KEYMAP_EXTRACT_BINDING(idx, drv_inst),
#define _TRANSFORM_ENTRY(idx, layer) \
{ \
.behavior_dev = DT_LABEL(DT_PHANDLE_BY_IDX(layer, bindings, idx)), \
.param1 = COND_CODE_0(DT_PHA_HAS_CELL_AT_IDX(layer, bindings, idx, param1), (0), \
(DT_PHA_BY_IDX(layer, bindings, idx, param1))), \
.param2 = COND_CODE_0(DT_PHA_HAS_CELL_AT_IDX(layer, bindings, idx, param2), (0), \
(DT_PHA_BY_IDX(layer, bindings, idx, param2))), \
},
#define TRANSFORMED_LAYER(node) {UTIL_LISTIFY(DT_PROP_LEN(node, bindings), _TRANSFORM_ENTRY, node)},
#define TRANSFORMED_LAYER(node) \
{UTIL_LISTIFY(DT_PROP_LEN(node, bindings), BINDING_WITH_COMMA, node)},
#if ZMK_KEYMAP_HAS_SENSORS
#define _TRANSFORM_SENSOR_ENTRY(idx, layer) \

View file

@ -1,4 +1,4 @@
pressed: usage_page 0x07 keycode 0xe0 mods 0x00
pressed: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0xe0 mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,4 +1,4 @@
pressed: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0x06 mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0x06 mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,2 +1,2 @@
pressed: usage_page 0x07 keycode 0xe0 mods 0x00
pressed: usage_page 0x07 keycode 0xe4 mods 0x00
pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0xe4 implicit_mods 0x00 explicit_mods 0x00

View file

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

View file

@ -0,0 +1,8 @@
pressed: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00

View file

@ -0,0 +1,78 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
/* it is useful to set timeout to a large value when attaching a debugger. */
#define TIMEOUT (60*60*1000)
/ {
combos {
compatible = "zmk,combos";
combo_one {
timeout-ms = <TIMEOUT>;
key-positions = <0 1>;
bindings = <&kp X>;
layers = <0>;
};
combo_two {
timeout-ms = <TIMEOUT>;
key-positions = <0 1>;
bindings = <&kp Y>;
layers = <1>;
};
combo_three {
timeout-ms = <TIMEOUT>;
key-positions = <0 2>;
bindings = <&kp Z>;
};
};
keymap {
compatible = "zmk,keymap";
label ="Default keymap";
default_layer {
bindings = <
&kp A &kp B
&kp C &tog 1
>;
};
filtered_layer {
bindings = <
&kp A &kp B
&kp C &tog 0
>;
};
};
};
&kscan {
events = <
/* Combo One */
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_PRESS(0,1,10)
ZMK_MOCK_RELEASE(0,0,10)
ZMK_MOCK_RELEASE(0,1,10)
/* Combo Three */
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_PRESS(1,1,10)
ZMK_MOCK_RELEASE(0,0,10)
ZMK_MOCK_RELEASE(1,1,10)
/* Toggle Layer */
ZMK_MOCK_PRESS(1,1,10)
ZMK_MOCK_RELEASE(1,1,10)
/* Combo Two */
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_PRESS(0,1,10)
ZMK_MOCK_RELEASE(0,0,10)
ZMK_MOCK_RELEASE(0,1,10)
/* Combo Three */
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_PRESS(1,1,10)
ZMK_MOCK_RELEASE(0,0,10)
ZMK_MOCK_RELEASE(1,1,10)
>;
};

View file

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

View file

@ -0,0 +1,4 @@
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00

View file

@ -0,0 +1,40 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>
/* it is useful to set timeout to a large value when attaching a debugger. */
#define TIMEOUT (60*60*1000)
/ {
combos {
compatible = "zmk,combos";
combo_one {
timeout-ms = <TIMEOUT>;
key-positions = <0 1>;
bindings = <&kp X>;
layers = <1>;
};
};
keymap {
compatible = "zmk,keymap";
label ="Default keymap";
default_layer {
bindings = <
&kp A &kp B
&kp C &tog 1
>;
};
};
};
&kscan {
events = <
/* Combo One */
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_PRESS(0,1,10)
ZMK_MOCK_RELEASE(0,0,10)
ZMK_MOCK_RELEASE(0,1,10)
>;
};

View file

@ -1,4 +1,4 @@
pressed: usage_page 0x07 keycode 0x04 mods 0x00
pressed: usage_page 0x07 keycode 0x05 mods 0x00
released: usage_page 0x07 keycode 0x04 mods 0x00
released: usage_page 0x07 keycode 0x05 mods 0x00
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,20 +1,20 @@
pressed: usage_page 0x07 keycode 0x1b mods 0x00
released: usage_page 0x07 keycode 0x1b mods 0x00
pressed: usage_page 0x07 keycode 0x1b mods 0x00
released: usage_page 0x07 keycode 0x1b mods 0x00
pressed: usage_page 0x07 keycode 0x1b mods 0x00
released: usage_page 0x07 keycode 0x1b mods 0x00
pressed: usage_page 0x07 keycode 0x1b mods 0x00
released: usage_page 0x07 keycode 0x1b mods 0x00
pressed: usage_page 0x07 keycode 0x1b mods 0x00
released: usage_page 0x07 keycode 0x1b mods 0x00
pressed: usage_page 0x07 keycode 0x1b mods 0x00
released: usage_page 0x07 keycode 0x1b mods 0x00
pressed: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,8 +1,8 @@
pressed: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,4 +1,4 @@
pressed: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0x06 mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0x06 mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,4 +1,4 @@
pressed: usage_page 0x07 keycode 0x04 mods 0x00
pressed: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0x04 mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,16 +1,16 @@
pressed: usage_page 0x07 keycode 0x1b mods 0x00
released: usage_page 0x07 keycode 0x1b mods 0x00
pressed: usage_page 0x07 keycode 0x1b mods 0x00
released: usage_page 0x07 keycode 0x1b mods 0x00
pressed: usage_page 0x07 keycode 0x1b mods 0x00
released: usage_page 0x07 keycode 0x1b mods 0x00
pressed: usage_page 0x07 keycode 0x1b mods 0x00
released: usage_page 0x07 keycode 0x1b mods 0x00
pressed: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0x1c mods 0x00
released: usage_page 0x07 keycode 0x1c mods 0x00
pressed: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1b implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,8 +1,8 @@
pressed: usage_page 0x07 keycode 0x06 mods 0x00
released: usage_page 0x07 keycode 0x06 mods 0x00
pressed: usage_page 0x07 keycode 0x06 mods 0x00
released: usage_page 0x07 keycode 0x06 mods 0x00
pressed: usage_page 0x07 keycode 0x06 mods 0x00
released: usage_page 0x07 keycode 0x06 mods 0x00
pressed: usage_page 0x07 keycode 0x06 mods 0x00
released: usage_page 0x07 keycode 0x06 mods 0x00
pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,4 +1,4 @@
pressed: usage_page 0x07 keycode 0x04 mods 0x00
pressed: usage_page 0x07 keycode 0x05 mods 0x00
released: usage_page 0x07 keycode 0x04 mods 0x00
released: usage_page 0x07 keycode 0x05 mods 0x00
pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,4 +1,4 @@
pressed: usage_page 0x07 keycode 0x06 mods 0x00
pressed: usage_page 0x07 keycode 0x07 mods 0x00
released: usage_page 0x07 keycode 0x06 mods 0x00
released: usage_page 0x07 keycode 0x07 mods 0x00
pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,4 +1,4 @@
pressed: usage_page 0x07 keycode 0x06 mods 0x00
pressed: usage_page 0x07 keycode 0x07 mods 0x00
released: usage_page 0x07 keycode 0x07 mods 0x00
released: usage_page 0x07 keycode 0x06 mods 0x00
pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,4 +1,4 @@
pressed: usage_page 0x07 keycode 0x06 mods 0x00
released: usage_page 0x07 keycode 0x06 mods 0x00
pressed: usage_page 0x07 keycode 0x07 mods 0x00
released: usage_page 0x07 keycode 0x07 mods 0x00
pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,4 +1,4 @@
pressed: usage_page 0x07 keycode 0x06 mods 0x00
released: usage_page 0x07 keycode 0x06 mods 0x00
pressed: usage_page 0x07 keycode 0x07 mods 0x00
released: usage_page 0x07 keycode 0x07 mods 0x00
pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,4 +1,4 @@
pressed: usage_page 0x07 keycode 0x06 mods 0x00
pressed: usage_page 0x07 keycode 0x07 mods 0x00
released: usage_page 0x07 keycode 0x06 mods 0x00
released: usage_page 0x07 keycode 0x07 mods 0x00
pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,18 +1,18 @@
pressed: usage_page 0x07 keycode 0x29 mods 0x00
released: usage_page 0x07 keycode 0x29 mods 0x00
pressed: usage_page 0x07 keycode 0xe1 mods 0x00
pressed: usage_page 0x07 keycode 0x35 mods 0x00
released: usage_page 0x07 keycode 0x35 mods 0x00
released: usage_page 0x07 keycode 0xe1 mods 0x00
pressed: usage_page 0x07 keycode 0xe3 mods 0x00
pressed: usage_page 0x07 keycode 0x35 mods 0x00
released: usage_page 0x07 keycode 0x35 mods 0x00
released: usage_page 0x07 keycode 0xe3 mods 0x00
pressed: usage_page 0x07 keycode 0xe1 mods 0x00
pressed: usage_page 0x07 keycode 0x35 mods 0x00
released: usage_page 0x07 keycode 0xe1 mods 0x00
released: usage_page 0x07 keycode 0x35 mods 0x00
pressed: usage_page 0x07 keycode 0xe3 mods 0x00
pressed: usage_page 0x07 keycode 0x35 mods 0x00
released: usage_page 0x07 keycode 0xe3 mods 0x00
released: usage_page 0x07 keycode 0x35 mods 0x00
pressed: usage_page 0x07 keycode 0x29 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x29 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x35 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x35 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0xe3 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x35 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x35 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0xe3 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x35 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x35 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0xe3 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x35 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0xe3 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x35 implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,6 +1,6 @@
pressed: usage_page 0x07 keycode 0x29 mods 0x00
released: usage_page 0x07 keycode 0x29 mods 0x00
pressed: usage_page 0x07 keycode 0xe1 mods 0x00
pressed: usage_page 0x07 keycode 0x35 mods 0x00
released: usage_page 0x07 keycode 0xe1 mods 0x00
released: usage_page 0x07 keycode 0x35 mods 0x00
pressed: usage_page 0x07 keycode 0x29 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x29 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
pressed: usage_page 0x07 keycode 0x35 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
released: usage_page 0x07 keycode 0x35 implicit_mods 0x00 explicit_mods 0x00

View file

@ -1,5 +1,5 @@
ht_binding_pressed: 0 new undecided hold_tap
ht_decide: 0 decided tap (balanced event 0)
kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00
kp_released: usage_page 0x07 keycode 0x09 mods 0x00
kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 0 cleaning up hold-tap

View file

@ -1,5 +1,5 @@
ht_binding_pressed: 0 new undecided hold_tap
ht_decide: 0 decided hold (balanced event 3)
kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 mods 0x00
kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 0 cleaning up hold-tap

View file

@ -1,7 +1,7 @@
kp_pressed: usage_page 0x07 keycode 0xe4 mods 0x00
kp_pressed: usage_page 0x07 keycode 0xe4 implicit_mods 0x00 explicit_mods 0x00
ht_binding_pressed: 0 new undecided hold_tap
ht_decide: 0 decided tap (balanced event 0)
kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00
kp_released: usage_page 0x07 keycode 0xe4 mods 0x00
kp_released: usage_page 0x07 keycode 0x09 mods 0x00
kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0xe4 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 0 cleaning up hold-tap

View file

@ -1,7 +1,7 @@
kp_pressed: usage_page 0x07 keycode 0xe4 mods 0x00
kp_pressed: usage_page 0x07 keycode 0xe4 implicit_mods 0x00 explicit_mods 0x00
ht_binding_pressed: 0 new undecided hold_tap
ht_decide: 0 decided hold (balanced event 3)
kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00
kp_released: usage_page 0x07 keycode 0xe4 mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 mods 0x00
kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0xe4 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 0 cleaning up hold-tap

View file

@ -1,7 +1,7 @@
kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00
kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
ht_binding_pressed: 0 new undecided hold_tap
kp_released: usage_page 0x07 keycode 0x07 mods 0x00
kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
ht_decide: 0 decided tap (balanced event 0)
kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00
kp_released: usage_page 0x07 keycode 0x09 mods 0x00
kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 0 cleaning up hold-tap

View file

@ -1,7 +1,7 @@
kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00
kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
ht_binding_pressed: 0 new undecided hold_tap
kp_released: usage_page 0x07 keycode 0x07 mods 0x00
kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
ht_decide: 0 decided hold (balanced event 3)
kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 mods 0x00
kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 0 cleaning up hold-tap

View file

@ -1,10 +1,10 @@
ht_binding_pressed: 0 new undecided hold_tap
ht_decide: 0 decided hold (balanced event 3)
kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00
kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
ht_binding_pressed: 1 new undecided hold_tap
ht_decide: 1 decided tap (balanced event 0)
kp_pressed: usage_page 0x07 keycode 0x0d mods 0x00
kp_released: usage_page 0x07 keycode 0x0d mods 0x00
kp_pressed: usage_page 0x07 keycode 0x0d implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0x0d implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 1 cleaning up hold-tap
kp_released: usage_page 0x07 keycode 0xe1 mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 0 cleaning up hold-tap

View file

@ -1,7 +1,7 @@
ht_binding_pressed: 0 new undecided hold_tap
ht_decide: 0 decided hold (balanced event 3)
kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00
kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00
kp_released: usage_page 0x07 keycode 0x07 mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 mods 0x00
kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 0 cleaning up hold-tap

View file

@ -1,7 +1,7 @@
ht_binding_pressed: 0 new undecided hold_tap
ht_decide: 0 decided hold (balanced event 2)
kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00
kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00
kp_released: usage_page 0x07 keycode 0x07 mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 mods 0x00
kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 0 cleaning up hold-tap

View file

@ -1,7 +1,7 @@
ht_binding_pressed: 0 new undecided hold_tap
ht_decide: 0 decided hold (balanced event 2)
kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00
kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00
kp_released: usage_page 0x07 keycode 0x07 mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 mods 0x00
kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 0 cleaning up hold-tap

View file

@ -1,7 +1,7 @@
ht_binding_pressed: 0 new undecided hold_tap
ht_decide: 0 decided tap (balanced event 0)
kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00
kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00
kp_released: usage_page 0x07 keycode 0x09 mods 0x00
kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00
kp_pressed: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 0 cleaning up hold-tap
kp_released: usage_page 0x07 keycode 0x07 mods 0x00
kp_released: usage_page 0x07 keycode 0x07 implicit_mods 0x00 explicit_mods 0x00

View file

@ -0,0 +1,4 @@
s/.*hid_listener_keycode/kp/p
s/.*mo_keymap_binding/mo/p
s/.*on_hold_tap_binding/ht_binding/p
s/.*decide_hold_tap/ht_decide/p

View file

@ -0,0 +1,10 @@
ht_binding_pressed: 0 new undecided hold_tap
ht_decide: 0 decided tap (balanced event 0)
kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 0 cleaning up hold-tap
ht_binding_pressed: 0 new undecided hold_tap
ht_decide: 0 decided tap (balanced event 4)
kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 0 cleaning up hold-tap

View file

@ -0,0 +1,14 @@
#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)
ZMK_MOCK_PRESS(0,0,400)
ZMK_MOCK_RELEASE(0,0,10)
>;
};

View file

@ -10,6 +10,7 @@
#binding-cells = <2>;
flavor = "balanced";
tapping_term_ms = <300>;
quick_tap_ms = <200>;
bindings = <&kp>, <&kp>;
};
};

View file

@ -1,20 +1,20 @@
ht_binding_pressed: 0 new undecided hold_tap
ht_decide: 0 decided hold (balanced event 3)
kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00
kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
ht_binding_pressed: 1 new undecided hold_tap
ht_decide: 1 decided hold (balanced event 3)
kp_pressed: usage_page 0x07 keycode 0xe0 mods 0x00
kp_pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00
ht_binding_pressed: 2 new undecided hold_tap
ht_binding_released: 0 cleaning up hold-tap
ht_decide: 2 decided hold (balanced event 3)
kp_pressed: usage_page 0x07 keycode 0xe3 mods 0x00
kp_pressed: usage_page 0x07 keycode 0xe3 implicit_mods 0x00 explicit_mods 0x00
ht_binding_pressed: 3 new undecided hold_tap
ht_binding_released: 1 cleaning up hold-tap
ht_decide: 3 decided hold (balanced event 3)
kp_pressed: usage_page 0x07 keycode 0xe2 mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 mods 0x00
kp_released: usage_page 0x07 keycode 0xe0 mods 0x00
kp_released: usage_page 0x07 keycode 0xe3 mods 0x00
kp_pressed: usage_page 0x07 keycode 0xe2 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0xe3 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 2 cleaning up hold-tap
kp_released: usage_page 0x07 keycode 0xe2 mods 0x00
kp_released: usage_page 0x07 keycode 0xe2 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 3 cleaning up hold-tap

View file

@ -1,5 +1,5 @@
ht_binding_pressed: 0 new undecided hold_tap
ht_decide: 0 decided tap (hold-preferred event 0)
kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00
kp_released: usage_page 0x07 keycode 0x09 mods 0x00
kp_pressed: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0x09 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 0 cleaning up hold-tap

View file

@ -1,5 +1,5 @@
ht_binding_pressed: 0 new undecided hold_tap
ht_decide: 0 decided hold (hold-preferred event 3)
kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 mods 0x00
kp_pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
kp_released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00
ht_binding_released: 0 cleaning up hold-tap

Some files were not shown because too many files have changed in this diff Show more