From 89567d3150207836b96030cc85f7267e0c203690 Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Sun, 13 Dec 2020 14:33:28 +0100 Subject: [PATCH 01/35] docs(sticky keys): document sticky keys and sticky layers --- docs/docs/behaviors/sticky-key.md | 51 +++++++++++++++++++++++++++++ docs/docs/behaviors/sticky-layer.md | 45 +++++++++++++++++++++++++ docs/sidebars.js | 2 ++ 3 files changed, 98 insertions(+) create mode 100644 docs/docs/behaviors/sticky-key.md create mode 100644 docs/docs/behaviors/sticky-layer.md diff --git a/docs/docs/behaviors/sticky-key.md b/docs/docs/behaviors/sticky-key.md new file mode 100644 index 00000000..d5627dcb --- /dev/null +++ b/docs/docs/behaviors/sticky-key.md @@ -0,0 +1,51 @@ +--- +title: Sticky Key Behavior +sidebar_label: Sticky Key +--- + +## Summary + +A sticky key stays pressed until another key is pressed. It is often used for 'sticky shift'. By using a sticky shift, you don't have to hold the shift key to write a capital. + +By default, sticky keys stay pressed for a second if you don't press any other key. You can configure this with the `release-after-ms` setting (see below). + +### Behavior Binding + +- Reference: `&sk` +- Parameter #1: The keycode , e.g. `LSHFT` + +Example: + +``` +&sk LSHFT +``` + +You can use any keycode that works for `&kp` as parameter to `&sk`: + +``` +&sk LG(LS(LA(LCTRL))) +``` + +### Configuration + +You can configure a different `release-after-ms` in your keymap: + +``` +&sk { + release-after-ms = <2000>; +}; + +/ { + keymap { + ... + } +} +``` + +### Advanced usage + +Sticky keys can be combined; if you tap `&sk LCTRL` and then `&sk LSHFT` and then `&kp A`, the output will be ctrl+shift+a. + +### Comparison to QMK + +In QMK, sticky keys are known as 'one shot mods'. diff --git a/docs/docs/behaviors/sticky-layer.md b/docs/docs/behaviors/sticky-layer.md new file mode 100644 index 00000000..597ed9f0 --- /dev/null +++ b/docs/docs/behaviors/sticky-layer.md @@ -0,0 +1,45 @@ +--- +title: Sticky Layer Behavior +sidebar_label: Sticky Layer +--- + +## Summary + +A sticky layer stays pressed until another key is pressed. By using a sticky layer, you don't have to hold the layer key to access a layer. Instead, tap the sticky layer key to activate the layer until the next keypress. + +By default, sticky layers stay pressed for a second if you don't press any other key. You can configure this with the `release-after-ms` setting (see below). + +### Behavior Binding + +- Reference: `&sl` +- Parameter #1: The layer to activate , e.g. `1` + +Example: + +``` +&sl 1 +``` + +### Configuration + +You can configure a different `release-after-ms` in your keymap: + +``` +&sl { + release-after-ms = <2000>; +}; + +/ { + keymap { + ... + } +} +``` + +### Advanced usage + +Sticky layers behave slightly different from sticky keys. They are configured to `quick-release`. This means that the layer is released immediately when another key is pressed. "Normal" sticky keys are not `quick-release`; they are released when the next key is released. This makes it possible to combine sticky layers and sticky keys as such: tap `&sl 1`, tap `&sk LSHFT` on layer 1, tap `&kp A` on base layer to output shift+A. + +### Comparison to QMK + +In QMK, sticky layers are known as 'one shot layers'. diff --git a/docs/sidebars.js b/docs/sidebars.js index 56de3eb8..f0465d4d 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -21,6 +21,8 @@ module.exports = { "behaviors/misc", "behaviors/hold-tap", "behaviors/mod-tap", + "behaviors/sticky-key", + "behaviors/sticky-layer", "behaviors/reset", "behaviors/bluetooth", "behaviors/outputs", From df4a5c8613365a8ee292dedaf345f76c196e4858 Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Tue, 8 Dec 2020 22:14:56 +0100 Subject: [PATCH 02/35] refactor(hid_listener): pass event struct instead of parameters --- app/src/hid_listener.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/app/src/hid_listener.c b/app/src/hid_listener.c index cd7acc0e..127eb52e 100644 --- a/app/src/hid_listener.c +++ b/app/src/hid_listener.c @@ -16,46 +16,44 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include -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 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 mods 0x%02X", ev->usage_page, ev->keycode, + ev->implicit_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_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 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 mods 0x%02X", ev->usage_page, ev->keycode, + ev->implicit_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; @@ -67,16 +65,16 @@ static int hid_listener_keycode_released(uint16_t usage_page, uint32_t keycode, // 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; From 0c30b49063c79be2416453f4544795922efad74f Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Fri, 22 Jan 2021 15:45:51 +0100 Subject: [PATCH 03/35] refactor(modifiers): define is_mods function --- app/include/zmk/keys.h | 7 ++++++- app/src/behaviors/behavior_hold_tap.c | 10 ++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/include/zmk/keys.h b/app/include/zmk/keys.h index 62e3cce8..38777ec8 100644 --- a/app/include/zmk/keys.h +++ b/app/include/zmk/keys.h @@ -18,4 +18,9 @@ struct zmk_key_event { uint32_t row; zmk_key_t key; bool pressed; -}; \ No newline at end of file +}; + +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); +} \ No newline at end of file diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index de356337..fcb4c5bd 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -8,8 +8,8 @@ #include #include +#include #include -#include #include #include #include @@ -17,7 +17,6 @@ #include #include #include -#include #include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); @@ -428,11 +427,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 +436,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; } From 7b7701ae90469b920cd78e2ab7aca0c470140b7a Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Fri, 22 Jan 2021 17:00:19 +0100 Subject: [PATCH 04/35] feature(modifiers): add explicit modifiers this makes LS(LEFT_CONTROL) work as if shift and control were both pressed explicitly. Previously, the left shift would have been released as soon as another key was pressed. The implicit behavior is useful in case of LS(NUMBER_1) when rolling over to other keys. Also see #361. --- .../zmk/events/keycode_state_changed.h | 15 +++++-- app/include/zmk/hid.h | 2 + app/src/hid.c | 18 +++++++++ app/src/hid_listener.c | 14 ++++--- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 4 +- .../multiple-timeouts/keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 40 +++++++++---------- .../keycode_events.snapshot | 16 ++++---- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 32 +++++++-------- .../press-release/keycode_events.snapshot | 16 ++++---- .../press-timeout/keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../balanced/1-dn-up/keycode_events.snapshot | 4 +- .../2-dn-timer-up/keycode_events.snapshot | 4 +- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../many-nested/keycode_events.snapshot | 16 ++++---- .../1-dn-up/keycode_events.snapshot | 4 +- .../2-dn-timer-up/keycode_events.snapshot | 4 +- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../1-dn-up/keycode_events.snapshot | 4 +- .../2-dn-timer-up/keycode_events.snapshot | 4 +- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../kp-press-release/keycode_events.snapshot | 4 +- .../events.patterns | 4 ++ .../keycode_events.snapshot | 28 +++++++++++++ .../native_posix.keymap | 28 +++++++++++++ .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 4 +- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../1-normal/keycode_events.snapshot | 4 +- .../keycode_events.snapshot | 4 +- .../4-nested/keycode_events.snapshot | 4 +- .../keycode_events.snapshot | 4 +- .../1-os-dn-up/keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 16 ++++---- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 8 ++-- .../keycode_events.snapshot | 12 +++--- .../keycode_events.snapshot | 16 ++++---- .../9-sk-dn-up-dn-up/keycode_events.snapshot | 8 ++-- .../to-layer/normal/keycode_events.snapshot | 12 +++--- .../early-key-release/keycode_events.snapshot | 8 ++-- .../normal/keycode_events.snapshot | 4 +- .../layered/keycode_events.snapshot | 4 +- 83 files changed, 425 insertions(+), 336 deletions(-) create mode 100644 app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/events.patterns create mode 100644 app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/keycode_events.snapshot create mode 100644 app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/native_posix.keymap diff --git a/app/include/zmk/events/keycode_state_changed.h b/app/include/zmk/events/keycode_state_changed.h index 031169d0..466bbd76 100644 --- a/app/include/zmk/events/keycode_state_changed.h +++ b/app/include/zmk/events/keycode_state_changed.h @@ -7,8 +7,6 @@ #pragma once #include -#include -#include #include #include @@ -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}); } diff --git a/app/include/zmk/hid.h b/app/include/zmk/hid.h index aca3cc46..5aa004c2 100644 --- a/app/include/zmk/hid.h +++ b/app/include/zmk/hid.h @@ -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); diff --git a/app/src/hid.c b/app/src/hid.c index 65eabd9c..7ab080e5 100644 --- a/app/src/hid.c +++ b/app/src/hid.c @@ -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) { \ diff --git a/app/src/hid_listener.c b/app/src/hid_listener.c index 127eb52e..d582c169 100644 --- a/app/src/hid_listener.c +++ b/app/src/hid_listener.c @@ -16,10 +16,10 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include -static int hid_listener_keycode_pressed(const struct keycode_state_changed *ev) { +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", ev->usage_page, ev->keycode, - ev->implicit_modifiers); + 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(ev->keycode); @@ -36,14 +36,15 @@ static int hid_listener_keycode_pressed(const struct keycode_state_changed *ev) } break; } + 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(const struct keycode_state_changed *ev) { +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", ev->usage_page, ev->keycode, - ev->implicit_modifiers); + 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(ev->keycode); @@ -59,6 +60,7 @@ static int hid_listener_keycode_released(const struct keycode_state_changed *ev) 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. diff --git a/app/tests/combo/combos-and-holdtaps-0/keycode_events.snapshot b/app/tests/combo/combos-and-holdtaps-0/keycode_events.snapshot index ad86b269..e1c02dae 100644 --- a/app/tests/combo/combos-and-holdtaps-0/keycode_events.snapshot +++ b/app/tests/combo/combos-and-holdtaps-0/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/combos-and-holdtaps-1/keycode_events.snapshot b/app/tests/combo/combos-and-holdtaps-1/keycode_events.snapshot index dc4dbb49..ff060370 100644 --- a/app/tests/combo/combos-and-holdtaps-1/keycode_events.snapshot +++ b/app/tests/combo/combos-and-holdtaps-1/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/combos-and-holdtaps-2/keycode_events.snapshot b/app/tests/combo/combos-and-holdtaps-2/keycode_events.snapshot index a6508804..325549fb 100644 --- a/app/tests/combo/combos-and-holdtaps-2/keycode_events.snapshot +++ b/app/tests/combo/combos-and-holdtaps-2/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/multiple-timeouts/keycode_events.snapshot b/app/tests/combo/multiple-timeouts/keycode_events.snapshot index c5bdd6e0..bb47d852 100644 --- a/app/tests/combo/multiple-timeouts/keycode_events.snapshot +++ b/app/tests/combo/multiple-timeouts/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/overlapping-combos-0/keycode_events.snapshot b/app/tests/combo/overlapping-combos-0/keycode_events.snapshot index ec63b77f..cc5b30f8 100644 --- a/app/tests/combo/overlapping-combos-0/keycode_events.snapshot +++ b/app/tests/combo/overlapping-combos-0/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/overlapping-combos-1/keycode_events.snapshot b/app/tests/combo/overlapping-combos-1/keycode_events.snapshot index daf72478..a80db25c 100644 --- a/app/tests/combo/overlapping-combos-1/keycode_events.snapshot +++ b/app/tests/combo/overlapping-combos-1/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/overlapping-combos-2/keycode_events.snapshot b/app/tests/combo/overlapping-combos-2/keycode_events.snapshot index dc4dbb49..ff060370 100644 --- a/app/tests/combo/overlapping-combos-2/keycode_events.snapshot +++ b/app/tests/combo/overlapping-combos-2/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/overlapping-combos-3/keycode_events.snapshot b/app/tests/combo/overlapping-combos-3/keycode_events.snapshot index e0cb655e..3df81e52 100644 --- a/app/tests/combo/overlapping-combos-3/keycode_events.snapshot +++ b/app/tests/combo/overlapping-combos-3/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/partially-overlapping-combos/keycode_events.snapshot b/app/tests/combo/partially-overlapping-combos/keycode_events.snapshot index adaa64bc..e6c88146 100644 --- a/app/tests/combo/partially-overlapping-combos/keycode_events.snapshot +++ b/app/tests/combo/partially-overlapping-combos/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/press-release/keycode_events.snapshot b/app/tests/combo/press-release/keycode_events.snapshot index 01718e71..d0767ca4 100644 --- a/app/tests/combo/press-release/keycode_events.snapshot +++ b/app/tests/combo/press-release/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/press-timeout/keycode_events.snapshot b/app/tests/combo/press-timeout/keycode_events.snapshot index c5bdd6e0..bb47d852 100644 --- a/app/tests/combo/press-timeout/keycode_events.snapshot +++ b/app/tests/combo/press-timeout/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/press1-press2-release1-release2/keycode_events.snapshot b/app/tests/combo/press1-press2-release1-release2/keycode_events.snapshot index cfa02de2..0539a7ca 100644 --- a/app/tests/combo/press1-press2-release1-release2/keycode_events.snapshot +++ b/app/tests/combo/press1-press2-release1-release2/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/press1-press2-release2-release1/keycode_events.snapshot b/app/tests/combo/press1-press2-release2-release1/keycode_events.snapshot index b55f09ba..c473ece0 100644 --- a/app/tests/combo/press1-press2-release2-release1/keycode_events.snapshot +++ b/app/tests/combo/press1-press2-release2-release1/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/press1-release1-press2-release2/keycode_events.snapshot b/app/tests/combo/press1-release1-press2-release2/keycode_events.snapshot index c41dee8c..3c8dc138 100644 --- a/app/tests/combo/press1-release1-press2-release2/keycode_events.snapshot +++ b/app/tests/combo/press1-release1-press2-release2/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/slowrelease-disabled/keycode_events.snapshot b/app/tests/combo/slowrelease-disabled/keycode_events.snapshot index c41dee8c..3c8dc138 100644 --- a/app/tests/combo/slowrelease-disabled/keycode_events.snapshot +++ b/app/tests/combo/slowrelease-disabled/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/slowrelease-enabled/keycode_events.snapshot b/app/tests/combo/slowrelease-enabled/keycode_events.snapshot index cfa02de2..0539a7ca 100644 --- a/app/tests/combo/slowrelease-enabled/keycode_events.snapshot +++ b/app/tests/combo/slowrelease-enabled/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/balanced/1-dn-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/1-dn-up/keycode_events.snapshot index c088e5e6..41344422 100644 --- a/app/tests/hold-tap/balanced/1-dn-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/1-dn-up/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/balanced/2-dn-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/2-dn-timer-up/keycode_events.snapshot index a8b5d1fe..f83b4086 100644 --- a/app/tests/hold-tap/balanced/2-dn-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/2-dn-timer-up/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/balanced/3a-moddn-dn-modup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/3a-moddn-dn-modup-up/keycode_events.snapshot index ca458c7b..ca744aac 100644 --- a/app/tests/hold-tap/balanced/3a-moddn-dn-modup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/3a-moddn-dn-modup-up/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/balanced/3b-moddn-dn-modup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/3b-moddn-dn-modup-timer-up/keycode_events.snapshot index ef4dfa5f..c2bddc26 100644 --- a/app/tests/hold-tap/balanced/3b-moddn-dn-modup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/3b-moddn-dn-modup-timer-up/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/balanced/3c-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/3c-kcdn-dn-kcup-up/keycode_events.snapshot index 70a3353d..6bef3460 100644 --- a/app/tests/hold-tap/balanced/3c-kcdn-dn-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/3c-kcdn-dn-kcup-up/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/balanced/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot index 121f0071..5354ff74 100644 --- a/app/tests/hold-tap/balanced/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/balanced/4a-dn-htdn-timer-htup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/4a-dn-htdn-timer-htup-up/keycode_events.snapshot index ae9dcc96..10380651 100644 --- a/app/tests/hold-tap/balanced/4a-dn-htdn-timer-htup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/4a-dn-htdn-timer-htup-up/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/balanced/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot index c1e03ad2..9d5a9e83 100644 --- a/app/tests/hold-tap/balanced/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/balanced/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot index 95330e69..190d95e0 100644 --- a/app/tests/hold-tap/balanced/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/balanced/4c-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/4c-dn-kcdn-kcup-up/keycode_events.snapshot index 95330e69..190d95e0 100644 --- a/app/tests/hold-tap/balanced/4c-dn-kcdn-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/4c-dn-kcdn-kcup-up/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/balanced/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot b/app/tests/hold-tap/balanced/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot index 63219ee0..31089abf 100644 --- a/app/tests/hold-tap/balanced/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/balanced/many-nested/keycode_events.snapshot b/app/tests/hold-tap/balanced/many-nested/keycode_events.snapshot index dda02ddf..4bd40a91 100644 --- a/app/tests/hold-tap/balanced/many-nested/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/many-nested/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/hold-preferred/1-dn-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/1-dn-up/keycode_events.snapshot index 2eb64758..12c1a548 100644 --- a/app/tests/hold-tap/hold-preferred/1-dn-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/1-dn-up/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/hold-preferred/2-dn-timer-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/2-dn-timer-up/keycode_events.snapshot index 86517aa3..291d17b1 100644 --- a/app/tests/hold-tap/hold-preferred/2-dn-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/2-dn-timer-up/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/hold-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot index b7434c65..2f8b72e7 100644 --- a/app/tests/hold-tap/hold-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot @@ -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 (hold-preferred 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 diff --git a/app/tests/hold-tap/hold-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot index ffb6aadd..73308626 100644 --- a/app/tests/hold-tap/hold-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot @@ -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 (hold-preferred 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 diff --git a/app/tests/hold-tap/hold-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot index 1254fedd..45964250 100644 --- a/app/tests/hold-tap/hold-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot @@ -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 (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 diff --git a/app/tests/hold-tap/hold-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot index ba7b48b3..5d6d637e 100644 --- a/app/tests/hold-tap/hold-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot @@ -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 (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 diff --git a/app/tests/hold-tap/hold-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot index c8acfc17..92886a8c 100644 --- a/app/tests/hold-tap/hold-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot @@ -1,10 +1,10 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (hold-preferred event 1) -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 (hold-preferred 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 diff --git a/app/tests/hold-tap/hold-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot index 97cd07bf..e2feeefc 100644 --- a/app/tests/hold-tap/hold-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (hold-preferred event 1) -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 diff --git a/app/tests/hold-tap/hold-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot index 97cd07bf..e2feeefc 100644 --- a/app/tests/hold-tap/hold-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (hold-preferred event 1) -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 diff --git a/app/tests/hold-tap/hold-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot index 97cd07bf..e2feeefc 100644 --- a/app/tests/hold-tap/hold-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (hold-preferred event 1) -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 diff --git a/app/tests/hold-tap/hold-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot index 2a21d929..da5b8265 100644 --- a/app/tests/hold-tap/hold-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (hold-preferred event 1) -kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 -kp_pressed: 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 0xe1 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 diff --git a/app/tests/hold-tap/tap-preferred/1-dn-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/1-dn-up/keycode_events.snapshot index 57e4fcd7..93b5ce29 100644 --- a/app/tests/hold-tap/tap-preferred/1-dn-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/1-dn-up/keycode_events.snapshot @@ -1,5 +1,5 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided tap (tap-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 diff --git a/app/tests/hold-tap/tap-preferred/2-dn-timer-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/2-dn-timer-up/keycode_events.snapshot index 71ba8da4..3dccfd31 100644 --- a/app/tests/hold-tap/tap-preferred/2-dn-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/2-dn-timer-up/keycode_events.snapshot @@ -1,5 +1,5 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (tap-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 diff --git a/app/tests/hold-tap/tap-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot index 0bc731f0..09d2f10e 100644 --- a/app/tests/hold-tap/tap-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot @@ -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 (tap-preferred 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 diff --git a/app/tests/hold-tap/tap-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot index 6a3398f4..c89aecfa 100644 --- a/app/tests/hold-tap/tap-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot @@ -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 (tap-preferred 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 diff --git a/app/tests/hold-tap/tap-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot index e518582c..4211e851 100644 --- a/app/tests/hold-tap/tap-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot @@ -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 (tap-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 diff --git a/app/tests/hold-tap/tap-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot index b3b06730..c149544a 100644 --- a/app/tests/hold-tap/tap-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot @@ -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 (tap-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 diff --git a/app/tests/hold-tap/tap-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot index 7f454210..cf7db305 100644 --- a/app/tests/hold-tap/tap-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot @@ -1,10 +1,10 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (tap-preferred 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 (tap-preferred 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 diff --git a/app/tests/hold-tap/tap-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot index ade0d3ea..95573b9b 100644 --- a/app/tests/hold-tap/tap-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (tap-preferred 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 diff --git a/app/tests/hold-tap/tap-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot index ade0d3ea..95573b9b 100644 --- a/app/tests/hold-tap/tap-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (tap-preferred 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 diff --git a/app/tests/hold-tap/tap-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot index 418312c3..38cce941 100644 --- a/app/tests/hold-tap/tap-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided tap (tap-preferred 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 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 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 diff --git a/app/tests/hold-tap/tap-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot index c0b4c0b7..8749a46c 100644 --- a/app/tests/hold-tap/tap-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided tap (tap-preferred 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 diff --git a/app/tests/keypress/kp-press-release/keycode_events.snapshot b/app/tests/keypress/kp-press-release/keycode_events.snapshot index 80cac202..259501ba 100644 --- a/app/tests/keypress/kp-press-release/keycode_events.snapshot +++ b/app/tests/keypress/kp-press-release/keycode_events.snapshot @@ -1,2 +1,2 @@ -pressed: usage_page 0x07 keycode 0x05 mods 0x00 -released: usage_page 0x07 keycode 0x05 mods 0x00 +pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/events.patterns b/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/events.patterns new file mode 100644 index 00000000..cbf21aff --- /dev/null +++ b/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode_//p +s/.*hid_register_mod/reg/p +s/.*hid_unregister_mod/unreg/p +s/.*zmk_hid_.*Modifiers set to /mods: Modifiers set to /p \ No newline at end of file diff --git a/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/keycode_events.snapshot b/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/keycode_events.snapshot new file mode 100644 index 00000000..e146b9ca --- /dev/null +++ b/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/keycode_events.snapshot @@ -0,0 +1,28 @@ +pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x0e +reg: Modifier 0 count 1 +reg: Modifiers set to 0x01 +reg: Modifier 1 count 1 +reg: Modifiers set to 0x03 +reg: Modifier 2 count 1 +reg: Modifiers set to 0x07 +reg: Modifier 3 count 1 +reg: Modifiers set to 0x0f +mods: Modifiers set to 0x0f +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +mods: Modifiers set to 0x0f +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +mods: Modifiers set to 0x0f +released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x0e +unreg: Modifier 0 count: 0 +unreg: Modifier 0 released +unreg: Modifiers set to 0x0e +unreg: Modifier 1 count: 0 +unreg: Modifier 1 released +unreg: Modifiers set to 0x0c +unreg: Modifier 2 count: 0 +unreg: Modifier 2 released +unreg: Modifiers set to 0x08 +unreg: Modifier 3 count: 0 +unreg: Modifier 3 released +unreg: Modifiers set to 0x00 +mods: Modifiers set to 0x00 diff --git a/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/native_posix.keymap b/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/native_posix.keymap new file mode 100644 index 00000000..b8142425 --- /dev/null +++ b/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/native_posix.keymap @@ -0,0 +1,28 @@ +#include +#include +#include + + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + + >; +}; + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &kp LS(LA(LG(LEFT_CONTROL))) &kp LEFT_CONTROL + &kp A &none + >; + }; + }; +}; diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/keycode_events.snapshot b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/keycode_events.snapshot index 6218e650..25b79445 100644 --- a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/keycode_events.snapshot +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/keycode_events.snapshot @@ -1,16 +1,16 @@ -pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 0 count 1 reg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 0 count 2 reg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -released: usage_page 0x07 keycode 0xe0 mods 0x00 +released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 0 count: 1 unreg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -released: usage_page 0x07 keycode 0xe0 mods 0x00 +released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 0 count: 0 unreg: Modifier 0 released unreg: Modifiers set to 0x00 diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/keycode_events.snapshot b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/keycode_events.snapshot index 42324284..545af6e7 100644 --- a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/keycode_events.snapshot +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/keycode_events.snapshot @@ -1,8 +1,8 @@ -pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 0 count 1 reg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -released: usage_page 0x07 keycode 0xe0 mods 0x00 +released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 0 count: 0 unreg: Modifier 0 released unreg: Modifiers set to 0x00 diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/keycode_events.snapshot b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/keycode_events.snapshot index 60d829a6..b7445420 100644 --- a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/keycode_events.snapshot +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/keycode_events.snapshot @@ -1,17 +1,17 @@ -pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 0 count 1 reg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 1 count 1 reg: Modifiers set to 0x03 mods: Modifiers set to 0x03 -released: usage_page 0x07 keycode 0xe0 mods 0x00 +released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 0 count: 0 unreg: Modifier 0 released unreg: Modifiers set to 0x02 mods: Modifiers set to 0x02 -released: usage_page 0x07 keycode 0xe1 mods 0x00 +released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 1 count: 0 unreg: Modifier 1 released unreg: Modifiers set to 0x00 diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/keycode_events.snapshot b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/keycode_events.snapshot index b4755e5b..74916a8c 100644 --- a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/keycode_events.snapshot +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/keycode_events.snapshot @@ -1,17 +1,17 @@ -pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 0 count 1 reg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 1 count 1 reg: Modifiers set to 0x03 mods: Modifiers set to 0x03 -released: usage_page 0x07 keycode 0xe1 mods 0x00 +released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 1 count: 0 unreg: Modifier 1 released unreg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -released: usage_page 0x07 keycode 0xe0 mods 0x00 +released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 0 count: 0 unreg: Modifier 0 released unreg: Modifiers set to 0x00 diff --git a/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/keycode_events.snapshot b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/keycode_events.snapshot index 61dd271b..6dad3dea 100644 --- a/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/keycode_events.snapshot +++ b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/keycode_events.snapshot @@ -1,8 +1,8 @@ -pressed: usage_page 0x07 keycode 0x05 mods 0x02 +pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x02 explicit_mods 0x00 mods: Modifiers set to 0x02 -pressed: usage_page 0x07 keycode 0x04 mods 0x01 +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x01 explicit_mods 0x00 mods: Modifiers set to 0x01 -released: usage_page 0x07 keycode 0x05 mods 0x02 +released: usage_page 0x07 keycode 0x05 implicit_mods 0x02 explicit_mods 0x00 mods: Modifiers set to 0x01 -released: usage_page 0x07 keycode 0x04 mods 0x01 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x01 explicit_mods 0x00 mods: Modifiers set to 0x00 diff --git a/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/keycode_events.snapshot b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/keycode_events.snapshot index e8a231fe..723b03e5 100644 --- a/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/keycode_events.snapshot +++ b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/keycode_events.snapshot @@ -1,8 +1,8 @@ -pressed: usage_page 0x07 keycode 0x04 mods 0x01 +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x01 explicit_mods 0x00 mods: Modifiers set to 0x01 -pressed: usage_page 0x07 keycode 0x05 mods 0x02 +pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x02 explicit_mods 0x00 mods: Modifiers set to 0x02 -released: usage_page 0x07 keycode 0x05 mods 0x02 +released: usage_page 0x07 keycode 0x05 implicit_mods 0x02 explicit_mods 0x00 mods: Modifiers set to 0x00 -released: usage_page 0x07 keycode 0x04 mods 0x01 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x01 explicit_mods 0x00 mods: Modifiers set to 0x00 diff --git a/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/keycode_events.snapshot b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/keycode_events.snapshot index 40c5841e..aece8bed 100644 --- a/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/keycode_events.snapshot +++ b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/keycode_events.snapshot @@ -1,13 +1,13 @@ -pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 0 count 1 reg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -pressed: usage_page 0x07 keycode 0x05 mods 0x02 +pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x02 explicit_mods 0x00 mods: Modifiers set to 0x03 -released: usage_page 0x07 keycode 0xe0 mods 0x00 +released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 0 count: 0 unreg: Modifier 0 released unreg: Modifiers set to 0x00 mods: Modifiers set to 0x00 -released: usage_page 0x07 keycode 0x05 mods 0x02 +released: usage_page 0x07 keycode 0x05 implicit_mods 0x02 explicit_mods 0x00 mods: Modifiers set to 0x00 diff --git a/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/keycode_events.snapshot b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/keycode_events.snapshot index 5df571be..c24494fb 100644 --- a/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/keycode_events.snapshot +++ b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/keycode_events.snapshot @@ -1,12 +1,12 @@ -pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 0 count 1 reg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -pressed: usage_page 0x07 keycode 0x05 mods 0x02 +pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x02 explicit_mods 0x00 mods: Modifiers set to 0x03 -released: usage_page 0x07 keycode 0x05 mods 0x02 +released: usage_page 0x07 keycode 0x05 implicit_mods 0x02 explicit_mods 0x00 mods: Modifiers set to 0x01 -released: usage_page 0x07 keycode 0xe0 mods 0x00 +released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 0 count: 0 unreg: Modifier 0 released unreg: Modifiers set to 0x00 diff --git a/app/tests/momentary-layer/1-normal/keycode_events.snapshot b/app/tests/momentary-layer/1-normal/keycode_events.snapshot index 608ce093..0a00aa27 100644 --- a/app/tests/momentary-layer/1-normal/keycode_events.snapshot +++ b/app/tests/momentary-layer/1-normal/keycode_events.snapshot @@ -1,4 +1,4 @@ mo_pressed: position 1 layer 1 -kp_pressed: usage_page 0x07 keycode 0x06 mods 0x00 -kp_released: usage_page 0x07 keycode 0x06 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x06 implicit_mods 0x00 explicit_mods 0x00 mo_released: position 1 layer 1 diff --git a/app/tests/momentary-layer/2-early-key-release/keycode_events.snapshot b/app/tests/momentary-layer/2-early-key-release/keycode_events.snapshot index 82ebc67c..e24f11f9 100644 --- a/app/tests/momentary-layer/2-early-key-release/keycode_events.snapshot +++ b/app/tests/momentary-layer/2-early-key-release/keycode_events.snapshot @@ -1,4 +1,4 @@ -kp_pressed: usage_page 0x07 keycode 0x05 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00 mo_pressed: position 1 layer 1 -kp_released: usage_page 0x07 keycode 0x05 mods 0x00 +kp_released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00 mo_released: position 1 layer 1 diff --git a/app/tests/momentary-layer/4-nested/keycode_events.snapshot b/app/tests/momentary-layer/4-nested/keycode_events.snapshot index f03e4d5b..29b2e3fd 100644 --- a/app/tests/momentary-layer/4-nested/keycode_events.snapshot +++ b/app/tests/momentary-layer/4-nested/keycode_events.snapshot @@ -1,6 +1,6 @@ mo_pressed: position 1 layer 1 mo_pressed: position 0 layer 2 -kp_pressed: usage_page 0x07 keycode 0x05 mods 0x00 -kp_released: usage_page 0x07 keycode 0x05 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00 mo_released: position 0 layer 2 mo_released: position 1 layer 1 diff --git a/app/tests/momentary-layer/5-nested-early-key-release/keycode_events.snapshot b/app/tests/momentary-layer/5-nested-early-key-release/keycode_events.snapshot index 15be601e..d14d7881 100644 --- a/app/tests/momentary-layer/5-nested-early-key-release/keycode_events.snapshot +++ b/app/tests/momentary-layer/5-nested-early-key-release/keycode_events.snapshot @@ -1,6 +1,6 @@ mo_pressed: position 1 layer 1 mo_pressed: position 0 layer 2 -kp_pressed: usage_page 0x07 keycode 0x05 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00 mo_released: position 1 layer 1 mo_released: position 0 layer 2 -kp_released: usage_page 0x07 keycode 0x05 mods 0x00 +kp_released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/sticky-keys/1-os-dn-up/keycode_events.snapshot b/app/tests/sticky-keys/1-os-dn-up/keycode_events.snapshot index 5280f5c1..d2609894 100644 --- a/app/tests/sticky-keys/1-os-dn-up/keycode_events.snapshot +++ b/app/tests/sticky-keys/1-os-dn-up/keycode_events.snapshot @@ -1,4 +1,4 @@ -pressed: usage_page 0x07 keycode 0x08 mods 0x00 -released: usage_page 0x07 keycode 0x08 mods 0x00 -pressed: usage_page 0x07 keycode 0x04 mods 0x00 -released: usage_page 0x07 keycode 0x04 mods 0x00 +pressed: usage_page 0x07 keycode 0x08 implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0x08 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 diff --git a/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot index dba30cc2..addbca8c 100644 --- a/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot +++ b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot @@ -1,8 +1,8 @@ -pressed: usage_page 0x07 keycode 0x08 mods 0x00 -pressed: usage_page 0x07 keycode 0x04 mods 0x00 -released: usage_page 0x07 keycode 0x08 mods 0x00 -released: usage_page 0x07 keycode 0x04 mods 0x00 -pressed: usage_page 0x07 keycode 0x08 mods 0x00 -pressed: usage_page 0x07 keycode 0x04 mods 0x00 -released: usage_page 0x07 keycode 0x08 mods 0x00 -released: usage_page 0x07 keycode 0x04 mods 0x00 +pressed: usage_page 0x07 keycode 0x08 implicit_mods 0x00 explicit_mods 0x00 +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0x08 implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +pressed: usage_page 0x07 keycode 0x08 implicit_mods 0x00 explicit_mods 0x00 +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0x08 implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/keycode_events.snapshot index ee8aee01..1b091a6a 100644 --- a/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/keycode_events.snapshot +++ b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/keycode_events.snapshot @@ -1,4 +1,4 @@ -pressed: usage_page 0x07 keycode 0x08 mods 0x00 -pressed: usage_page 0x07 keycode 0x04 mods 0x00 -released: usage_page 0x07 keycode 0x04 mods 0x00 -released: usage_page 0x07 keycode 0x08 mods 0x00 +pressed: usage_page 0x07 keycode 0x08 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 +released: usage_page 0x07 keycode 0x08 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/keycode_events.snapshot b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/keycode_events.snapshot index 758ed616..6e004ec2 100644 --- a/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/keycode_events.snapshot +++ b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/keycode_events.snapshot @@ -1,4 +1,4 @@ -pressed: usage_page 0x07 keycode 0x08 mods 0x00 -pressed: usage_page 0x07 keycode 0x04 mods 0x00 -released: usage_page 0x07 keycode 0x08 mods 0x00 -released: usage_page 0x07 keycode 0x04 mods 0x00 +pressed: usage_page 0x07 keycode 0x08 implicit_mods 0x00 explicit_mods 0x00 +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0x08 implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/keycode_events.snapshot b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/keycode_events.snapshot index 758ed616..6e004ec2 100644 --- a/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/keycode_events.snapshot +++ b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/keycode_events.snapshot @@ -1,4 +1,4 @@ -pressed: usage_page 0x07 keycode 0x08 mods 0x00 -pressed: usage_page 0x07 keycode 0x04 mods 0x00 -released: usage_page 0x07 keycode 0x08 mods 0x00 -released: usage_page 0x07 keycode 0x04 mods 0x00 +pressed: usage_page 0x07 keycode 0x08 implicit_mods 0x00 explicit_mods 0x00 +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0x08 implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/keycode_events.snapshot index 99bac8de..03495b46 100644 --- a/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/keycode_events.snapshot +++ b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/keycode_events.snapshot @@ -1,4 +1,4 @@ -pressed: usage_page 0x07 keycode 0x04 mods 0x00 -pressed: usage_page 0x07 keycode 0x08 mods 0x00 -released: usage_page 0x07 keycode 0x04 mods 0x00 -released: usage_page 0x07 keycode 0x08 mods 0x00 +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +pressed: usage_page 0x07 keycode 0x08 implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0x08 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/keycode_events.snapshot b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/keycode_events.snapshot index a9de7e1b..3c757bbb 100644 --- a/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/keycode_events.snapshot +++ b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/keycode_events.snapshot @@ -1,6 +1,6 @@ -pressed: usage_page 0x07 keycode 0x08 mods 0x00 -pressed: usage_page 0x07 keycode 0x04 mods 0x00 -pressed: usage_page 0x07 keycode 0x05 mods 0x00 -released: usage_page 0x07 keycode 0x08 mods 0x00 -released: usage_page 0x07 keycode 0x04 mods 0x00 -released: usage_page 0x07 keycode 0x05 mods 0x00 +pressed: usage_page 0x07 keycode 0x08 implicit_mods 0x00 explicit_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 0x08 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 diff --git a/app/tests/sticky-keys/8-lsk-osk-combination/keycode_events.snapshot b/app/tests/sticky-keys/8-lsk-osk-combination/keycode_events.snapshot index 51660c34..8eb8a352 100644 --- a/app/tests/sticky-keys/8-lsk-osk-combination/keycode_events.snapshot +++ b/app/tests/sticky-keys/8-lsk-osk-combination/keycode_events.snapshot @@ -1,8 +1,8 @@ -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 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 +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 diff --git a/app/tests/sticky-keys/9-sk-dn-up-dn-up/keycode_events.snapshot b/app/tests/sticky-keys/9-sk-dn-up-dn-up/keycode_events.snapshot index bfe7f615..d5bd587e 100644 --- a/app/tests/sticky-keys/9-sk-dn-up-dn-up/keycode_events.snapshot +++ b/app/tests/sticky-keys/9-sk-dn-up-dn-up/keycode_events.snapshot @@ -1,4 +1,4 @@ -pressed: usage_page 0x07 keycode 0xe1 mods 0x00 -released: usage_page 0x07 keycode 0xe1 mods 0x00 -pressed: usage_page 0x07 keycode 0xe1 mods 0x00 -released: usage_page 0x07 keycode 0xe1 mods 0x00 +pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/to-layer/normal/keycode_events.snapshot b/app/tests/to-layer/normal/keycode_events.snapshot index 930a977a..5ac5eb68 100644 --- a/app/tests/to-layer/normal/keycode_events.snapshot +++ b/app/tests/to-layer/normal/keycode_events.snapshot @@ -1,16 +1,16 @@ -kp_pressed: usage_page 0x07 keycode 0x16 mods 0x00 -kp_released: usage_page 0x07 keycode 0x16 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x16 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x16 implicit_mods 0x00 explicit_mods 0x00 to_pressed: position 1 layer 1 layer_changed: layer 1 state 1 to_released: position 1 layer 1 -kp_pressed: usage_page 0x07 keycode 0x0e mods 0x00 -kp_released: usage_page 0x07 keycode 0x0e mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x0e implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x0e implicit_mods 0x00 explicit_mods 0x00 to_pressed: position 0 layer 0 layer_changed: layer 1 state 0 layer_changed: layer 0 state 1 to_released: position 0 layer 0 -kp_pressed: usage_page 0x07 keycode 0x16 mods 0x00 -kp_released: usage_page 0x07 keycode 0x16 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x16 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x16 implicit_mods 0x00 explicit_mods 0x00 to_pressed: position 0 layer 0 to_released: position 0 layer 0 to_pressed: position 1 layer 1 diff --git a/app/tests/toggle-layer/early-key-release/keycode_events.snapshot b/app/tests/toggle-layer/early-key-release/keycode_events.snapshot index 6b4d50bd..e0aa502f 100644 --- a/app/tests/toggle-layer/early-key-release/keycode_events.snapshot +++ b/app/tests/toggle-layer/early-key-release/keycode_events.snapshot @@ -1,6 +1,6 @@ -kp_pressed: usage_page 0x07 keycode 0x05 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00 tog_pressed: position 1 layer 1 -kp_released: usage_page 0x07 keycode 0x05 mods 0x00 +kp_released: usage_page 0x07 keycode 0x05 implicit_mods 0x00 explicit_mods 0x00 tog_released: position 1 layer 1 -kp_pressed: usage_page 0x0c keycode 0xb5 mods 0x00 -kp_released: usage_page 0x0c keycode 0xb5 mods 0x00 +kp_pressed: usage_page 0x0c keycode 0xb5 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x0c keycode 0xb5 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/toggle-layer/normal/keycode_events.snapshot b/app/tests/toggle-layer/normal/keycode_events.snapshot index d03295ef..8b5b0cc5 100644 --- a/app/tests/toggle-layer/normal/keycode_events.snapshot +++ b/app/tests/toggle-layer/normal/keycode_events.snapshot @@ -1,4 +1,4 @@ tog_pressed: position 1 layer 1 tog_released: position 1 layer 1 -kp_pressed: usage_page 0x0c keycode 0xb5 mods 0x00 -kp_released: usage_page 0x0c keycode 0xb5 mods 0x00 +kp_pressed: usage_page 0x0c keycode 0xb5 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x0c keycode 0xb5 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/transparent/layered/keycode_events.snapshot b/app/tests/transparent/layered/keycode_events.snapshot index 5e707b85..570e7d15 100644 --- a/app/tests/transparent/layered/keycode_events.snapshot +++ b/app/tests/transparent/layered/keycode_events.snapshot @@ -1,2 +1,2 @@ -kp_pressed: usage_page 0x07 keycode 0x04 mods 0x00 -kp_released: usage_page 0x07 keycode 0x04 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +kp_released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 From 7c24ab069c2cc3d2499fc70b96006b059a58d57a Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Mon, 25 Jan 2021 09:34:05 -0500 Subject: [PATCH 05/35] fix(behaviors): Updated grsec snapshots for new log format. --- .../keycode_events.snapshot | 36 +++++++++---------- .../keycode_events.snapshot | 12 +++---- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/app/tests/gresc/gresc-press-release/keycode_events.snapshot b/app/tests/gresc/gresc-press-release/keycode_events.snapshot index ebeba596..7c4c32ca 100644 --- a/app/tests/gresc/gresc-press-release/keycode_events.snapshot +++ b/app/tests/gresc/gresc-press-release/keycode_events.snapshot @@ -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 diff --git a/app/tests/gresc/gresc-two-instances/keycode_events.snapshot b/app/tests/gresc/gresc-two-instances/keycode_events.snapshot index 170e0cb1..4a640a45 100644 --- a/app/tests/gresc/gresc-two-instances/keycode_events.snapshot +++ b/app/tests/gresc/gresc-two-instances/keycode_events.snapshot @@ -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 From 1addfb97695a7600fc88c29b1d351ea0ec390650 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Sun, 24 Jan 2021 01:05:30 -0500 Subject: [PATCH 06/35] feat(blog): Add SOTF #4 --- docs/blog/2021-01-27-zmk-sotf-4.md | 194 +++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 docs/blog/2021-01-27-zmk-sotf-4.md diff --git a/docs/blog/2021-01-27-zmk-sotf-4.md b/docs/blog/2021-01-27-zmk-sotf-4.md new file mode 100644 index 00000000..bbbabdcb --- /dev/null +++ b/docs/blog/2021-01-27-zmk-sotf-4.md @@ -0,0 +1,194 @@ +--- +title: "ZMK State Of The Firmware #4" +author: Pete Johanson +author_title: Project Creator +author_url: https://gitlab.com/petejohanson +author_image_url: https://www.gravatar.com/avatar/2001ceff7e9dc753cf96fcb2e6f41110 +tags: [SOTF, keyboards, firmware, oss, ble] +--- + +Welcome to the fourth ZMK "State Of The Firmware" (SOTF)! + +This update will cover all the major activity since [SOTF #3](/blog/2020/11/09/zmk-sotf-3). + +## Recent Activity + +Here's a summary of the various major changes since last time, broken down by theme: + +### Keymaps/Behaviors + +Since last time, there have been several new powerful keymap features and behaviors added, including one of the most asked for features, combos! + +#### Combos + +The initial [combos](/docs/behaviors/combos) work has landed! The amazing [okke-formsma] has once again delivered another powerful feature for ZMK. Combos are "position based", and are configured in a new toplevel node next to they `keymap` node in user's keymap files. + +An example, that would send the `ESC` keycode when pressing both the first and second positions on your keyboard: + +``` +/ { + combos { + compatible = "zmk,combos"; + combo_esc { + timeout-ms = <50>; + key-positions = <0 1>; + bindings = <&kp ESC>; + }; + }; +}; +``` + +:::note +Combos currently are "global", and not scoped to a given active layer. There is future planned work to allow enabling a certain combo for only certain active layers. +::: + +#### Sticky Keys (One-Shot Mods/Layers) Behavior + +[okke-formsma] also contributed the initial "sticky keys" behavior, which can be used for functionality sometimes called "one shot mods" or "one shot layers". In your keymap, this would like like: + +``` +&sk LEFT_CONTROL +``` + +for a sticky key/modifier, or: + +``` +&sl NAV +``` + +for a sticky layer. + +#### `&to` Layer Behavior + +[mcrosson] contributed the new [`&to`](/docs/behaviors/layers#to-layer) layer related behavior. This can be used to completely replace the active layer with a new one. + +This is most frequently used when using multiple core base layers with different layouts, e.g. QWERTY and DVORAK, to switch between them. + +#### Grave Escape Behavior + +[okke-formsma] added an implementation of the "Grave Escape" behavior, developing a more generic "mod-morph" behavior to do so. Adding + +``` +&gresc +``` + +to your keymap will send `ESC` when pressed on its own, but will send `` ` `` when pressed with a GUI or Shift modifier held. + +#### RGB Underglow Color Selection + +[mcrosson] updated the [RGB Underglow behavior](/docs/behaviors/lighting#rgb-underglow) to allow [binding an explicit color selection](/docs/behaviors/lighting#examples) to a key position. + +#### Keymap Upgrader + +[joelspadin] completed the [Keymap Upgrader](/docs/codes/keymap-upgrader) which can be used to update your keymap to using the latest supported codes, and move away from the old deprecated codes. + +If you've made keymap customizations, please make sure to run your keymaps through the upgrader, since the old deprecated codes will be removed in a future version of ZMK. + +### Displays + +There has been lots of work to get display support complete enough for use by end users. Although not quite ready for prime time, it is incredibly close, and we are looking forward to having the last few items completed and the feature documented! + +#### Idle Blanking + +[petejohanson] added idle blanking for displays, which ensures they will go blank, and into low power mode, after a short period of inactivity from the user. This ensures we avoid burn-in for OLEDs, and helps improve battery life. + +#### Battery and Output Widgets + +[petejohanson] implemented the first two complete, dynamic "widgets" for the displays for ZMK, adding a small battery indicator, which includes charging status, and a small output indicator, showing the currently active output (USB or BLE). When using BLE, the indicator also shows the active profile slot, as well as if the profile slot is open, awaiting connection from the paired host, or is actively connected to the host for that profile slot. + +#### Highest Layer Display + +[mcrosson] has contributed the next display widget, showing the highest active layer in the keymap. [petejohanson] then added a small follow up to allow layers in keymaps to add a `label` property to each layer, e.g. `label = "Nav";` and have that label be displayed in the widget instead of the numeric layer number. + +#### WPM + +New contributor [allymparker](https://github.com/allymparker) added our fourth widget, a words-per-minute display! This widget work also included creating the core state logic for tracking the WPM. + +For now, this widget is only working on the central side of split keyboards. + +### Miscellaneous + +#### Zephyr 2.4 + +[innovaker] is at it again with some crucial core fixes, helping prepare and test the upgrade of ZMK to Zephyr 2.4. The updated Zephyr release brings with it some key BLE stability fixes, as well as various other core improvements that improve ZMK. This was a huge undertaking! + +#### BLE Deadlock Fixes + +[petejohanson] was heads down diagnosing and fixing a deadlock issue on BLE that was frustrating and plaguing many users. After finally pinpointing the underlying root cause, he developed a fix and roped in many testers on Discord to help stress test things before merging. + +#### Central/Peripheral Selection + +Previously overriding the selection of left as central, and right as peripheral for wireless splits required making local edits to the configuration files, and maintaining them in a ZMK fork. + +[petejohanson] updated [the config files](https://github.com/zmkfirmware/zmk/pull/510) to allow users to override this in their `_left.conf`/`_right.conf` files in their user repos. + +#### Improved Docker Containers + +As part of the Zephyr 2.4. prep work, [innovaker], along with lots of testing and input from [mcrosson], developed a brand new pair of [Docker images](https://github.com/zmkfirmware/zmk-docker) which is now published to Docker Hub as [zmkfirmware/zmk-build-arm](https://hub.docker.com/repository/docker/zmkfirmware/zmk-build-arm) and [zmkfirmware/zmk-dev-arm](https://hub.docker.com/repository/docker/zmkfirmware/zmk-build-arm). + +The previously blogged VSCode + Docker integration, as well as our GH Action build automation was all moved over to the new images. + +#### Settings Debounce + +[nicell] contributed settings debounce work, to help avoid unnecessary extra writes to flash when making various changes that should be saved, +such as the active BLE profile, external VCC on/off, etc. + +## New Shields + +- Jorne & Jian in [#331](https://github.com/zmkfirmware/zmk/pull/331) - [krikun98](https://github.com/krikun98) +- tidbit in [#424](https://github.com/zmkfirmware/zmk/pull/424) - [mcrosson](https://github.com/mcrosson) +- Helix in [#429](https://github.com/zmkfirmware/zmk/pull/429) - [KingCoinless](https://github.com/KingCoinless) +- BFO-9000 in [#472](https://github.com/zmkfirmware/zmk/pull/472) - [pbz](https://github.com/pbz) +- CRBN in [#493](https://github.com/zmkfirmware/zmk/pull/483) - [ReFil](https://github.com/ReFil) +- Eek in [#529](https://github.com/zmkfirmware/zmk/pull/529) - [MangoIV](https://github.com/MangoIV) + +## New Boards + +- BDN9 Rev2 in [#557](https://github.com/zmkfirmware/zmk/pull/557) - [petejohanson] + +## Sponsorship + +Since it's inception, quite a few users have inquired whether they could sponsor any of the contributors involved in ZMK. Although we are not intending to directly fund any individual contributors for their work on ZMK, there _is_ good that can come from folks sponsoring ZMK. + +You can see the full discussion on [#497](https://github.com/zmkfirmware/zmk/issues/497), but some items that are being considered with sponsorship funds: + +- Hiring a designer to complete the logo/mascot work. +- Creating stickers to send as thank-yous to first time contributors. +- Hosting costs for GitHub Pro. +- Other hosting costs, e.g. Docker Hub. + +For anyone looking to contribute, you can find the [ZMK Firmware project](https://opencollective.com/zmkfirmware) is now set up on [Open Collective](https://opencollective.com). + +## Coming Soon! + +Some items listed in the last coming soon section are still under active development. + +- A power profiler page for the website, to help users estimate their battery life for a given keyboard - [Nicell] +- Behavior "locality", allowing improved split usage for things like `&reset`, and controlling external power and RGB underglow for both sides - [petejohanson] +- More modular approach to external boards/shields, custom code, user keymaps, etc. +- More shields and boards + +## Statistics + +Some statistics of interest for ZMK: + +- GitHub (lifetime stats) + - 389 Closed PRs + - 199 Stars + - 163 Forks +- Discord Chat + - 702 total registered +- Website (last 30 days) + - 11.5K page views + - 1K new users + +## Thanks! + +Thanks again to the numerous contributors, testers, and users who have made working on ZMK such a pleasure! + +[okke-formsma]: https://github.com/okke-formsma +[mcrosson]: https://github.com/mcrosson +[nicell]: https://github.com/Nicell +[petejohanson]: https://github.com/petejohanson +[innovaker]: https://github.com/innovaker +[joelspadin]: https://github.com/joelspadin From a89d8a6ea425e28856e762bd4db50a6a40ef58e8 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Wed, 27 Jan 2021 22:49:57 -0500 Subject: [PATCH 07/35] fix(blog): Updated link to combos docs. --- docs/blog/2021-01-27-zmk-sotf-4.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/blog/2021-01-27-zmk-sotf-4.md b/docs/blog/2021-01-27-zmk-sotf-4.md index bbbabdcb..d902b62d 100644 --- a/docs/blog/2021-01-27-zmk-sotf-4.md +++ b/docs/blog/2021-01-27-zmk-sotf-4.md @@ -21,7 +21,7 @@ Since last time, there have been several new powerful keymap features and behavi #### Combos -The initial [combos](/docs/behaviors/combos) work has landed! The amazing [okke-formsma] has once again delivered another powerful feature for ZMK. Combos are "position based", and are configured in a new toplevel node next to they `keymap` node in user's keymap files. +The initial [combos](/docs/features/combos) work has landed! The amazing [okke-formsma] has once again delivered another powerful feature for ZMK. Combos are "position based", and are configured in a new toplevel node next to they `keymap` node in user's keymap files. An example, that would send the `ESC` keycode when pressing both the first and second positions on your keyboard: From c925cf02dd1999c0e968ead7652956e5e1925875 Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Sat, 12 Dec 2020 21:35:52 +0100 Subject: [PATCH 08/35] feature(sticky_keys): add quick-release when quick-release is enabled, the sticky key is released immediately after another key is pressed --- app/dts/behaviors/sticky_key.dtsi | 1 + .../behaviors/zmk,behavior-sticky-key.yaml | 2 + app/src/behaviors/behavior_sticky_key.c | 6 ++- .../2-sl-dn-up-kcdn-kcup/events.patterns | 1 + .../keycode_events.snapshot | 8 +++ .../2-sl-dn-up-kcdn-kcup/native_posix.keymap | 52 +++++++++++++++++++ .../8-lsk-osk-combination/events.patterns | 2 +- .../keycode_events.snapshot | 8 +-- .../8-lsk-osk-combination/native_posix.keymap | 4 +- 9 files changed, 76 insertions(+), 8 deletions(-) create mode 100644 app/tests/sticky-keys/2-sl-dn-up-kcdn-kcup/events.patterns create mode 100644 app/tests/sticky-keys/2-sl-dn-up-kcdn-kcup/keycode_events.snapshot create mode 100644 app/tests/sticky-keys/2-sl-dn-up-kcdn-kcup/native_posix.keymap diff --git a/app/dts/behaviors/sticky_key.dtsi b/app/dts/behaviors/sticky_key.dtsi index 1e66a1ed..f1c1cdd5 100644 --- a/app/dts/behaviors/sticky_key.dtsi +++ b/app/dts/behaviors/sticky_key.dtsi @@ -19,6 +19,7 @@ #binding-cells = <1>; release-after-ms = <1000>; bindings = <&mo>; + quick-release; }; }; diff --git a/app/dts/bindings/behaviors/zmk,behavior-sticky-key.yaml b/app/dts/bindings/behaviors/zmk,behavior-sticky-key.yaml index df9c423c..1c2ab7f3 100644 --- a/app/dts/bindings/behaviors/zmk,behavior-sticky-key.yaml +++ b/app/dts/bindings/behaviors/zmk,behavior-sticky-key.yaml @@ -13,3 +13,5 @@ properties: required: true release-after-ms: type: int + quick-release: + type: boolean diff --git a/app/src/behaviors/behavior_sticky_key.c b/app/src/behaviors/behavior_sticky_key.c index fe05e067..aa9fe9ac 100644 --- a/app/src/behaviors/behavior_sticky_key.c +++ b/app/src/behaviors/behavior_sticky_key.c @@ -29,6 +29,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 +210,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 && @@ -269,6 +272,7 @@ static struct behavior_sticky_key_data behavior_sticky_key_data; #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), \ + .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, \ diff --git a/app/tests/sticky-keys/2-sl-dn-up-kcdn-kcup/events.patterns b/app/tests/sticky-keys/2-sl-dn-up-kcdn-kcup/events.patterns new file mode 100644 index 00000000..833100f6 --- /dev/null +++ b/app/tests/sticky-keys/2-sl-dn-up-kcdn-kcup/events.patterns @@ -0,0 +1 @@ +s/.*hid_listener_keycode_//p \ No newline at end of file diff --git a/app/tests/sticky-keys/2-sl-dn-up-kcdn-kcup/keycode_events.snapshot b/app/tests/sticky-keys/2-sl-dn-up-kcdn-kcup/keycode_events.snapshot new file mode 100644 index 00000000..7e745b51 --- /dev/null +++ b/app/tests/sticky-keys/2-sl-dn-up-kcdn-kcup/keycode_events.snapshot @@ -0,0 +1,8 @@ +pressed: 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 0x1b implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +pressed: 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 0x1b implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/sticky-keys/2-sl-dn-up-kcdn-kcup/native_posix.keymap b/app/tests/sticky-keys/2-sl-dn-up-kcdn-kcup/native_posix.keymap new file mode 100644 index 00000000..4470fb21 --- /dev/null +++ b/app/tests/sticky-keys/2-sl-dn-up-kcdn-kcup/native_posix.keymap @@ -0,0 +1,52 @@ +#include +#include +#include + +/* + sticky layers should quick-release. + Thus, the second keypress should be on the default layer, not on the lower_layer. +*/ + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &sk E &sl 1 + &kp A &kp B>; + }; + + lower_layer { + bindings = < + &sk LEFT_CONTROL &kp X + &kp Y &kp Z>; + }; + }; +}; + +&kscan { + events = < + /* press sl 1 */ + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(0,1,10) + /* press X */ + ZMK_MOCK_PRESS(0,1,10) + /* press A */ + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(0,1,10) + ZMK_MOCK_RELEASE(1,0,10) + + /* repeat test to check if cleanup is done correctly */ + /* press sl 1 */ + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(0,1,10) + /* press X */ + ZMK_MOCK_PRESS(0,1,10) + /* press Y */ + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(0,1,10) + ZMK_MOCK_RELEASE(1,0,10) + >; +}; \ No newline at end of file diff --git a/app/tests/sticky-keys/8-lsk-osk-combination/events.patterns b/app/tests/sticky-keys/8-lsk-osk-combination/events.patterns index 833100f6..b1342af4 100644 --- a/app/tests/sticky-keys/8-lsk-osk-combination/events.patterns +++ b/app/tests/sticky-keys/8-lsk-osk-combination/events.patterns @@ -1 +1 @@ -s/.*hid_listener_keycode_//p \ No newline at end of file +s/.*hid_listener_keycode_//p diff --git a/app/tests/sticky-keys/8-lsk-osk-combination/keycode_events.snapshot b/app/tests/sticky-keys/8-lsk-osk-combination/keycode_events.snapshot index 8eb8a352..374035fc 100644 --- a/app/tests/sticky-keys/8-lsk-osk-combination/keycode_events.snapshot +++ b/app/tests/sticky-keys/8-lsk-osk-combination/keycode_events.snapshot @@ -1,8 +1,8 @@ pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 -pressed: 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 0xe0 implicit_mods 0x00 explicit_mods 0x00 -released: usage_page 0x07 keycode 0x1c implicit_mods 0x00 explicit_mods 0x00 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_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 +pressed: usage_page 0x07 keycode 0x04 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 +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 diff --git a/app/tests/sticky-keys/8-lsk-osk-combination/native_posix.keymap b/app/tests/sticky-keys/8-lsk-osk-combination/native_posix.keymap index beedd44e..bdcccf33 100644 --- a/app/tests/sticky-keys/8-lsk-osk-combination/native_posix.keymap +++ b/app/tests/sticky-keys/8-lsk-osk-combination/native_posix.keymap @@ -29,7 +29,7 @@ /* tap sk LEFT_CONTROL */ ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_RELEASE(0,0,10) - /* tap Y */ + /* tap A */ ZMK_MOCK_PRESS(1,0,10) ZMK_MOCK_RELEASE(1,0,10) @@ -40,7 +40,7 @@ /* tap sk */ ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_RELEASE(0,0,10) - /* tap Y */ + /* tap A */ ZMK_MOCK_PRESS(1,0,10) ZMK_MOCK_RELEASE(1,0,10) >; From 64a85b7a3f947a46abb21ec3c4a85c29c38a19fb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Jan 2021 07:14:15 +0000 Subject: [PATCH 09/35] chore(deps): bump DoozyX/clang-format-lint-action from v0.9 to v0.11 Bumps [DoozyX/clang-format-lint-action](https://github.com/DoozyX/clang-format-lint-action) from v0.9 to v0.11. - [Release notes](https://github.com/DoozyX/clang-format-lint-action/releases) - [Commits](https://github.com/DoozyX/clang-format-lint-action/compare/v0.9...84b814a54950e27ac65a62069802df099405ef77) Signed-off-by: dependabot[bot] --- .github/workflows/clang-format-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clang-format-lint.yml b/.github/workflows/clang-format-lint.yml index 8bd42753..b6d515c1 100644 --- a/.github/workflows/clang-format-lint.yml +++ b/.github/workflows/clang-format-lint.yml @@ -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" From 1adb2d5f846c499ca557fc85f565f656fed4e1e0 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Fri, 27 Nov 2020 22:04:15 +0000 Subject: [PATCH 10/35] feat(docs): add information on how to update the documentation to the docs --- docs/docs/development/documentation.md | 57 ++++++++++++++++++++++++++ docs/sidebars.js | 1 + 2 files changed, 58 insertions(+) create mode 100644 docs/docs/development/documentation.md diff --git a/docs/docs/development/documentation.md b/docs/docs/development/documentation.md new file mode 100644 index 00000000..221bb160 --- /dev/null +++ b/docs/docs/development/documentation.md @@ -0,0 +1,57 @@ +--- +title: Documentation +sidebar_label: Documentation +--- + +This document outlines how to test your documentation changes locally and prepare the changes for a pull request. + +The documentation is written with [Docusaurus](https://docusaurus.io/). The ZMK source code has all of the necessary Docusaurus dependencies included but referencing their documentation can be helpful at times. + +The general process for updating the ZMK documentation is: + +1. Update the documentation +2. Test the changes locally +3. Ensure the sources are formatted properly and linted +4. Create a Pull Request for review and inclusion into the ZMK sources + +:::note +If you are working with the documentation from within VS Code+Docker please be aware the documentation will not be auto-generated when making changes while the server is running. You'll need to restart the server when saving changes to the documentation. +::: + +:::note +You will need `Node.js` and `npm` installed to update the documentation. If you're using the ZMK dev container (Docker) the necessary dependencies are already installed. +::: + +## Testing Documentation Updates Locally + +To verify documentation updates locally, follow the following procedure. The `npm` commands and first step will need to be run from a terminal. + +1. Navigate to the `docs` folder +2. Run `npm ci` to build the necessary tools if you haven't run it before or the ZMK sources were updated +3. Run `npm start` to start the local server that will let you see your documentation updates via a web browser +4. If a web browser doesn't open automatically: you'll need to open a browser window or tab and navigate to `http://localhost:3000` to view your changes +5. Verify the changes look good + +## Formatting and Linting Your Changes + +Prior to submitting a documentation pull request, you'll want to run the format and check commands. These commands are run as part of the verification process on pull requests so it's good to run them ahead of submitting documentation updates. + +The format command can be run with the following procedure in a terminal that's inside the ZMK source directory. + +1. Navigate to the `docs` folder +2. Run `npm run prettier:format` + +The check commands can be run with the following procedure in a terminal that's inside the ZMK source directory. + +1. Navigate to the `docs` folder +2. Run `npm run prettier:check` +3. Run `npm run lint` +4. Run `npm run build` + +:::warning +If any of the above steps throw an error, they need to be addressed and all of the checks re-run prior to submitting a pull request. +::: + +## Submitting a Pull Request + +Once the above sections are complete the documentation updates are ready to submit as a pull request. diff --git a/docs/sidebars.js b/docs/sidebars.js index f0465d4d..98ffb19e 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -42,6 +42,7 @@ module.exports = { ], Development: [ "development/clean-room", + "development/documentation", "development/setup", "development/build-flash", "development/boards-shields-keymaps", From cba85d400d33fd08e4a5750ad1a944283078c037 Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Fri, 29 Jan 2021 21:03:53 -0600 Subject: [PATCH 11/35] fix(docs): Only show push workflow builds in link --- docs/docs/troubleshooting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/troubleshooting.md b/docs/docs/troubleshooting.md index 23403eec..5eccb7c1 100644 --- a/docs/docs/troubleshooting.md +++ b/docs/docs/troubleshooting.md @@ -54,7 +54,7 @@ Since then, a much simpler procedure of performing a bluetooth reset for split k **New Procedure:** -1. [Open the GitHub `Actions` tab and select the `Build` workflow](https://github.com/zmkfirmware/zmk/actions?query=workflow%3ABuild+branch%3Amain). +1. [Open the GitHub `Actions` tab and select the `Build` workflow](https://github.com/zmkfirmware/zmk/actions?query=workflow%3ABuild+branch%3Amain+event%3Apush). 1. Select the top 'result' on that page. 1. From the next page under "Artifacts", download the `$boardname-settings_reset-zmk` zip file. 1. Unzip the downloaded file. From ddc5cbdca2d859a141c33040a2b3a54b6100aee3 Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Fri, 29 Jan 2021 20:40:23 -0600 Subject: [PATCH 12/35] fix(docs): Set description to our tagline --- docs/src/pages/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/pages/index.js b/docs/src/pages/index.js index 7019e579..ccaab508 100644 --- a/docs/src/pages/index.js +++ b/docs/src/pages/index.js @@ -59,7 +59,7 @@ function Home() { return (
From 40694a09695d43006242ed0966387c3aee4e4c32 Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Fri, 15 Jan 2021 14:18:11 +0000 Subject: [PATCH 13/35] docs: remove redundant slash from "docs/" navigation item Aligns with the blog item. PR: #608 --- docs/docusaurus.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index acf51f4a..f22610a0 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -23,7 +23,7 @@ module.exports = { }, items: [ { - to: "docs/", + to: "docs", activeBasePath: "docs", label: "Docs", position: "left", From 4f040fecdf1f653dc48cae3e051980067103f712 Mon Sep 17 00:00:00 2001 From: Jeff Rizzo Date: Mon, 25 Jan 2021 12:50:05 -0800 Subject: [PATCH 14/35] Add a missing log_strdup() --- app/src/ble.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/ble.c b/app/src/ble.c index e8d2c420..c51391cb 100644 --- a/app/src/ble.c +++ b/app/src/ble.c @@ -429,7 +429,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 = { From f39121f82e45d42cee06dec852f164494597245a Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Fri, 29 Jan 2021 23:29:10 -0600 Subject: [PATCH 15/35] fix(docs): Remove comment about here being four profiles for splits --- docs/docs/behaviors/bluetooth.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/behaviors/bluetooth.md b/docs/docs/behaviors/bluetooth.md index 0b66a4ca..f2d1b2f0 100644 --- a/docs/docs/behaviors/bluetooth.md +++ b/docs/docs/behaviors/bluetooth.md @@ -71,7 +71,7 @@ The bluetooth behavior completes an bluetooth action given on press. ## Bluetooth Pairing and Profiles -ZMK support bluetooth “profiles” which allows connection to multiple devices (5 by default, or 4 if you are using split keyboards). Each profile stores the bluetooth MAC address of a peer, which can be empty if a profile has not been paired with a device yet. Upon switching to a profile, ZMK does the following: +ZMK support bluetooth “profiles” which allows connection to multiple devices (5 by default). Each profile stores the bluetooth MAC address of a peer, which can be empty if a profile has not been paired with a device yet. Upon switching to a profile, ZMK does the following: - If a profile has not been paired with a peer yet, ZMK automatically advertise itself as connectable. You can discover you keyboard from bluetooth scanning on your laptop / tablet. If you try to connect, it will trigger the _pairing_ procedure. After pairing, the bluetooth MAC address of the peer device will be stored in the current profile. Pairing also negotiate a random key for secure communication between the device and the keyboard. - If a profile has been paired but the peer is not connected yet, ZMK will also advertise itself as connectable. In the future, the behavior might change to _direct advertising_ which only target the peer with the stored bluetooth MAC address. In this state, if the peer is powered on and moved within the distance of bluetooth signal coverage, it should automatically connect to the keyboard. From 84d19fe79b04af0fca87621306b1526a629a7957 Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Sat, 12 Dec 2020 20:31:42 +0100 Subject: [PATCH 16/35] refactor(behaviors): factor out multiple uses of _TRANSFORM_ENTRY --- app/include/zmk/keymap.h | 9 +++++++++ app/src/behaviors/behavior_sticky_key.c | 15 ++++----------- app/src/keymap.c | 14 +++----------- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/app/include/zmk/keymap.h b/app/include/zmk/keymap.h index 4bcdc2b4..4ac91cb9 100644 --- a/app/include/zmk/keymap.h +++ b/app/include/zmk/keymap.h @@ -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))), \ + } diff --git a/app/src/behaviors/behavior_sticky_key.c b/app/src/behaviors/behavior_sticky_key.c index aa9fe9ac..20af93a8 100644 --- a/app/src/behaviors/behavior_sticky_key.c +++ b/app/src/behaviors/behavior_sticky_key.c @@ -18,6 +18,7 @@ #include #include #include +#include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); @@ -260,18 +261,10 @@ 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, \ @@ -280,4 +273,4 @@ static struct behavior_sticky_key_data behavior_sticky_key_data; DT_INST_FOREACH_STATUS_OKAY(KP_INST) -#endif \ No newline at end of file +#endif diff --git a/app/src/keymap.c b/app/src/keymap.c index 31258e0d..75ec6bf4 100644 --- a/app/src/keymap.c +++ b/app/src/keymap.c @@ -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) \ From 4e20bf5de17e9d1c8adca66be08469c28981a945 Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Sat, 12 Dec 2020 20:32:20 +0100 Subject: [PATCH 17/35] refactor(behaviors): simplify hold-taps by not using _TRANSFORM_ENTRY --- app/include/zmk/keymap.h | 2 +- app/src/behaviors/behavior_hold_tap.c | 35 +++++++++------------------ 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/app/include/zmk/keymap.h b/app/include/zmk/keymap.h index 4ac91cb9..7151930a 100644 --- a/app/include/zmk/keymap.h +++ b/app/include/zmk/keymap.h @@ -20,7 +20,7 @@ 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) \ +#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), \ diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index fcb4c5bd..4e918466 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -18,6 +18,7 @@ #include #include #include +#include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); @@ -35,14 +36,10 @@ 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; enum flavor flavor; }; @@ -289,11 +286,11 @@ 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; } @@ -350,7 +347,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, @@ -358,11 +356,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; } @@ -489,22 +487,11 @@ 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)), \ .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, \ From 82173f354e36e9dad4a7db49a61a4eebcef95ccf Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Sat, 30 Jan 2021 15:47:11 -0600 Subject: [PATCH 18/35] fix(core): Assert BLE device name is correct length --- app/src/ble.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/ble.c b/app/src/ble.c index c51391cb..b15a079e 100644 --- a/app/src/ble.c +++ b/app/src/ble.c @@ -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 \ From 33cd2cacede8ccadab099abe49735bacf0a0b76e Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Mon, 1 Feb 2021 14:20:16 -0600 Subject: [PATCH 19/35] fix(boards): Shorten keyboard names that are too long --- app/boards/shields/splitreus62/Kconfig.defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/boards/shields/splitreus62/Kconfig.defconfig b/app/boards/shields/splitreus62/Kconfig.defconfig index fdaa3779..41c1218a 100644 --- a/app/boards/shields/splitreus62/Kconfig.defconfig +++ b/app/boards/shields/splitreus62/Kconfig.defconfig @@ -16,7 +16,7 @@ endif if SHIELD_SPLITREUS62_RIGHT config ZMK_KEYBOARD_NAME - default "Splitreus62 Right" + default "Splitreus62 Rt" endif From 100d06ae8b37926b2211ff856f3ab21ba094e8c0 Mon Sep 17 00:00:00 2001 From: Aaron Nunley Date: Sun, 31 Jan 2021 19:10:46 -0800 Subject: [PATCH 20/35] Update docs for testing a new shield. Clarifying the need for `west flash` in a dockerized environment and providing a high-level overview of testing a board with UF2 support. --- docs/docs/development/new-shield.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/docs/development/new-shield.md b/docs/docs/development/new-shield.md index 6fac2075..25d59fcf 100644 --- a/docs/docs/development/new-shield.md +++ b/docs/docs/development/new-shield.md @@ -463,12 +463,21 @@ you should be able to test with a build command like: west build --pristine -b proton_c -- -DSHIELD=my_board ``` -and then flash with: +The above build command generates `build/zephyr/zmk.uf2`. If your board +supports USB Flashing Format (UF2), copy that file onto the root of the USB mass +storage device for your board. The controller should flash your built firmware +and automatically restart once flashing is complete. + +Alternatively, if your board supports flashing and you're not developing from +within a Dockerized environment, then you can test your build with: ``` west flash ``` +Please have a look at documentation specific to +[building and flashing](build-flash) for additional information. + :::note Further testing your keyboard shield without altering the root keymap file can be done with the use of `-DZMK_CONFIG` in your `west build` command, shown [here](build-flash#building-from-zmk-config-folder) From 592b98cd12535378b73e812814979541bc981368 Mon Sep 17 00:00:00 2001 From: Aaron Nunley Date: Sun, 31 Jan 2021 19:17:02 -0800 Subject: [PATCH 21/35] npm run prettier:format --- docs/docs/development/new-shield.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs/development/new-shield.md b/docs/docs/development/new-shield.md index 25d59fcf..d701a2c7 100644 --- a/docs/docs/development/new-shield.md +++ b/docs/docs/development/new-shield.md @@ -463,13 +463,13 @@ you should be able to test with a build command like: west build --pristine -b proton_c -- -DSHIELD=my_board ``` -The above build command generates `build/zephyr/zmk.uf2`. If your board +The above build command generates `build/zephyr/zmk.uf2`. If your board supports USB Flashing Format (UF2), copy that file onto the root of the USB mass -storage device for your board. The controller should flash your built firmware +storage device for your board. The controller should flash your built firmware and automatically restart once flashing is complete. Alternatively, if your board supports flashing and you're not developing from -within a Dockerized environment, then you can test your build with: +within a Dockerized environment, then you can test your build with: ``` west flash From bcc3d9b5a6acb9f39cdae1544e334ec733c6ad6e Mon Sep 17 00:00:00 2001 From: Aaron Nunley Date: Sun, 31 Jan 2021 20:29:40 -0800 Subject: [PATCH 22/35] Update build/flash documentation. Updated docs for the build and flash to have similar content to the new board page. Added a bit about DFU in case someone were searching for that term. --- docs/docs/development/build-flash.md | 14 ++++++++++---- docs/docs/development/new-shield.md | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/docs/development/build-flash.md b/docs/docs/development/build-flash.md index e270a7c6..acabfc07 100644 --- a/docs/docs/development/build-flash.md +++ b/docs/docs/development/build-flash.md @@ -118,11 +118,17 @@ Now start VSCode and rebuild the container after being prompted. You should be a ## Flashing -Once built, the previously supplied parameters will be remembered so you can run the following to flash your -board with it in bootloader mode: +The above build commands generate a UF2 file in `build/zephyr` (or +`build/left|right/zephyr` if you followed the instructions for splits) and is by +default named `zmk.uf2`. If your board supports USB Flashing Format (UF2), copy +that file onto the root of the USB mass storage device for your board. The +controller should flash your built firmware and automatically restart once +flashing is complete. + +Alternatively, if your board supports flashing and you're not developing from +within a Dockerized environment, enable Device Firmware Upgrade (DFU) mode on +your board and run the following command to flash: ``` west flash ``` - -For boards that have drag and drop .uf2 flashing capability, the .uf2 file to flash can be found in `build/zephyr` (or `build/left|right/zephyr` if you followed the instructions for splits) and is by default named `zmk.uf2`. diff --git a/docs/docs/development/new-shield.md b/docs/docs/development/new-shield.md index d701a2c7..d82cb8ed 100644 --- a/docs/docs/development/new-shield.md +++ b/docs/docs/development/new-shield.md @@ -469,7 +469,8 @@ storage device for your board. The controller should flash your built firmware and automatically restart once flashing is complete. Alternatively, if your board supports flashing and you're not developing from -within a Dockerized environment, then you can test your build with: +within a Dockerized environment, enable Device Firmware Upgrade (DFU) mode on +your board and run the following command to test your build: ``` west flash From 2f352788c13294f842654a1bdcd243fdf051ae3b Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Thu, 28 Jan 2021 11:53:18 -0500 Subject: [PATCH 23/35] refactor(kscan): Remove explicit default n from kscan configs. * Actually allow defaulting yes in other places. --- app/Kconfig | 2 -- app/drivers/kscan/Kconfig | 2 -- 2 files changed, 4 deletions(-) diff --git a/app/Kconfig b/app/Kconfig index 737895c7..aa6143ce 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -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 diff --git a/app/drivers/kscan/Kconfig b/app/drivers/kscan/Kconfig index 654e0ee4..dc3580d5 100644 --- a/app/drivers/kscan/Kconfig +++ b/app/drivers/kscan/Kconfig @@ -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 From 6c7ab0ce53ec75394eaa84ae303d725300cb1f45 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Thu, 28 Jan 2021 11:55:02 -0500 Subject: [PATCH 24/35] refactor(kscan): Fix polling of GPIO matrices. * Add easier macros for conditional polling/interrupt code. * Properly continue polling on intervals, without extra enable/disable code for pins that is superfluous when not trying to deal with interupts firing. * Fix to allow multiple GPIO drivers when doing splits w/ IO expanders --- app/drivers/kscan/kscan_gpio_matrix.c | 144 ++++++++++++++------------ 1 file changed, 78 insertions(+), 66 deletions(-) diff --git a/app/drivers/kscan/kscan_gpio_matrix.c b/app/drivers/kscan/kscan_gpio_matrix.c index 6697cf69..9af3171a 100644 --- a/app/drivers/kscan/kscan_gpio_matrix.c +++ b/app/drivers/kscan/kscan_gpio_matrix.c @@ -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 = { \ From 9a7908b6324181403836908e90754146fb7f0b5b Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Sun, 31 Jan 2021 21:37:57 +0100 Subject: [PATCH 25/35] behaviors(hold-tap): Implement quick_tap_ms (TAPPING_FORCE_HOLD) Tap-and-hold a hold-tap to hold the tap behavior so it can repeat. After a tap, if the same key is pressed within `quick_tap_ms`, the tap behavior is always picked. This is useful for things like `&ht LSHFT BACKSPACE` where holding the backspace is required. Implements #288. --- .../behaviors/zmk,behavior-hold-tap.yaml | 3 ++ app/src/behaviors/behavior_hold_tap.c | 38 +++++++++++++++++++ .../balanced/5-quick-tap/events.patterns | 4 ++ .../5-quick-tap/keycode_events.snapshot | 10 +++++ .../balanced/5-quick-tap/native_posix.keymap | 14 +++++++ .../hold-tap/balanced/behavior_keymap.dtsi | 1 + .../5-quick-tap/events.patterns | 4 ++ .../5-quick-tap/keycode_events.snapshot | 10 +++++ .../5-quick-tap/native_posix.keymap | 14 +++++++ .../hold-preferred/behavior_keymap.dtsi | 1 + .../tap-preferred/5-quick-tap/events.patterns | 4 ++ .../5-quick-tap/keycode_events.snapshot | 10 +++++ .../5-quick-tap/native_posix.keymap | 14 +++++++ .../tap-preferred/behavior_keymap.dtsi | 1 + docs/docs/behaviors/hold-tap.md | 15 +++++++- 15 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 app/tests/hold-tap/balanced/5-quick-tap/events.patterns create mode 100644 app/tests/hold-tap/balanced/5-quick-tap/keycode_events.snapshot create mode 100644 app/tests/hold-tap/balanced/5-quick-tap/native_posix.keymap create mode 100644 app/tests/hold-tap/hold-preferred/5-quick-tap/events.patterns create mode 100644 app/tests/hold-tap/hold-preferred/5-quick-tap/keycode_events.snapshot create mode 100644 app/tests/hold-tap/hold-preferred/5-quick-tap/native_posix.keymap create mode 100644 app/tests/hold-tap/tap-preferred/5-quick-tap/events.patterns create mode 100644 app/tests/hold-tap/tap-preferred/5-quick-tap/keycode_events.snapshot create mode 100644 app/tests/hold-tap/tap-preferred/5-quick-tap/native_posix.keymap diff --git a/app/dts/bindings/behaviors/zmk,behavior-hold-tap.yaml b/app/dts/bindings/behaviors/zmk,behavior-hold-tap.yaml index 5f74e9ad..56f0cc27 100644 --- a/app/dts/bindings/behaviors/zmk,behavior-hold-tap.yaml +++ b/app/dts/bindings/behaviors/zmk,behavior-hold-tap.yaml @@ -13,6 +13,9 @@ properties: required: true tapping_term_ms: type: int + quick_tap_ms: + type: int + default: -1 flavor: type: string required: false diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index 4e918466..8f239dc2 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -40,6 +40,7 @@ struct behavior_hold_tap_config { int tapping_term_ms; char *hold_behavior_dev; char *tap_behavior_dev; + int quick_tap_ms; enum flavor flavor; }; @@ -67,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) { @@ -191,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) { @@ -204,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; } @@ -219,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; } @@ -235,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; } @@ -293,6 +325,7 @@ static void decide_hold_tap(struct active_hold_tap *hold_tap, enum decision_mome 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(); @@ -320,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(); @@ -492,6 +529,7 @@ static struct behavior_hold_tap_data behavior_hold_tap_data; .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, \ diff --git a/app/tests/hold-tap/balanced/5-quick-tap/events.patterns b/app/tests/hold-tap/balanced/5-quick-tap/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/balanced/5-quick-tap/events.patterns @@ -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 \ No newline at end of file diff --git a/app/tests/hold-tap/balanced/5-quick-tap/keycode_events.snapshot b/app/tests/hold-tap/balanced/5-quick-tap/keycode_events.snapshot new file mode 100644 index 00000000..a1b18d1c --- /dev/null +++ b/app/tests/hold-tap/balanced/5-quick-tap/keycode_events.snapshot @@ -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 diff --git a/app/tests/hold-tap/balanced/5-quick-tap/native_posix.keymap b/app/tests/hold-tap/balanced/5-quick-tap/native_posix.keymap new file mode 100644 index 00000000..8f90ffad --- /dev/null +++ b/app/tests/hold-tap/balanced/5-quick-tap/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#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) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/balanced/behavior_keymap.dtsi b/app/tests/hold-tap/balanced/behavior_keymap.dtsi index 34a4d458..972b606f 100644 --- a/app/tests/hold-tap/balanced/behavior_keymap.dtsi +++ b/app/tests/hold-tap/balanced/behavior_keymap.dtsi @@ -10,6 +10,7 @@ #binding-cells = <2>; flavor = "balanced"; tapping_term_ms = <300>; + quick_tap_ms = <200>; bindings = <&kp>, <&kp>; }; }; diff --git a/app/tests/hold-tap/hold-preferred/5-quick-tap/events.patterns b/app/tests/hold-tap/hold-preferred/5-quick-tap/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/hold-preferred/5-quick-tap/events.patterns @@ -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 \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred/5-quick-tap/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/5-quick-tap/keycode_events.snapshot new file mode 100644 index 00000000..c3caf870 --- /dev/null +++ b/app/tests/hold-tap/hold-preferred/5-quick-tap/keycode_events.snapshot @@ -0,0 +1,10 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (hold-preferred 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 (hold-preferred 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 diff --git a/app/tests/hold-tap/hold-preferred/5-quick-tap/native_posix.keymap b/app/tests/hold-tap/hold-preferred/5-quick-tap/native_posix.keymap new file mode 100644 index 00000000..8f90ffad --- /dev/null +++ b/app/tests/hold-tap/hold-preferred/5-quick-tap/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#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) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/hold-preferred/behavior_keymap.dtsi b/app/tests/hold-tap/hold-preferred/behavior_keymap.dtsi index e6143195..2b35f890 100644 --- a/app/tests/hold-tap/hold-preferred/behavior_keymap.dtsi +++ b/app/tests/hold-tap/hold-preferred/behavior_keymap.dtsi @@ -12,6 +12,7 @@ #binding-cells = <2>; flavor = "hold-preferred"; tapping_term_ms = <300>; + quick_tap_ms = <200>; bindings = <&kp>, <&kp>; }; }; diff --git a/app/tests/hold-tap/tap-preferred/5-quick-tap/events.patterns b/app/tests/hold-tap/tap-preferred/5-quick-tap/events.patterns new file mode 100644 index 00000000..fdf2b15c --- /dev/null +++ b/app/tests/hold-tap/tap-preferred/5-quick-tap/events.patterns @@ -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 \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred/5-quick-tap/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/5-quick-tap/keycode_events.snapshot new file mode 100644 index 00000000..e89ccf34 --- /dev/null +++ b/app/tests/hold-tap/tap-preferred/5-quick-tap/keycode_events.snapshot @@ -0,0 +1,10 @@ +ht_binding_pressed: 0 new undecided hold_tap +ht_decide: 0 decided tap (tap-preferred 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 (tap-preferred 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 diff --git a/app/tests/hold-tap/tap-preferred/5-quick-tap/native_posix.keymap b/app/tests/hold-tap/tap-preferred/5-quick-tap/native_posix.keymap new file mode 100644 index 00000000..8f90ffad --- /dev/null +++ b/app/tests/hold-tap/tap-preferred/5-quick-tap/native_posix.keymap @@ -0,0 +1,14 @@ +#include +#include +#include +#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) + >; +}; \ No newline at end of file diff --git a/app/tests/hold-tap/tap-preferred/behavior_keymap.dtsi b/app/tests/hold-tap/tap-preferred/behavior_keymap.dtsi index e6d33c0b..80d6b0af 100644 --- a/app/tests/hold-tap/tap-preferred/behavior_keymap.dtsi +++ b/app/tests/hold-tap/tap-preferred/behavior_keymap.dtsi @@ -10,6 +10,7 @@ #binding-cells = <2>; flavor = "tap-preferred"; tapping_term_ms = <300>; + quick_tap_ms = <200>; bindings = <&kp>, <&kp>; }; }; diff --git a/docs/docs/behaviors/hold-tap.md b/docs/docs/behaviors/hold-tap.md index 0cf48884..c148fa37 100644 --- a/docs/docs/behaviors/hold-tap.md +++ b/docs/docs/behaviors/hold-tap.md @@ -11,7 +11,7 @@ Simply put, the hold-tap key will output the 'hold' behavior if it's held for a ### Hold-Tap -The `tapping_term_ms` parameter decides between a 'tap' and a 'hold'. +The graph below shows how the hold-tap decides between a 'tap' and a 'hold'. ![Simple behavior](../assets/hold-tap/case1_2.png) @@ -37,6 +37,18 @@ For basic usage, please see [mod-tap](./mod-tap.md) and [layer-tap](./layers.md) ### Advanced Configuration +#### `tapping_term_ms` + +Defines how long a key must be pressed to trigger Hold behavior. + +#### `quick_tap_ms` + +If you press a tapped hold-tap again within `quick_tap_ms` milliseconds, it will always trigger the tap behavior. This is useful for things like a backspace, where a quick tap+hold holds backspace pressed. Set this to a negative value to disable. The default is -1 (disabled). + +In QMK, unlike ZMK, this functionality is enabled by default, and you turn it off using `TAPPING_FORCE_HOLD`. + +#### Home row mods + This example configures a hold-tap that works well for homerow mods: ``` @@ -50,6 +62,7 @@ This example configures a hold-tap that works well for homerow mods: label = "HOMEROW_MODS"; #binding-cells = <2>; tapping_term_ms = <150>; + quick_tap_ms = <0>; flavor = "tap-preferred"; bindings = <&kp>, <&kp>; }; From 9205ea1c705504844ad3b9e31d6fbd437cb76aba Mon Sep 17 00:00:00 2001 From: y4m4ym <57538883+y4my4m123@users.noreply.github.com> Date: Thu, 4 Feb 2021 05:10:47 +0100 Subject: [PATCH 26/35] fix(setup): Fix index to MakerDiary m.2 board --- docs/static/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 34f0f054..2078ff3e 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -79,7 +79,7 @@ select opt in "${options[@]}" "Quit"; do 1 ) board="nice_nano"; break;; 2 ) board="proton_c"; break;; 3 ) board="bluemicro840_v1"; break;; - 3 ) board="nrf52840_m2"; break;; + 4 ) board="nrf52840_m2"; break;; $(( ${#options[@]}+1 )) ) echo "Goodbye!"; exit 1;; *) echo "Invalid option. Try another one."; continue;; From cd503ed17bb141bd54a777a375b5706acf884318 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Wed, 3 Feb 2021 23:33:09 -0500 Subject: [PATCH 27/35] Feat combo layers (#661) feat(combos): add layer filtering Co-authored-by: KemoNine --- app/dts/bindings/zmk,combos.yaml | 3 + app/src/combo.c | 31 +++++++- .../combo/layer-filter-0/events.patterns | 2 + .../layer-filter-0/keycode_events.snapshot | 8 ++ .../combo/layer-filter-0/native_posix.keymap | 78 +++++++++++++++++++ .../combo/layer-filter-1/events.patterns | 2 + .../layer-filter-1/keycode_events.snapshot | 4 + .../combo/layer-filter-1/native_posix.keymap | 40 ++++++++++ docs/docs/features/combos.md | 2 + 9 files changed, 166 insertions(+), 4 deletions(-) create mode 100644 app/tests/combo/layer-filter-0/events.patterns create mode 100644 app/tests/combo/layer-filter-0/keycode_events.snapshot create mode 100644 app/tests/combo/layer-filter-0/native_posix.keymap create mode 100644 app/tests/combo/layer-filter-1/events.patterns create mode 100644 app/tests/combo/layer-filter-1/keycode_events.snapshot create mode 100644 app/tests/combo/layer-filter-1/native_posix.keymap diff --git a/app/dts/bindings/zmk,combos.yaml b/app/dts/bindings/zmk,combos.yaml index 75eaa3e1..1a914a7f 100644 --- a/app/dts/bindings/zmk,combos.yaml +++ b/app/dts/bindings/zmk,combos.yaml @@ -20,3 +20,6 @@ child-binding: default: 50 slow-release: type: boolean + layers: + type: array + default: [-1] \ No newline at end of file diff --git a/app/src/combo.c b/app/src/combo.c index 82f6538f..b50a0f61 100644 --- a/app/src/combo.c +++ b/app/src/combo.c @@ -17,6 +17,7 @@ #include #include #include +#include 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); diff --git a/app/tests/combo/layer-filter-0/events.patterns b/app/tests/combo/layer-filter-0/events.patterns new file mode 100644 index 00000000..b90d7863 --- /dev/null +++ b/app/tests/combo/layer-filter-0/events.patterns @@ -0,0 +1,2 @@ +s/.*hid_listener_keycode_//p +s/.*combo//p \ No newline at end of file diff --git a/app/tests/combo/layer-filter-0/keycode_events.snapshot b/app/tests/combo/layer-filter-0/keycode_events.snapshot new file mode 100644 index 00000000..f845fd16 --- /dev/null +++ b/app/tests/combo/layer-filter-0/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/layer-filter-0/native_posix.keymap b/app/tests/combo/layer-filter-0/native_posix.keymap new file mode 100644 index 00000000..aac330f9 --- /dev/null +++ b/app/tests/combo/layer-filter-0/native_posix.keymap @@ -0,0 +1,78 @@ +#include +#include +#include + +/* 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 = ; + key-positions = <0 1>; + bindings = <&kp X>; + layers = <0>; + }; + + combo_two { + timeout-ms = ; + key-positions = <0 1>; + bindings = <&kp Y>; + layers = <1>; + }; + + combo_three { + timeout-ms = ; + 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) + >; +}; \ No newline at end of file diff --git a/app/tests/combo/layer-filter-1/events.patterns b/app/tests/combo/layer-filter-1/events.patterns new file mode 100644 index 00000000..b90d7863 --- /dev/null +++ b/app/tests/combo/layer-filter-1/events.patterns @@ -0,0 +1,2 @@ +s/.*hid_listener_keycode_//p +s/.*combo//p \ No newline at end of file diff --git a/app/tests/combo/layer-filter-1/keycode_events.snapshot b/app/tests/combo/layer-filter-1/keycode_events.snapshot new file mode 100644 index 00000000..bb47d852 --- /dev/null +++ b/app/tests/combo/layer-filter-1/keycode_events.snapshot @@ -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 diff --git a/app/tests/combo/layer-filter-1/native_posix.keymap b/app/tests/combo/layer-filter-1/native_posix.keymap new file mode 100644 index 00000000..995f27ee --- /dev/null +++ b/app/tests/combo/layer-filter-1/native_posix.keymap @@ -0,0 +1,40 @@ +#include +#include +#include + +/* 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 = ; + 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) + >; +}; \ No newline at end of file diff --git a/docs/docs/features/combos.md b/docs/docs/features/combos.md index 845bb018..653fc6e9 100644 --- a/docs/docs/features/combos.md +++ b/docs/docs/features/combos.md @@ -18,6 +18,7 @@ Combos configured in your `.keymap` file, but are separate from the `keymap` nod timeout-ms = <50>; key-positions = <0 1>; bindings = <&kp ESC>; + layers = <-1>; }; }; }; @@ -27,6 +28,7 @@ Combos configured in your `.keymap` file, but are separate from the `keymap` nod - The `compatible` property should always be `"zmk,combos"` for combos. - `timeout-ms` is the number of milliseconds that all keys of the combo must be pressed. - `key-positions` is an array of key positions. See the info section below about how to figure out the positions on your board. +- `layers = <0 1...>` will allow limiting a combo to specific layers. this is an _optional_ parameter and defaults to `-1` which is global scope. - `bindings` is the behavior that is activated when the behavior is pressed. - (advanced) you can specify `slow-release` if you want the combo binding to be released when all key-positions are released. The default is to release the combo as soon as any of the keys in the combo is released. From c94943da1c31c295c063811336cb3a7bee983ccc Mon Sep 17 00:00:00 2001 From: mantas Date: Sat, 30 Jan 2021 13:49:52 +0200 Subject: [PATCH 28/35] style(crbn): Unify indentation from spaces to tabs --- app/boards/shields/crbn/crbn.keymap | 16 ++++----- app/boards/shields/crbn/crbn.overlay | 50 ++++++++++++++-------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/app/boards/shields/crbn/crbn.keymap b/app/boards/shields/crbn/crbn.keymap index 639d2aad..023d3ec1 100644 --- a/app/boards/shields/crbn/crbn.keymap +++ b/app/boards/shields/crbn/crbn.keymap @@ -26,30 +26,30 @@ >; }; - 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 { + 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 - >; - }; - }; + >; + }; + }; }; diff --git a/app/boards/shields/crbn/crbn.overlay b/app/boards/shields/crbn/crbn.overlay index 0f7cd45b..ebb3a0a3 100644 --- a/app/boards/shields/crbn/crbn.overlay +++ b/app/boards/shields/crbn/crbn.overlay @@ -11,31 +11,31 @@ 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)> + ; + }; }; From b4d63fb52cde20f910e0bd05724e80370c441981 Mon Sep 17 00:00:00 2001 From: mantas Date: Sat, 30 Jan 2021 14:03:00 +0200 Subject: [PATCH 29/35] feat(shields) Add encoder support to CRBN Pin A maps to A2 (F5), pin B to A3 (F4). Added keymappings to encoder on default and lower layers. --- app/boards/shields/crbn/crbn.conf | 3 +++ app/boards/shields/crbn/crbn.keymap | 5 +++++ app/boards/shields/crbn/crbn.overlay | 14 ++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/app/boards/shields/crbn/crbn.conf b/app/boards/shields/crbn/crbn.conf index e69de29b..15f65fb1 100644 --- a/app/boards/shields/crbn/crbn.conf +++ b/app/boards/shields/crbn/crbn.conf @@ -0,0 +1,3 @@ +# Uncomment lines below to enable encoder +# CONFIG_EC11=y +# CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y \ No newline at end of file diff --git a/app/boards/shields/crbn/crbn.keymap b/app/boards/shields/crbn/crbn.keymap index 023d3ec1..d9aeaa95 100644 --- a/app/boards/shields/crbn/crbn.keymap +++ b/app/boards/shields/crbn/crbn.keymap @@ -24,6 +24,8 @@ &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 { @@ -33,6 +35,8 @@ &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 >; + + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; }; raise { @@ -43,6 +47,7 @@ &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 diff --git a/app/boards/shields/crbn/crbn.overlay b/app/boards/shields/crbn/crbn.overlay index ebb3a0a3..7520daec 100644 --- a/app/boards/shields/crbn/crbn.overlay +++ b/app/boards/shields/crbn/crbn.overlay @@ -38,4 +38,18 @@ , <&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>; + }; }; From b84d29c384532443010a7140e8670482f2a6ca02 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Mon, 18 Jan 2021 01:09:51 -0500 Subject: [PATCH 30/35] refactor(core): Use /omit-if-no-ref/ for behaviors. * Use lesser-known DT features to skip behaviors not referenced in the user keymap * Update the behaviors to skip code if no nodes found. * Remove some empty config/data structs where unused in behaviors. --- app/dts/behaviors/bluetooth.dtsi | 2 +- app/dts/behaviors/ext_power.dtsi | 2 +- app/dts/behaviors/key_press.dtsi | 2 +- app/dts/behaviors/layer_tap.dtsi | 2 +- app/dts/behaviors/mod_tap.dtsi | 2 +- app/dts/behaviors/momentary_layer.dtsi | 2 +- app/dts/behaviors/none.dtsi | 2 +- app/dts/behaviors/outputs.dtsi | 2 +- app/dts/behaviors/reset.dtsi | 4 ++-- app/dts/behaviors/rgb_underglow.dtsi | 2 +- app/dts/behaviors/sensor_rotate_key_press.dtsi | 2 +- app/dts/behaviors/sticky_key.dtsi | 4 ++-- app/dts/behaviors/to_layer.dtsi | 2 +- app/dts/behaviors/toggle_layer.dtsi | 2 +- app/dts/behaviors/transparent.dtsi | 2 +- app/src/behaviors/behavior_bt.c | 4 ++++ app/src/behaviors/behavior_ext_power.c | 4 ++++ app/src/behaviors/behavior_hold_tap.c | 4 ++-- app/src/behaviors/behavior_none.c | 12 ++++-------- app/src/behaviors/behavior_outputs.c | 4 ++++ app/src/behaviors/behavior_reset.c | 5 ++++- app/src/behaviors/behavior_rgb_underglow.c | 6 +++++- .../behaviors/behavior_sensor_rotate_key_press.c | 6 +++++- app/src/behaviors/behavior_to_layer.c | 4 ++++ app/src/behaviors/behavior_toggle_layer.c | 4 ++++ app/src/behaviors/behavior_transparent.c | 13 +++++-------- 26 files changed, 62 insertions(+), 38 deletions(-) diff --git a/app/dts/behaviors/bluetooth.dtsi b/app/dts/behaviors/bluetooth.dtsi index 9df974b4..1e9cf21b 100644 --- a/app/dts/behaviors/bluetooth.dtsi +++ b/app/dts/behaviors/bluetooth.dtsi @@ -6,7 +6,7 @@ / { behaviors { - bt: behavior_bluetooth { + /omit-if-no-ref/ bt: behavior_bluetooth { compatible = "zmk,behavior-bluetooth"; label = "BLUETOOTH"; #binding-cells = <2>; diff --git a/app/dts/behaviors/ext_power.dtsi b/app/dts/behaviors/ext_power.dtsi index 471e9fa2..742e33ae 100644 --- a/app/dts/behaviors/ext_power.dtsi +++ b/app/dts/behaviors/ext_power.dtsi @@ -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>; diff --git a/app/dts/behaviors/key_press.dtsi b/app/dts/behaviors/key_press.dtsi index 98064f69..59a4e12a 100644 --- a/app/dts/behaviors/key_press.dtsi +++ b/app/dts/behaviors/key_press.dtsi @@ -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>; diff --git a/app/dts/behaviors/layer_tap.dtsi b/app/dts/behaviors/layer_tap.dtsi index cca481a7..b4539b35 100644 --- a/app/dts/behaviors/layer_tap.dtsi +++ b/app/dts/behaviors/layer_tap.dtsi @@ -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>; diff --git a/app/dts/behaviors/mod_tap.dtsi b/app/dts/behaviors/mod_tap.dtsi index b972aba1..79ce10c2 100644 --- a/app/dts/behaviors/mod_tap.dtsi +++ b/app/dts/behaviors/mod_tap.dtsi @@ -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>; diff --git a/app/dts/behaviors/momentary_layer.dtsi b/app/dts/behaviors/momentary_layer.dtsi index d3b21da9..2dbd88d9 100644 --- a/app/dts/behaviors/momentary_layer.dtsi +++ b/app/dts/behaviors/momentary_layer.dtsi @@ -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>; diff --git a/app/dts/behaviors/none.dtsi b/app/dts/behaviors/none.dtsi index 1fe2cff7..790f2d61 100644 --- a/app/dts/behaviors/none.dtsi +++ b/app/dts/behaviors/none.dtsi @@ -6,7 +6,7 @@ / { behaviors { - none: behavior_none { + /omit-if-no-ref/ none: behavior_none { compatible = "zmk,behavior-none"; label = "NONE"; #binding-cells = <0>; diff --git a/app/dts/behaviors/outputs.dtsi b/app/dts/behaviors/outputs.dtsi index ee17e1df..88e8f882 100644 --- a/app/dts/behaviors/outputs.dtsi +++ b/app/dts/behaviors/outputs.dtsi @@ -6,7 +6,7 @@ / { behaviors { - out: behavior_outputs { + /omit-if-no-ref/ out: behavior_outputs { compatible = "zmk,behavior-outputs"; label = "OUTPUTS"; #binding-cells = <1>; diff --git a/app/dts/behaviors/reset.dtsi b/app/dts/behaviors/reset.dtsi index cf363425..c720bc88 100644 --- a/app/dts/behaviors/reset.dtsi +++ b/app/dts/behaviors/reset.dtsi @@ -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 = ; diff --git a/app/dts/behaviors/rgb_underglow.dtsi b/app/dts/behaviors/rgb_underglow.dtsi index 8b88f8c8..60bdb3aa 100644 --- a/app/dts/behaviors/rgb_underglow.dtsi +++ b/app/dts/behaviors/rgb_underglow.dtsi @@ -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>; diff --git a/app/dts/behaviors/sensor_rotate_key_press.dtsi b/app/dts/behaviors/sensor_rotate_key_press.dtsi index 075fc38e..d3f084b0 100644 --- a/app/dts/behaviors/sensor_rotate_key_press.dtsi +++ b/app/dts/behaviors/sensor_rotate_key_press.dtsi @@ -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>; diff --git a/app/dts/behaviors/sticky_key.dtsi b/app/dts/behaviors/sticky_key.dtsi index f1c1cdd5..64032085 100644 --- a/app/dts/behaviors/sticky_key.dtsi +++ b/app/dts/behaviors/sticky_key.dtsi @@ -6,14 +6,14 @@ / { 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>; diff --git a/app/dts/behaviors/to_layer.dtsi b/app/dts/behaviors/to_layer.dtsi index b09616ff..fa8f98bd 100644 --- a/app/dts/behaviors/to_layer.dtsi +++ b/app/dts/behaviors/to_layer.dtsi @@ -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>; diff --git a/app/dts/behaviors/toggle_layer.dtsi b/app/dts/behaviors/toggle_layer.dtsi index 40453962..ea0b1c19 100644 --- a/app/dts/behaviors/toggle_layer.dtsi +++ b/app/dts/behaviors/toggle_layer.dtsi @@ -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>; diff --git a/app/dts/behaviors/transparent.dtsi b/app/dts/behaviors/transparent.dtsi index 09f9ea00..81ebb133 100644 --- a/app/dts/behaviors/transparent.dtsi +++ b/app/dts/behaviors/transparent.dtsi @@ -6,7 +6,7 @@ / { behaviors { - trans: behavior_transparent { + /omit-if-no-ref/ trans: behavior_transparent { compatible = "zmk,behavior-transparent"; label = "TRANS"; #binding-cells = <0>; diff --git a/app/src/behaviors/behavior_bt.c b/app/src/behaviors/behavior_bt.c index 3149c8ce..9a171e0f 100644 --- a/app/src/behaviors/behavior_bt.c +++ b/app/src/behaviors/behavior_bt.c @@ -17,6 +17,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include +#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) */ \ No newline at end of file diff --git a/app/src/behaviors/behavior_ext_power.c b/app/src/behaviors/behavior_ext_power.c index 18520f7d..659cde56 100644 --- a/app/src/behaviors/behavior_ext_power.c +++ b/app/src/behaviors/behavior_ext_power.c @@ -16,6 +16,8 @@ #include 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) */ diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index 8f239dc2..a7185fb0 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -22,7 +22,7 @@ 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 @@ -538,4 +538,4 @@ static struct behavior_hold_tap_data behavior_hold_tap_data; DT_INST_FOREACH_STATUS_OKAY(KP_INST) -#endif \ No newline at end of file +#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ \ No newline at end of file diff --git a/app/src/behaviors/behavior_none.c b/app/src/behaviors/behavior_none.c index e0eaa159..8b6172ff 100644 --- a/app/src/behaviors/behavior_none.c +++ b/app/src/behaviors/behavior_none.c @@ -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); \ No newline at end of file +#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ \ No newline at end of file diff --git a/app/src/behaviors/behavior_outputs.c b/app/src/behaviors/behavior_outputs.c index 3a45b7fd..ccaa7200 100644 --- a/app/src/behaviors/behavior_outputs.c +++ b/app/src/behaviors/behavior_outputs.c @@ -18,6 +18,8 @@ #include 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) */ diff --git a/app/src/behaviors/behavior_reset.c b/app/src/behaviors/behavior_reset.c index e4b720f7..95363512 100644 --- a/app/src/behaviors/behavior_reset.c +++ b/app/src/behaviors/behavior_reset.c @@ -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) \ No newline at end of file +DT_INST_FOREACH_STATUS_OKAY(RST_INST) + +#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_rgb_underglow.c b/app/src/behaviors/behavior_rgb_underglow.c index 07f24940..eb4680e1 100644 --- a/app/src/behaviors/behavior_rgb_underglow.c +++ b/app/src/behaviors/behavior_rgb_underglow.c @@ -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); \ No newline at end of file + &behavior_rgb_underglow_driver_api); + +#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_sensor_rotate_key_press.c b/app/src/behaviors/behavior_sensor_rotate_key_press.c index 67a2e710..589a3a57 100644 --- a/app/src/behaviors/behavior_sensor_rotate_key_press.c +++ b/app/src/behaviors/behavior_sensor_rotate_key_press.c @@ -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) \ No newline at end of file +DT_INST_FOREACH_STATUS_OKAY(KP_INST) + +#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_to_layer.c b/app/src/behaviors/behavior_to_layer.c index bb64026d..e68736ef 100644 --- a/app/src/behaviors/behavior_to_layer.c +++ b/app/src/behaviors/behavior_to_layer.c @@ -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) */ diff --git a/app/src/behaviors/behavior_toggle_layer.c b/app/src/behaviors/behavior_toggle_layer.c index 21daa004..c922634d 100644 --- a/app/src/behaviors/behavior_toggle_layer.c +++ b/app/src/behaviors/behavior_toggle_layer.c @@ -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) */ diff --git a/app/src/behaviors/behavior_transparent.c b/app/src/behaviors/behavior_transparent.c index ca3d279f..e9d49b21 100644 --- a/app/src/behaviors/behavior_transparent.c +++ b/app/src/behaviors/behavior_transparent.c @@ -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); \ No newline at end of file +#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ \ No newline at end of file From 11d990e59a55bf1e834c12cae4542e1ab6af4f20 Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Sat, 14 Nov 2020 20:38:48 +0100 Subject: [PATCH 31/35] setup pre-commit hooks for clang-format and prettier --- .pre-commit-config.yaml | 12 ++++++++++++ CONTRIBUTING.md | 7 +++++++ 2 files changed, 19 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..5974bd66 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3ea8c783..2783c17f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 From 1368a6481e591d6c19ac9f54f44916373d1897d2 Mon Sep 17 00:00:00 2001 From: Jonathan Rascher Date: Sun, 15 Nov 2020 20:04:27 -0600 Subject: [PATCH 32/35] docs: Explain ZMK stays connected to inactive host This behavior was not obvious to me, and I actually considered reporting it as a bug until @Nicell explained to me on Discord that it's WAI. :) --- docs/docs/behaviors/bluetooth.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/docs/behaviors/bluetooth.md b/docs/docs/behaviors/bluetooth.md index f2d1b2f0..5a5ad193 100644 --- a/docs/docs/behaviors/bluetooth.md +++ b/docs/docs/behaviors/bluetooth.md @@ -13,6 +13,10 @@ computer/laptop/keyboard should receive the keyboard input; many of the commands Please note there are only five available Bluetooth profiles by default. If you need to increase the number of available profiles you can set `CONFIG_BT_MAX_CONN` in your `zmk-config` `.conf` file. ::: +:::note Connection Management +As an implementation detail, a ZMK device may show as "connected" on multiple hosts at the same time. This is working as intended, and only the host associated with the active profile will receive keystrokes. +::: + ## Bluetooth Command Defines Bluetooth command defines are provided through the [`dt-bindings/zmk/bt.h`](https://github.com/zmkfirmware/zmk/blob/main/app/include/dt-bindings/zmk/bt.h) header, From ae5056d680c83c007d3a2e4972000e7003802049 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Thu, 4 Feb 2021 07:43:08 -0500 Subject: [PATCH 33/35] Update docs/docs/behaviors/bluetooth.md Co-authored-by: innovaker <66737976+innovaker@users.noreply.github.com> --- docs/docs/behaviors/bluetooth.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/behaviors/bluetooth.md b/docs/docs/behaviors/bluetooth.md index 5a5ad193..df017b05 100644 --- a/docs/docs/behaviors/bluetooth.md +++ b/docs/docs/behaviors/bluetooth.md @@ -14,7 +14,7 @@ Please note there are only five available Bluetooth profiles by default. If you ::: :::note Connection Management -As an implementation detail, a ZMK device may show as "connected" on multiple hosts at the same time. This is working as intended, and only the host associated with the active profile will receive keystrokes. +A ZMK device may show as "connected" on multiple hosts at the same time. This is working as intended, and only the host associated with the active profile will receive keystrokes. ::: ## Bluetooth Command Defines From e40ca1eb7c7bfae09c16344c478b10b0ab22b3f1 Mon Sep 17 00:00:00 2001 From: jrhrsmit Date: Thu, 4 Feb 2021 13:56:27 +0100 Subject: [PATCH 34/35] fix(power): Add support for capacitors on ADC for BVD Add a little delay so any capacitors connected to the ADC for the BVD can charge up when using power_gpios Co-authored-by: Jasper Smit --- .../sensor/battery_voltage_divider/battery_voltage_divider.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/drivers/sensor/battery_voltage_divider/battery_voltage_divider.c b/app/drivers/sensor/battery_voltage_divider/battery_voltage_divider.c index 0618687e..4939461b 100644 --- a/app/drivers/sensor/battery_voltage_divider/battery_voltage_divider.c +++ b/app/drivers/sensor/battery_voltage_divider/battery_voltage_divider.c @@ -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 From 0499e7e8ac8cacb535973e32e6824e5808ee0a16 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Thu, 4 Feb 2021 11:28:02 -0500 Subject: [PATCH 35/35] Refactor nibble / update to match build docs (#620) * feat(nibble): add underglow support for nice_nano builds * feat(nibble): add encoder to top, left most column to match standard assembly documentation * refactor(nibble): add layer labels * feat(nibble): add support for optional display ; off by default * feat(nibble): add README * fix(nibble): adjust oled rotation for easier reading * fix(nibble): add additional note about enabling oled * refactor(nibble): convert keymap to use tabs instead of spaces * refactor(nibble): enable oled in dts/overlay by default * refactor(nibble): cleanup alignment and formatting in nibble keymap * refactor(nibble): re-align top most row of keymap to be sensible * refactor(nibble): cleanup kscan map alignment * refactor(nibble): indent first row of map/transform to properly align with physical columns * fix(nibble): remove dangling code block from readme Co-authored-by: KemoNine --- app/boards/shields/nibble/Kconfig.defconfig | 35 +++++++++++ app/boards/shields/nibble/README.md | 29 ++++++++++ .../shields/nibble/boards/nice_nano.conf | 4 ++ .../shields/nibble/boards/nice_nano.overlay | 34 +++++++++++ .../shields/nibble/boards/proton_c.conf | 1 + app/boards/shields/nibble/nibble.conf | 6 ++ app/boards/shields/nibble/nibble.keymap | 58 +++++++++++-------- app/boards/shields/nibble/nibble.overlay | 39 ++++++++++--- 8 files changed, 175 insertions(+), 31 deletions(-) create mode 100644 app/boards/shields/nibble/README.md create mode 100644 app/boards/shields/nibble/boards/nice_nano.conf create mode 100644 app/boards/shields/nibble/boards/nice_nano.overlay create mode 100644 app/boards/shields/nibble/boards/proton_c.conf diff --git a/app/boards/shields/nibble/Kconfig.defconfig b/app/boards/shields/nibble/Kconfig.defconfig index 01d0bba5..22ef1c69 100644 --- a/app/boards/shields/nibble/Kconfig.defconfig +++ b/app/boards/shields/nibble/Kconfig.defconfig @@ -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 diff --git a/app/boards/shields/nibble/README.md b/app/boards/shields/nibble/README.md new file mode 100644 index 00000000..42646f97 --- /dev/null +++ b/app/boards/shields/nibble/README.md @@ -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 +``` diff --git a/app/boards/shields/nibble/boards/nice_nano.conf b/app/boards/shields/nibble/boards/nice_nano.conf new file mode 100644 index 00000000..14bed3d0 --- /dev/null +++ b/app/boards/shields/nibble/boards/nice_nano.conf @@ -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 \ No newline at end of file diff --git a/app/boards/shields/nibble/boards/nice_nano.overlay b/app/boards/shields/nibble/boards/nice_nano.overlay new file mode 100644 index 00000000..8da95ac1 --- /dev/null +++ b/app/boards/shields/nibble/boards/nice_nano.overlay @@ -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; + }; +}; diff --git a/app/boards/shields/nibble/boards/proton_c.conf b/app/boards/shields/nibble/boards/proton_c.conf new file mode 100644 index 00000000..ab2b50b6 --- /dev/null +++ b/app/boards/shields/nibble/boards/proton_c.conf @@ -0,0 +1 @@ +CONFIG_SENSOR=y \ No newline at end of file diff --git a/app/boards/shields/nibble/nibble.conf b/app/boards/shields/nibble/nibble.conf index e69de29b..4c15b185 100644 --- a/app/boards/shields/nibble/nibble.conf +++ b/app/boards/shields/nibble/nibble.conf @@ -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 diff --git a/app/boards/shields/nibble/nibble.keymap b/app/boards/shields/nibble/nibble.keymap index bc274cd8..23c796ea 100644 --- a/app/boards/shields/nibble/nibble.keymap +++ b/app/boards/shields/nibble/nibble.keymap @@ -8,30 +8,40 @@ #include #include -#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 + >; + }; + }; }; diff --git a/app/boards/shields/nibble/nibble.overlay b/app/boards/shields/nibble/nibble.overlay index 3b672752..3fd3c06c 100644 --- a/app/boards/shields/nibble/nibble.overlay +++ b/app/boards/shields/nibble/nibble.overlay @@ -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>; + }; +};