From 6927abee6ef0c604fae1c8544fc933a56be14e77 Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Sat, 26 Dec 2020 14:49:33 +0100 Subject: [PATCH 01/16] chore(tests): remove useless &cp test --- app/tests/keypress/behavior_keymap.dtsi | 3 ++- app/tests/keypress/cp-press-release/events.patterns | 1 - app/tests/keypress/cp-press-release/keycode_events.snapshot | 2 -- app/tests/keypress/cp-press-release/native_posix.keymap | 5 ----- app/tests/keypress/kp-press-release/native_posix.keymap | 5 ++++- 5 files changed, 6 insertions(+), 10 deletions(-) delete mode 100644 app/tests/keypress/cp-press-release/events.patterns delete mode 100644 app/tests/keypress/cp-press-release/keycode_events.snapshot delete mode 100644 app/tests/keypress/cp-press-release/native_posix.keymap diff --git a/app/tests/keypress/behavior_keymap.dtsi b/app/tests/keypress/behavior_keymap.dtsi index 216e760a..64851a84 100644 --- a/app/tests/keypress/behavior_keymap.dtsi +++ b/app/tests/keypress/behavior_keymap.dtsi @@ -10,7 +10,8 @@ default_layer { bindings = < &kp B &none - &kp C_NEXT &none>; + &none &none + >; }; }; }; diff --git a/app/tests/keypress/cp-press-release/events.patterns b/app/tests/keypress/cp-press-release/events.patterns deleted file mode 100644 index 833100f6..00000000 --- a/app/tests/keypress/cp-press-release/events.patterns +++ /dev/null @@ -1 +0,0 @@ -s/.*hid_listener_keycode_//p \ No newline at end of file diff --git a/app/tests/keypress/cp-press-release/keycode_events.snapshot b/app/tests/keypress/cp-press-release/keycode_events.snapshot deleted file mode 100644 index 95d24a49..00000000 --- a/app/tests/keypress/cp-press-release/keycode_events.snapshot +++ /dev/null @@ -1,2 +0,0 @@ -pressed: usage_page 0x0c keycode 0xb5 mods 0x00 -pressed: usage_page 0x0c keycode 0xb5 mods 0x00 diff --git a/app/tests/keypress/cp-press-release/native_posix.keymap b/app/tests/keypress/cp-press-release/native_posix.keymap deleted file mode 100644 index bf93af7d..00000000 --- a/app/tests/keypress/cp-press-release/native_posix.keymap +++ /dev/null @@ -1,5 +0,0 @@ -#include "../behavior_keymap.dtsi" - -&kscan { - events = ; -}; \ No newline at end of file diff --git a/app/tests/keypress/kp-press-release/native_posix.keymap b/app/tests/keypress/kp-press-release/native_posix.keymap index 279b084d..0ddb7ab6 100644 --- a/app/tests/keypress/kp-press-release/native_posix.keymap +++ b/app/tests/keypress/kp-press-release/native_posix.keymap @@ -1,5 +1,8 @@ #include "../behavior_keymap.dtsi" &kscan { - events = ; + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; }; \ No newline at end of file From 842aa5a842e117b7b00e49258ca0bde44dc0c789 Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Tue, 22 Dec 2020 15:56:00 +0000 Subject: [PATCH 02/16] refactor: replace filename hyphens with underscores Aligns *.h and *.c to underscore naming convention. These were kept (with warnings) for backwards compatibility with external boards/shields: - kscan-mock.h - matrix-transform.h They should be removed in the future. PR: #523 --- app/boards/arm/dz60rgb/dz60rgb_rev1.dts | 2 +- app/boards/native_posix.overlay | 2 +- .../shields/boardsource3x4/boardsource3x4.overlay | 2 +- app/boards/shields/corne/corne.dtsi | 2 +- app/boards/shields/cradio/cradio.dtsi | 2 +- app/boards/shields/crbn/crbn.overlay | 2 +- app/boards/shields/iris/iris.dtsi | 2 +- app/boards/shields/jian/jian.dtsi | 2 +- app/boards/shields/jorne/jorne.dtsi | 2 +- app/boards/shields/kyria/kyria.dtsi | 2 +- app/boards/shields/lily58/lily58.dtsi | 2 +- app/boards/shields/m60/m60.overlay | 2 +- app/boards/shields/microdox/microdox.dtsi | 2 +- app/boards/shields/nibble/nibble.overlay | 2 +- app/boards/shields/qaz/qaz.overlay | 2 +- app/boards/shields/quefrency/quefrency.dtsi | 2 +- app/boards/shields/reviung41/reviung41.overlay | 2 +- app/boards/shields/romac/romac.overlay | 2 +- app/boards/shields/romac_plus/romac_plus.dtsi | 2 +- .../shields/settings_reset/settings_reset.overlay | 2 +- app/boards/shields/sofle/sofle.dtsi | 2 +- app/boards/shields/splitreus62/splitreus62.dtsi | 2 +- app/boards/shields/tg4x/tg4x.overlay | 2 +- app/boards/shields/tidbit/tidbit.dtsi | 2 +- app/drivers/kscan/kscan_mock.c | 2 +- app/include/dt-bindings/zmk/kscan-mock.h | 9 ++------- app/include/dt-bindings/zmk/kscan_mock.h | 14 ++++++++++++++ app/include/dt-bindings/zmk/matrix-transform.h | 5 ++--- app/include/dt-bindings/zmk/matrix_transform.h | 10 ++++++++++ .../zmk/{event-manager.h => event_manager.h} | 0 ...ty-state-changed.h => activity_state_changed.h} | 2 +- ...ery-state-changed.h => battery_state_changed.h} | 2 +- ...file-changed.h => ble_active_profile_changed.h} | 2 +- ...ode-state-changed.h => keycode_state_changed.h} | 2 +- ...layer-state-changed.h => layer_state_changed.h} | 2 +- ...s-state-changed.h => modifiers_state_changed.h} | 2 +- ...on-state-changed.h => position_state_changed.h} | 2 +- .../zmk/events/{sensor-event.h => sensor_event.h} | 2 +- ...nn-state-changed.h => usb_conn_state_changed.h} | 2 +- app/src/activity.c | 8 ++++---- app/src/battery.c | 4 ++-- app/src/behaviors/behavior_hold_tap.c | 8 ++++---- app/src/behaviors/behavior_key_press.c | 4 ++-- .../behaviors/behavior_sensor_rotate_key_press.c | 4 ++-- app/src/behaviors/behavior_sticky_key.c | 8 ++++---- app/src/ble.c | 4 ++-- app/src/display/main.c | 4 ++-- app/src/display/widgets/battery_status.c | 6 +++--- app/src/display/widgets/output_status.c | 6 +++--- app/src/endpoints.c | 6 +++--- app/src/event_manager.c | 2 +- app/src/events/activity_state_changed.c | 2 +- app/src/events/battery_state_changed.c | 2 +- app/src/events/ble_active_profile_changed.c | 2 +- app/src/events/keycode_state_changed.c | 2 +- app/src/events/layer_state_changed.c | 2 +- app/src/events/modifiers_state_changed.c | 2 +- app/src/events/position_state_changed.c | 2 +- app/src/events/sensor_event.c | 2 +- app/src/events/usb_conn_state_changed.c | 2 +- app/src/hid_listener.c | 6 +++--- app/src/keymap.c | 8 ++++---- app/src/kscan.c | 4 ++-- app/src/matrix_transform.c | 2 +- app/src/sensors.c | 4 ++-- app/src/split/bluetooth/central.c | 4 ++-- app/src/split_listener.c | 4 ++-- app/src/usb.c | 4 ++-- .../hold-tap/balanced/1-dn-up/native_posix.keymap | 2 +- .../balanced/2-dn-timer-up/native_posix.keymap | 2 +- .../3a-moddn-dn-modup-up/native_posix.keymap | 2 +- .../3b-moddn-dn-modup-timer-up/native_posix.keymap | 2 +- .../3c-kcdn-dn-kcup-up/native_posix.keymap | 2 +- .../3d-kcdn-dn-kcup-timer-up/native_posix.keymap | 2 +- .../4a-dn-htdn-timer-htup-up/native_posix.keymap | 2 +- .../4a-dn-kcdn-timer-kcup-up/native_posix.keymap | 2 +- .../4b-dn-kcdn-kcup-timer-up/native_posix.keymap | 2 +- .../4c-dn-kcdn-kcup-up/native_posix.keymap | 2 +- .../4d-dn-kcdn-timer-up-kcup/native_posix.keymap | 2 +- app/tests/hold-tap/balanced/behavior_keymap.dtsi | 2 +- .../balanced/many-nested/native_posix.keymap | 2 +- .../hold-preferred/1-dn-up/native_posix.keymap | 2 +- .../2-dn-timer-up/native_posix.keymap | 2 +- .../3a-moddn-dn-modup-up/native_posix.keymap | 2 +- .../3b-moddn-dn-modup-timer-up/native_posix.keymap | 2 +- .../3c-kcdn-dn-kcup-up/native_posix.keymap | 2 +- .../3d-kcdn-dn-kcup-timer-up/native_posix.keymap | 2 +- .../4a-dn-htdn-timer-htup-up/native_posix.keymap | 2 +- .../4a-dn-kcdn-timer-kcup-up/native_posix.keymap | 2 +- .../4b-dn-kcdn-kcup-timer-up/native_posix.keymap | 2 +- .../4c-dn-kcdn-kcup-up/native_posix.keymap | 2 +- .../4d-dn-kcdn-timer-up-kcup/native_posix.keymap | 2 +- .../hold-tap/hold-preferred/behavior_keymap.dtsi | 2 +- .../tap-preferred/1-dn-up/native_posix.keymap | 2 +- .../2-dn-timer-up/native_posix.keymap | 2 +- .../3a-moddn-dn-modup-up/native_posix.keymap | 2 +- .../3b-moddn-dn-modup-timer-up/native_posix.keymap | 2 +- .../3c-kcdn-dn-kcup-up/native_posix.keymap | 2 +- .../3d-kcdn-dn-kcup-timer-up/native_posix.keymap | 2 +- .../4a-dn-htdn-timer-htup-up/native_posix.keymap | 2 +- .../4a-dn-kcdn-timer-kcup-up/native_posix.keymap | 2 +- .../4b-dn-kcdn-kcup-timer-up/native_posix.keymap | 2 +- .../4c-dn-kcdn-kcup-up/native_posix.keymap | 2 +- .../4d-dn-kcdn-timer-up-kcup/native_posix.keymap | 2 +- .../hold-tap/tap-preferred/behavior_keymap.dtsi | 2 +- app/tests/keypress/behavior_keymap.dtsi | 2 +- .../native_posix.keymap | 2 +- .../kp-lctl-dn-lctl-up/native_posix.keymap | 2 +- .../native_posix.keymap | 2 +- .../native_posix.keymap | 2 +- .../native_posix.keymap | 2 +- .../native_posix.keymap | 2 +- .../native_posix.keymap | 2 +- .../native_posix.keymap | 2 +- .../momentary-layer/1-normal/native_posix.keymap | 2 +- .../2-early-key-release/native_posix.keymap | 2 +- .../momentary-layer/3-covered/native_posix.keymap | 2 +- .../momentary-layer/4-nested/native_posix.keymap | 2 +- .../5-nested-early-key-release/native_posix.keymap | 2 +- app/tests/momentary-layer/behavior_keymap.dtsi | 2 +- app/tests/none/behavior_keymap.dtsi | 2 +- app/tests/none/layered/native_posix.keymap | 2 +- app/tests/none/normal/native_posix.keymap | 2 +- .../sticky-keys/1-os-dn-up/native_posix.keymap | 2 +- .../2-os-dn-up-kcdn-kcup/native_posix.keymap | 2 +- .../3a-os-dn-kcdn-kcup-up/native_posix.keymap | 2 +- .../3b-os-dn-kcdn-up-kcup/native_posix.keymap | 2 +- .../4-os-dn-up-kcdn-timer-kcup/native_posix.keymap | 2 +- .../5-os-kcdn-dn-kcup-up/native_posix.keymap | 2 +- .../native_posix.keymap | 2 +- .../8-lsk-osk-combination/native_posix.keymap | 2 +- .../9-sk-dn-up-dn-up/native_posix.keymap | 2 +- app/tests/sticky-keys/behavior_keymap.dtsi | 2 +- app/tests/toggle-layer/behavior_keymap.dtsi | 2 +- .../early-key-release/native_posix.keymap | 2 +- app/tests/toggle-layer/normal/native_posix.keymap | 2 +- app/tests/transparent/behavior_keymap.dtsi | 2 +- app/tests/transparent/layered/native_posix.keymap | 2 +- app/tests/transparent/normal/native_posix.keymap | 2 +- docs/docs/development/new-shield.md | 6 +++--- 140 files changed, 195 insertions(+), 177 deletions(-) create mode 100644 app/include/dt-bindings/zmk/kscan_mock.h create mode 100644 app/include/dt-bindings/zmk/matrix_transform.h rename app/include/zmk/{event-manager.h => event_manager.h} (100%) rename app/include/zmk/events/{activity-state-changed.h => activity_state_changed.h} (94%) rename app/include/zmk/events/{battery-state-changed.h => battery_state_changed.h} (90%) rename app/include/zmk/events/{ble-active-profile-changed.h => ble_active_profile_changed.h} (91%) rename app/include/zmk/events/{keycode-state-changed.h => keycode_state_changed.h} (97%) rename app/include/zmk/events/{layer-state-changed.h => layer_state_changed.h} (94%) rename app/include/zmk/events/{modifiers-state-changed.h => modifiers_state_changed.h} (95%) rename app/include/zmk/events/{position-state-changed.h => position_state_changed.h} (90%) rename app/include/zmk/events/{sensor-event.h => sensor_event.h} (91%) rename app/include/zmk/events/{usb-conn-state-changed.h => usb_conn_state_changed.h} (91%) diff --git a/app/boards/arm/dz60rgb/dz60rgb_rev1.dts b/app/boards/arm/dz60rgb/dz60rgb_rev1.dts index 85c4ca56..1e2755d8 100644 --- a/app/boards/arm/dz60rgb/dz60rgb_rev1.dts +++ b/app/boards/arm/dz60rgb/dz60rgb_rev1.dts @@ -7,7 +7,7 @@ /dts-v1/; #include -#include +#include / { model = "DZ60RGB, Rev 1"; diff --git a/app/boards/native_posix.overlay b/app/boards/native_posix.overlay index bbb23b65..2c1ed79d 100644 --- a/app/boards/native_posix.overlay +++ b/app/boards/native_posix.overlay @@ -1,6 +1,6 @@ #include #include -#include +#include / { chosen { diff --git a/app/boards/shields/boardsource3x4/boardsource3x4.overlay b/app/boards/shields/boardsource3x4/boardsource3x4.overlay index ad517940..0b8f8498 100644 --- a/app/boards/shields/boardsource3x4/boardsource3x4.overlay +++ b/app/boards/shields/boardsource3x4/boardsource3x4.overlay @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/corne/corne.dtsi b/app/boards/shields/corne/corne.dtsi index 4360aea7..bb37d67a 100644 --- a/app/boards/shields/corne/corne.dtsi +++ b/app/boards/shields/corne/corne.dtsi @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/cradio/cradio.dtsi b/app/boards/shields/cradio/cradio.dtsi index 43f90493..a99a8e58 100644 --- a/app/boards/shields/cradio/cradio.dtsi +++ b/app/boards/shields/cradio/cradio.dtsi @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ - #include + #include / { chosen { diff --git a/app/boards/shields/crbn/crbn.overlay b/app/boards/shields/crbn/crbn.overlay index 137e685e..0f7cd45b 100644 --- a/app/boards/shields/crbn/crbn.overlay +++ b/app/boards/shields/crbn/crbn.overlay @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/iris/iris.dtsi b/app/boards/shields/iris/iris.dtsi index 9ea1dd68..eb065736 100644 --- a/app/boards/shields/iris/iris.dtsi +++ b/app/boards/shields/iris/iris.dtsi @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/jian/jian.dtsi b/app/boards/shields/jian/jian.dtsi index 331624ea..88bac831 100644 --- a/app/boards/shields/jian/jian.dtsi +++ b/app/boards/shields/jian/jian.dtsi @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/jorne/jorne.dtsi b/app/boards/shields/jorne/jorne.dtsi index 7e6cfd8b..67ea9d1c 100644 --- a/app/boards/shields/jorne/jorne.dtsi +++ b/app/boards/shields/jorne/jorne.dtsi @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/kyria/kyria.dtsi b/app/boards/shields/kyria/kyria.dtsi index bbead846..c0bec79b 100644 --- a/app/boards/shields/kyria/kyria.dtsi +++ b/app/boards/shields/kyria/kyria.dtsi @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/lily58/lily58.dtsi b/app/boards/shields/lily58/lily58.dtsi index eb69fa75..db54cf4d 100644 --- a/app/boards/shields/lily58/lily58.dtsi +++ b/app/boards/shields/lily58/lily58.dtsi @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/m60/m60.overlay b/app/boards/shields/m60/m60.overlay index 0824f1c6..18d06511 100644 --- a/app/boards/shields/m60/m60.overlay +++ b/app/boards/shields/m60/m60.overlay @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/microdox/microdox.dtsi b/app/boards/shields/microdox/microdox.dtsi index 55c67dd3..ee2114d7 100644 --- a/app/boards/shields/microdox/microdox.dtsi +++ b/app/boards/shields/microdox/microdox.dtsi @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/nibble/nibble.overlay b/app/boards/shields/nibble/nibble.overlay index 7975c3cd..fd1b2f61 100644 --- a/app/boards/shields/nibble/nibble.overlay +++ b/app/boards/shields/nibble/nibble.overlay @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/qaz/qaz.overlay b/app/boards/shields/qaz/qaz.overlay index 4e733707..205f7c26 100644 --- a/app/boards/shields/qaz/qaz.overlay +++ b/app/boards/shields/qaz/qaz.overlay @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/quefrency/quefrency.dtsi b/app/boards/shields/quefrency/quefrency.dtsi index 5f1e9086..411d3658 100644 --- a/app/boards/shields/quefrency/quefrency.dtsi +++ b/app/boards/shields/quefrency/quefrency.dtsi @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/reviung41/reviung41.overlay b/app/boards/shields/reviung41/reviung41.overlay index 06270ca1..5336853b 100644 --- a/app/boards/shields/reviung41/reviung41.overlay +++ b/app/boards/shields/reviung41/reviung41.overlay @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/romac/romac.overlay b/app/boards/shields/romac/romac.overlay index f6b0f726..e0880d3f 100644 --- a/app/boards/shields/romac/romac.overlay +++ b/app/boards/shields/romac/romac.overlay @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/romac_plus/romac_plus.dtsi b/app/boards/shields/romac_plus/romac_plus.dtsi index 9b148ca0..48f73412 100644 --- a/app/boards/shields/romac_plus/romac_plus.dtsi +++ b/app/boards/shields/romac_plus/romac_plus.dtsi @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/settings_reset/settings_reset.overlay b/app/boards/shields/settings_reset/settings_reset.overlay index a2b5799b..7a6629f8 100644 --- a/app/boards/shields/settings_reset/settings_reset.overlay +++ b/app/boards/shields/settings_reset/settings_reset.overlay @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/sofle/sofle.dtsi b/app/boards/shields/sofle/sofle.dtsi index b4edb5f6..9c55fc3c 100644 --- a/app/boards/shields/sofle/sofle.dtsi +++ b/app/boards/shields/sofle/sofle.dtsi @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/splitreus62/splitreus62.dtsi b/app/boards/shields/splitreus62/splitreus62.dtsi index c2bfbc40..d88d06cb 100644 --- a/app/boards/shields/splitreus62/splitreus62.dtsi +++ b/app/boards/shields/splitreus62/splitreus62.dtsi @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/tg4x/tg4x.overlay b/app/boards/shields/tg4x/tg4x.overlay index 10ce524a..4b9d4f5b 100644 --- a/app/boards/shields/tg4x/tg4x.overlay +++ b/app/boards/shields/tg4x/tg4x.overlay @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { chosen { diff --git a/app/boards/shields/tidbit/tidbit.dtsi b/app/boards/shields/tidbit/tidbit.dtsi index 7a2b3de0..004de310 100644 --- a/app/boards/shields/tidbit/tidbit.dtsi +++ b/app/boards/shields/tidbit/tidbit.dtsi @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include / { kscan0: kscan { diff --git a/app/drivers/kscan/kscan_mock.c b/app/drivers/kscan/kscan_mock.c index 8b40ab44..fc0c9c5f 100644 --- a/app/drivers/kscan/kscan_mock.c +++ b/app/drivers/kscan/kscan_mock.c @@ -13,7 +13,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); -#include +#include struct kscan_mock_data { kscan_callback_t callback; diff --git a/app/include/dt-bindings/zmk/kscan-mock.h b/app/include/dt-bindings/zmk/kscan-mock.h index eff218b2..4ed666c6 100644 --- a/app/include/dt-bindings/zmk/kscan-mock.h +++ b/app/include/dt-bindings/zmk/kscan-mock.h @@ -4,11 +4,6 @@ * SPDX-License-Identifier: MIT */ -#pragma once +#warning "kscan-mock.h has been deprecated and superseded by kscan_mock.h" -#define ZMK_MOCK_IS_PRESS(v) ((v & (0x01 << 31)) != 0) -#define ZMK_MOCK_PRESS(row, col, msec) (row + (col << 8) + (msec << 16) + (0x01 << 31)) -#define ZMK_MOCK_RELEASE(row, col, msec) (row + (col << 8) + (msec << 16)) -#define ZMK_MOCK_ROW(v) (v & 0xFF) -#define ZMK_MOCK_COL(v) ((v >> 8) & 0xFF) -#define ZMK_MOCK_MSEC(v) ((v & ~(0x01 << 31)) >> 16) +#include "kscan_mock.h" \ No newline at end of file diff --git a/app/include/dt-bindings/zmk/kscan_mock.h b/app/include/dt-bindings/zmk/kscan_mock.h new file mode 100644 index 00000000..eff218b2 --- /dev/null +++ b/app/include/dt-bindings/zmk/kscan_mock.h @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#pragma once + +#define ZMK_MOCK_IS_PRESS(v) ((v & (0x01 << 31)) != 0) +#define ZMK_MOCK_PRESS(row, col, msec) (row + (col << 8) + (msec << 16) + (0x01 << 31)) +#define ZMK_MOCK_RELEASE(row, col, msec) (row + (col << 8) + (msec << 16)) +#define ZMK_MOCK_ROW(v) (v & 0xFF) +#define ZMK_MOCK_COL(v) ((v >> 8) & 0xFF) +#define ZMK_MOCK_MSEC(v) ((v & ~(0x01 << 31)) >> 16) diff --git a/app/include/dt-bindings/zmk/matrix-transform.h b/app/include/dt-bindings/zmk/matrix-transform.h index 2989cb60..223b1429 100644 --- a/app/include/dt-bindings/zmk/matrix-transform.h +++ b/app/include/dt-bindings/zmk/matrix-transform.h @@ -4,7 +4,6 @@ * SPDX-License-Identifier: MIT */ -#define KT_ROW(item) (item >> 8) -#define KT_COL(item) (item & 0xFF) +#warning "matrix-transform.h has been deprecated and superseded by matrix_transform.h" -#define RC(row, col) (((row) << 8) + (col)) \ No newline at end of file +#include "matrix_transform.h" \ No newline at end of file diff --git a/app/include/dt-bindings/zmk/matrix_transform.h b/app/include/dt-bindings/zmk/matrix_transform.h new file mode 100644 index 00000000..2989cb60 --- /dev/null +++ b/app/include/dt-bindings/zmk/matrix_transform.h @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#define KT_ROW(item) (item >> 8) +#define KT_COL(item) (item & 0xFF) + +#define RC(row, col) (((row) << 8) + (col)) \ No newline at end of file diff --git a/app/include/zmk/event-manager.h b/app/include/zmk/event_manager.h similarity index 100% rename from app/include/zmk/event-manager.h rename to app/include/zmk/event_manager.h diff --git a/app/include/zmk/events/activity-state-changed.h b/app/include/zmk/events/activity_state_changed.h similarity index 94% rename from app/include/zmk/events/activity-state-changed.h rename to app/include/zmk/events/activity_state_changed.h index cd4c618c..511fbad6 100644 --- a/app/include/zmk/events/activity-state-changed.h +++ b/app/include/zmk/events/activity_state_changed.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include #include struct activity_state_changed { diff --git a/app/include/zmk/events/battery-state-changed.h b/app/include/zmk/events/battery_state_changed.h similarity index 90% rename from app/include/zmk/events/battery-state-changed.h rename to app/include/zmk/events/battery_state_changed.h index a983820b..47e44ba1 100644 --- a/app/include/zmk/events/battery-state-changed.h +++ b/app/include/zmk/events/battery_state_changed.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include struct battery_state_changed { struct zmk_event_header header; diff --git a/app/include/zmk/events/ble-active-profile-changed.h b/app/include/zmk/events/ble_active_profile_changed.h similarity index 91% rename from app/include/zmk/events/ble-active-profile-changed.h rename to app/include/zmk/events/ble_active_profile_changed.h index 4491dfc5..fa161266 100644 --- a/app/include/zmk/events/ble-active-profile-changed.h +++ b/app/include/zmk/events/ble_active_profile_changed.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include #include #include diff --git a/app/include/zmk/events/keycode-state-changed.h b/app/include/zmk/events/keycode_state_changed.h similarity index 97% rename from app/include/zmk/events/keycode-state-changed.h rename to app/include/zmk/events/keycode_state_changed.h index 7dc87e21..28282b6b 100644 --- a/app/include/zmk/events/keycode-state-changed.h +++ b/app/include/zmk/events/keycode_state_changed.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include struct keycode_state_changed { diff --git a/app/include/zmk/events/layer-state-changed.h b/app/include/zmk/events/layer_state_changed.h similarity index 94% rename from app/include/zmk/events/layer-state-changed.h rename to app/include/zmk/events/layer_state_changed.h index 352c6025..cf240025 100644 --- a/app/include/zmk/events/layer-state-changed.h +++ b/app/include/zmk/events/layer_state_changed.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include struct layer_state_changed { struct zmk_event_header header; diff --git a/app/include/zmk/events/modifiers-state-changed.h b/app/include/zmk/events/modifiers_state_changed.h similarity index 95% rename from app/include/zmk/events/modifiers-state-changed.h rename to app/include/zmk/events/modifiers_state_changed.h index d2e02f82..c4daede0 100644 --- a/app/include/zmk/events/modifiers-state-changed.h +++ b/app/include/zmk/events/modifiers_state_changed.h @@ -8,7 +8,7 @@ #include #include -#include +#include struct modifiers_state_changed { struct zmk_event_header header; diff --git a/app/include/zmk/events/position-state-changed.h b/app/include/zmk/events/position_state_changed.h similarity index 90% rename from app/include/zmk/events/position-state-changed.h rename to app/include/zmk/events/position_state_changed.h index 7058276e..0f1ac1b2 100644 --- a/app/include/zmk/events/position-state-changed.h +++ b/app/include/zmk/events/position_state_changed.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include struct position_state_changed { struct zmk_event_header header; diff --git a/app/include/zmk/events/sensor-event.h b/app/include/zmk/events/sensor_event.h similarity index 91% rename from app/include/zmk/events/sensor-event.h rename to app/include/zmk/events/sensor_event.h index 0bd3ccf0..14fb2d3d 100644 --- a/app/include/zmk/events/sensor-event.h +++ b/app/include/zmk/events/sensor_event.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include #include struct sensor_event { diff --git a/app/include/zmk/events/usb-conn-state-changed.h b/app/include/zmk/events/usb_conn_state_changed.h similarity index 91% rename from app/include/zmk/events/usb-conn-state-changed.h rename to app/include/zmk/events/usb_conn_state_changed.h index d6cc6985..b38fb9fe 100644 --- a/app/include/zmk/events/usb-conn-state-changed.h +++ b/app/include/zmk/events/usb_conn_state_changed.h @@ -9,7 +9,7 @@ #include #include -#include +#include #include struct usb_conn_state_changed { diff --git a/app/src/activity.c b/app/src/activity.c index c441fa92..8fe912a3 100644 --- a/app/src/activity.c +++ b/app/src/activity.c @@ -12,10 +12,10 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); -#include -#include -#include -#include +#include +#include +#include +#include #include diff --git a/app/src/battery.c b/app/src/battery.c index 7a09ad7a..917af9cf 100644 --- a/app/src/battery.c +++ b/app/src/battery.c @@ -14,8 +14,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); -#include -#include +#include +#include const struct device *battery; diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index 556273ec..d3039605 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -14,10 +14,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); diff --git a/app/src/behaviors/behavior_key_press.c b/app/src/behaviors/behavior_key_press.c index aa19ca96..df0828ac 100644 --- a/app/src/behaviors/behavior_key_press.c +++ b/app/src/behaviors/behavior_key_press.c @@ -10,8 +10,8 @@ #include #include -#include -#include +#include +#include #include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); diff --git a/app/src/behaviors/behavior_sensor_rotate_key_press.c b/app/src/behaviors/behavior_sensor_rotate_key_press.c index a0e0accc..1e659a15 100644 --- a/app/src/behaviors/behavior_sensor_rotate_key_press.c +++ b/app/src/behaviors/behavior_sensor_rotate_key_press.c @@ -11,8 +11,8 @@ #include #include -#include -#include +#include +#include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); diff --git a/app/src/behaviors/behavior_sticky_key.c b/app/src/behaviors/behavior_sticky_key.c index 4695c7ab..643ae48b 100644 --- a/app/src/behaviors/behavior_sticky_key.c +++ b/app/src/behaviors/behavior_sticky_key.c @@ -13,10 +13,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); diff --git a/app/src/ble.c b/app/src/ble.c index 9cfef4b8..4d422877 100644 --- a/app/src/ble.c +++ b/app/src/ble.c @@ -32,8 +32,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include #include -#include -#include +#include +#include static struct bt_conn *auth_passkey_entry_conn; static uint8_t passkey_entries[6] = {0, 0, 0, 0, 0, 0}; diff --git a/app/src/display/main.c b/app/src/display/main.c index ea1e21ab..0bef6567 100644 --- a/app/src/display/main.c +++ b/app/src/display/main.c @@ -14,8 +14,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include -#include -#include +#include +#include #include #define ZMK_DISPLAY_NAME CONFIG_LVGL_DISPLAY_DEV_NAME diff --git a/app/src/display/widgets/battery_status.c b/app/src/display/widgets/battery_status.c index b412da2b..346c5193 100644 --- a/app/src/display/widgets/battery_status.c +++ b/app/src/display/widgets/battery_status.c @@ -11,9 +11,9 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include -#include -#include -#include +#include +#include +#include static sys_slist_t widgets = SYS_SLIST_STATIC_INIT(&widgets); static lv_style_t label_style; diff --git a/app/src/display/widgets/output_status.c b/app/src/display/widgets/output_status.c index 143c7781..9a725113 100644 --- a/app/src/display/widgets/output_status.c +++ b/app/src/display/widgets/output_status.c @@ -10,9 +10,9 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/app/src/endpoints.c b/app/src/endpoints.c index b126f335..9f32f197 100644 --- a/app/src/endpoints.c +++ b/app/src/endpoints.c @@ -13,9 +13,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); diff --git a/app/src/event_manager.c b/app/src/event_manager.c index 8c454e9e..872f5c86 100644 --- a/app/src/event_manager.c +++ b/app/src/event_manager.c @@ -9,7 +9,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); -#include +#include extern struct zmk_event_type *__event_type_start[]; extern struct zmk_event_type *__event_type_end[]; diff --git a/app/src/events/activity_state_changed.c b/app/src/events/activity_state_changed.c index 47aefea1..001e6a1a 100644 --- a/app/src/events/activity_state_changed.c +++ b/app/src/events/activity_state_changed.c @@ -5,6 +5,6 @@ */ #include -#include +#include ZMK_EVENT_IMPL(activity_state_changed); \ No newline at end of file diff --git a/app/src/events/battery_state_changed.c b/app/src/events/battery_state_changed.c index 4b937e34..ed6147a0 100644 --- a/app/src/events/battery_state_changed.c +++ b/app/src/events/battery_state_changed.c @@ -5,6 +5,6 @@ */ #include -#include +#include ZMK_EVENT_IMPL(battery_state_changed); \ No newline at end of file diff --git a/app/src/events/ble_active_profile_changed.c b/app/src/events/ble_active_profile_changed.c index 06988e23..e2d172fd 100644 --- a/app/src/events/ble_active_profile_changed.c +++ b/app/src/events/ble_active_profile_changed.c @@ -5,6 +5,6 @@ */ #include -#include +#include ZMK_EVENT_IMPL(ble_active_profile_changed); \ No newline at end of file diff --git a/app/src/events/keycode_state_changed.c b/app/src/events/keycode_state_changed.c index 9a1984a3..d46126be 100644 --- a/app/src/events/keycode_state_changed.c +++ b/app/src/events/keycode_state_changed.c @@ -5,6 +5,6 @@ */ #include -#include +#include ZMK_EVENT_IMPL(keycode_state_changed); diff --git a/app/src/events/layer_state_changed.c b/app/src/events/layer_state_changed.c index e4567115..e7f8039c 100644 --- a/app/src/events/layer_state_changed.c +++ b/app/src/events/layer_state_changed.c @@ -5,6 +5,6 @@ */ #include -#include +#include ZMK_EVENT_IMPL(layer_state_changed); \ No newline at end of file diff --git a/app/src/events/modifiers_state_changed.c b/app/src/events/modifiers_state_changed.c index 8becd02f..4143796e 100644 --- a/app/src/events/modifiers_state_changed.c +++ b/app/src/events/modifiers_state_changed.c @@ -5,6 +5,6 @@ */ #include -#include +#include ZMK_EVENT_IMPL(modifiers_state_changed); \ No newline at end of file diff --git a/app/src/events/position_state_changed.c b/app/src/events/position_state_changed.c index f8f1a268..b80314b9 100644 --- a/app/src/events/position_state_changed.c +++ b/app/src/events/position_state_changed.c @@ -5,6 +5,6 @@ */ #include -#include +#include ZMK_EVENT_IMPL(position_state_changed); \ No newline at end of file diff --git a/app/src/events/sensor_event.c b/app/src/events/sensor_event.c index c6b80cd6..6811e7dd 100644 --- a/app/src/events/sensor_event.c +++ b/app/src/events/sensor_event.c @@ -5,6 +5,6 @@ */ #include -#include +#include ZMK_EVENT_IMPL(sensor_event); \ No newline at end of file diff --git a/app/src/events/usb_conn_state_changed.c b/app/src/events/usb_conn_state_changed.c index d845f6d7..c299da7a 100644 --- a/app/src/events/usb_conn_state_changed.c +++ b/app/src/events/usb_conn_state_changed.c @@ -5,6 +5,6 @@ */ #include -#include +#include ZMK_EVENT_IMPL(usb_conn_state_changed); \ No newline at end of file diff --git a/app/src/hid_listener.c b/app/src/hid_listener.c index 534831cc..cf8835a2 100644 --- a/app/src/hid_listener.c +++ b/app/src/hid_listener.c @@ -9,9 +9,9 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/app/src/keymap.c b/app/src/keymap.c index cab6d474..cafe2ffe 100644 --- a/app/src/keymap.c +++ b/app/src/keymap.c @@ -14,10 +14,10 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include -#include -#include -#include -#include +#include +#include +#include +#include static zmk_keymap_layers_state _zmk_keymap_layer_state = 0; static uint8_t _zmk_keymap_layer_default = 0; diff --git a/app/src/kscan.c b/app/src/kscan.c index c22d71b4..6b84490a 100644 --- a/app/src/kscan.c +++ b/app/src/kscan.c @@ -12,8 +12,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include -#include -#include +#include +#include #define ZMK_KSCAN_EVENT_STATE_PRESSED 0 #define ZMK_KSCAN_EVENT_STATE_RELEASED 1 diff --git a/app/src/matrix_transform.c b/app/src/matrix_transform.c index 33be93d3..8f54f312 100644 --- a/app/src/matrix_transform.c +++ b/app/src/matrix_transform.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #ifdef ZMK_KEYMAP_TRANSFORM_NODE diff --git a/app/src/sensors.c b/app/src/sensors.c index 5b4f683b..5e9ef150 100644 --- a/app/src/sensors.c +++ b/app/src/sensors.c @@ -13,8 +13,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include -#include -#include +#include +#include #if ZMK_KEYMAP_HAS_SENSORS diff --git a/app/src/split/bluetooth/central.c b/app/src/split/bluetooth/central.c index c41894f2..5ad83ad2 100644 --- a/app/src/split/bluetooth/central.c +++ b/app/src/split/bluetooth/central.c @@ -19,8 +19,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include -#include -#include +#include +#include #include static int start_scan(void); diff --git a/app/src/split_listener.c b/app/src/split_listener.c index b2adfb2e..153ed99d 100644 --- a/app/src/split_listener.c +++ b/app/src/split_listener.c @@ -14,8 +14,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); -#include -#include +#include +#include #include #include diff --git a/app/src/usb.c b/app/src/usb.c index 2b3de782..7900acef 100644 --- a/app/src/usb.c +++ b/app/src/usb.c @@ -12,8 +12,8 @@ #include #include -#include -#include +#include +#include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); diff --git a/app/tests/hold-tap/balanced/1-dn-up/native_posix.keymap b/app/tests/hold-tap/balanced/1-dn-up/native_posix.keymap index 10336ef3..040cdd3e 100644 --- a/app/tests/hold-tap/balanced/1-dn-up/native_posix.keymap +++ b/app/tests/hold-tap/balanced/1-dn-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/balanced/2-dn-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced/2-dn-timer-up/native_posix.keymap index aa93b862..11d033f4 100644 --- a/app/tests/hold-tap/balanced/2-dn-timer-up/native_posix.keymap +++ b/app/tests/hold-tap/balanced/2-dn-timer-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/balanced/3a-moddn-dn-modup-up/native_posix.keymap b/app/tests/hold-tap/balanced/3a-moddn-dn-modup-up/native_posix.keymap index 6f08689b..abb31b4b 100644 --- a/app/tests/hold-tap/balanced/3a-moddn-dn-modup-up/native_posix.keymap +++ b/app/tests/hold-tap/balanced/3a-moddn-dn-modup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/balanced/3b-moddn-dn-modup-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced/3b-moddn-dn-modup-timer-up/native_posix.keymap index 392d328b..38575e9a 100644 --- a/app/tests/hold-tap/balanced/3b-moddn-dn-modup-timer-up/native_posix.keymap +++ b/app/tests/hold-tap/balanced/3b-moddn-dn-modup-timer-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/balanced/3c-kcdn-dn-kcup-up/native_posix.keymap b/app/tests/hold-tap/balanced/3c-kcdn-dn-kcup-up/native_posix.keymap index 77306cd0..21baa447 100644 --- a/app/tests/hold-tap/balanced/3c-kcdn-dn-kcup-up/native_posix.keymap +++ b/app/tests/hold-tap/balanced/3c-kcdn-dn-kcup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/balanced/3d-kcdn-dn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced/3d-kcdn-dn-kcup-timer-up/native_posix.keymap index 14413311..cd7ff384 100644 --- a/app/tests/hold-tap/balanced/3d-kcdn-dn-kcup-timer-up/native_posix.keymap +++ b/app/tests/hold-tap/balanced/3d-kcdn-dn-kcup-timer-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/balanced/4a-dn-htdn-timer-htup-up/native_posix.keymap b/app/tests/hold-tap/balanced/4a-dn-htdn-timer-htup-up/native_posix.keymap index c10c6d64..b84aa626 100644 --- a/app/tests/hold-tap/balanced/4a-dn-htdn-timer-htup-up/native_posix.keymap +++ b/app/tests/hold-tap/balanced/4a-dn-htdn-timer-htup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/balanced/4a-dn-kcdn-timer-kcup-up/native_posix.keymap b/app/tests/hold-tap/balanced/4a-dn-kcdn-timer-kcup-up/native_posix.keymap index ce163f53..bdfaf9d3 100644 --- a/app/tests/hold-tap/balanced/4a-dn-kcdn-timer-kcup-up/native_posix.keymap +++ b/app/tests/hold-tap/balanced/4a-dn-kcdn-timer-kcup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/balanced/4b-dn-kcdn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/balanced/4b-dn-kcdn-kcup-timer-up/native_posix.keymap index 7abda41a..c0fd1bd1 100644 --- a/app/tests/hold-tap/balanced/4b-dn-kcdn-kcup-timer-up/native_posix.keymap +++ b/app/tests/hold-tap/balanced/4b-dn-kcdn-kcup-timer-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/balanced/4c-dn-kcdn-kcup-up/native_posix.keymap b/app/tests/hold-tap/balanced/4c-dn-kcdn-kcup-up/native_posix.keymap index ce030af3..69c19676 100644 --- a/app/tests/hold-tap/balanced/4c-dn-kcdn-kcup-up/native_posix.keymap +++ b/app/tests/hold-tap/balanced/4c-dn-kcdn-kcup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/balanced/4d-dn-kcdn-timer-up-kcup/native_posix.keymap b/app/tests/hold-tap/balanced/4d-dn-kcdn-timer-up-kcup/native_posix.keymap index 54676600..301ef0ac 100644 --- a/app/tests/hold-tap/balanced/4d-dn-kcdn-timer-up-kcup/native_posix.keymap +++ b/app/tests/hold-tap/balanced/4d-dn-kcdn-timer-up-kcup/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/balanced/behavior_keymap.dtsi b/app/tests/hold-tap/balanced/behavior_keymap.dtsi index 7d18bb6e..34a4d458 100644 --- a/app/tests/hold-tap/balanced/behavior_keymap.dtsi +++ b/app/tests/hold-tap/balanced/behavior_keymap.dtsi @@ -1,6 +1,6 @@ #include #include -#include +#include / { behaviors { diff --git a/app/tests/hold-tap/balanced/many-nested/native_posix.keymap b/app/tests/hold-tap/balanced/many-nested/native_posix.keymap index f51ffb56..7941e4d3 100644 --- a/app/tests/hold-tap/balanced/many-nested/native_posix.keymap +++ b/app/tests/hold-tap/balanced/many-nested/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include / { behaviors { diff --git a/app/tests/hold-tap/hold-preferred/1-dn-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred/1-dn-up/native_posix.keymap index 10336ef3..040cdd3e 100644 --- a/app/tests/hold-tap/hold-preferred/1-dn-up/native_posix.keymap +++ b/app/tests/hold-tap/hold-preferred/1-dn-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/hold-preferred/2-dn-timer-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred/2-dn-timer-up/native_posix.keymap index aa93b862..11d033f4 100644 --- a/app/tests/hold-tap/hold-preferred/2-dn-timer-up/native_posix.keymap +++ b/app/tests/hold-tap/hold-preferred/2-dn-timer-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/hold-preferred/3a-moddn-dn-modup-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred/3a-moddn-dn-modup-up/native_posix.keymap index 6f08689b..abb31b4b 100644 --- a/app/tests/hold-tap/hold-preferred/3a-moddn-dn-modup-up/native_posix.keymap +++ b/app/tests/hold-tap/hold-preferred/3a-moddn-dn-modup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/hold-preferred/3b-moddn-dn-modup-timer-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred/3b-moddn-dn-modup-timer-up/native_posix.keymap index 392d328b..38575e9a 100644 --- a/app/tests/hold-tap/hold-preferred/3b-moddn-dn-modup-timer-up/native_posix.keymap +++ b/app/tests/hold-tap/hold-preferred/3b-moddn-dn-modup-timer-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/hold-preferred/3c-kcdn-dn-kcup-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred/3c-kcdn-dn-kcup-up/native_posix.keymap index 77306cd0..21baa447 100644 --- a/app/tests/hold-tap/hold-preferred/3c-kcdn-dn-kcup-up/native_posix.keymap +++ b/app/tests/hold-tap/hold-preferred/3c-kcdn-dn-kcup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/hold-preferred/3d-kcdn-dn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred/3d-kcdn-dn-kcup-timer-up/native_posix.keymap index 14413311..cd7ff384 100644 --- a/app/tests/hold-tap/hold-preferred/3d-kcdn-dn-kcup-timer-up/native_posix.keymap +++ b/app/tests/hold-tap/hold-preferred/3d-kcdn-dn-kcup-timer-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/hold-preferred/4a-dn-htdn-timer-htup-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred/4a-dn-htdn-timer-htup-up/native_posix.keymap index c10c6d64..b84aa626 100644 --- a/app/tests/hold-tap/hold-preferred/4a-dn-htdn-timer-htup-up/native_posix.keymap +++ b/app/tests/hold-tap/hold-preferred/4a-dn-htdn-timer-htup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/hold-preferred/4a-dn-kcdn-timer-kcup-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred/4a-dn-kcdn-timer-kcup-up/native_posix.keymap index ce163f53..bdfaf9d3 100644 --- a/app/tests/hold-tap/hold-preferred/4a-dn-kcdn-timer-kcup-up/native_posix.keymap +++ b/app/tests/hold-tap/hold-preferred/4a-dn-kcdn-timer-kcup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/hold-preferred/4b-dn-kcdn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred/4b-dn-kcdn-kcup-timer-up/native_posix.keymap index 7abda41a..c0fd1bd1 100644 --- a/app/tests/hold-tap/hold-preferred/4b-dn-kcdn-kcup-timer-up/native_posix.keymap +++ b/app/tests/hold-tap/hold-preferred/4b-dn-kcdn-kcup-timer-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/hold-preferred/4c-dn-kcdn-kcup-up/native_posix.keymap b/app/tests/hold-tap/hold-preferred/4c-dn-kcdn-kcup-up/native_posix.keymap index ce030af3..69c19676 100644 --- a/app/tests/hold-tap/hold-preferred/4c-dn-kcdn-kcup-up/native_posix.keymap +++ b/app/tests/hold-tap/hold-preferred/4c-dn-kcdn-kcup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/hold-preferred/4d-dn-kcdn-timer-up-kcup/native_posix.keymap b/app/tests/hold-tap/hold-preferred/4d-dn-kcdn-timer-up-kcup/native_posix.keymap index 54676600..301ef0ac 100644 --- a/app/tests/hold-tap/hold-preferred/4d-dn-kcdn-timer-up-kcup/native_posix.keymap +++ b/app/tests/hold-tap/hold-preferred/4d-dn-kcdn-timer-up-kcup/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/hold-preferred/behavior_keymap.dtsi b/app/tests/hold-tap/hold-preferred/behavior_keymap.dtsi index 64847a57..e6143195 100644 --- a/app/tests/hold-tap/hold-preferred/behavior_keymap.dtsi +++ b/app/tests/hold-tap/hold-preferred/behavior_keymap.dtsi @@ -1,6 +1,6 @@ #include #include -#include +#include diff --git a/app/tests/hold-tap/tap-preferred/1-dn-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred/1-dn-up/native_posix.keymap index 10336ef3..040cdd3e 100644 --- a/app/tests/hold-tap/tap-preferred/1-dn-up/native_posix.keymap +++ b/app/tests/hold-tap/tap-preferred/1-dn-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/tap-preferred/2-dn-timer-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred/2-dn-timer-up/native_posix.keymap index aa93b862..11d033f4 100644 --- a/app/tests/hold-tap/tap-preferred/2-dn-timer-up/native_posix.keymap +++ b/app/tests/hold-tap/tap-preferred/2-dn-timer-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/tap-preferred/3a-moddn-dn-modup-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred/3a-moddn-dn-modup-up/native_posix.keymap index 6f08689b..abb31b4b 100644 --- a/app/tests/hold-tap/tap-preferred/3a-moddn-dn-modup-up/native_posix.keymap +++ b/app/tests/hold-tap/tap-preferred/3a-moddn-dn-modup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/tap-preferred/3b-moddn-dn-modup-timer-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred/3b-moddn-dn-modup-timer-up/native_posix.keymap index 392d328b..38575e9a 100644 --- a/app/tests/hold-tap/tap-preferred/3b-moddn-dn-modup-timer-up/native_posix.keymap +++ b/app/tests/hold-tap/tap-preferred/3b-moddn-dn-modup-timer-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/tap-preferred/3c-kcdn-dn-kcup-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred/3c-kcdn-dn-kcup-up/native_posix.keymap index 77306cd0..21baa447 100644 --- a/app/tests/hold-tap/tap-preferred/3c-kcdn-dn-kcup-up/native_posix.keymap +++ b/app/tests/hold-tap/tap-preferred/3c-kcdn-dn-kcup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/tap-preferred/3d-kcdn-dn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred/3d-kcdn-dn-kcup-timer-up/native_posix.keymap index 14413311..cd7ff384 100644 --- a/app/tests/hold-tap/tap-preferred/3d-kcdn-dn-kcup-timer-up/native_posix.keymap +++ b/app/tests/hold-tap/tap-preferred/3d-kcdn-dn-kcup-timer-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/tap-preferred/4a-dn-htdn-timer-htup-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred/4a-dn-htdn-timer-htup-up/native_posix.keymap index c10c6d64..b84aa626 100644 --- a/app/tests/hold-tap/tap-preferred/4a-dn-htdn-timer-htup-up/native_posix.keymap +++ b/app/tests/hold-tap/tap-preferred/4a-dn-htdn-timer-htup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/tap-preferred/4a-dn-kcdn-timer-kcup-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred/4a-dn-kcdn-timer-kcup-up/native_posix.keymap index ce163f53..bdfaf9d3 100644 --- a/app/tests/hold-tap/tap-preferred/4a-dn-kcdn-timer-kcup-up/native_posix.keymap +++ b/app/tests/hold-tap/tap-preferred/4a-dn-kcdn-timer-kcup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/tap-preferred/4b-dn-kcdn-kcup-timer-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred/4b-dn-kcdn-kcup-timer-up/native_posix.keymap index 7abda41a..c0fd1bd1 100644 --- a/app/tests/hold-tap/tap-preferred/4b-dn-kcdn-kcup-timer-up/native_posix.keymap +++ b/app/tests/hold-tap/tap-preferred/4b-dn-kcdn-kcup-timer-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/tap-preferred/4c-dn-kcdn-kcup-up/native_posix.keymap b/app/tests/hold-tap/tap-preferred/4c-dn-kcdn-kcup-up/native_posix.keymap index ce030af3..69c19676 100644 --- a/app/tests/hold-tap/tap-preferred/4c-dn-kcdn-kcup-up/native_posix.keymap +++ b/app/tests/hold-tap/tap-preferred/4c-dn-kcdn-kcup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/tap-preferred/4d-dn-kcdn-timer-up-kcup/native_posix.keymap b/app/tests/hold-tap/tap-preferred/4d-dn-kcdn-timer-up-kcup/native_posix.keymap index 54676600..301ef0ac 100644 --- a/app/tests/hold-tap/tap-preferred/4d-dn-kcdn-timer-up-kcup/native_posix.keymap +++ b/app/tests/hold-tap/tap-preferred/4d-dn-kcdn-timer-up-kcup/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/hold-tap/tap-preferred/behavior_keymap.dtsi b/app/tests/hold-tap/tap-preferred/behavior_keymap.dtsi index 6e91466d..e6d33c0b 100644 --- a/app/tests/hold-tap/tap-preferred/behavior_keymap.dtsi +++ b/app/tests/hold-tap/tap-preferred/behavior_keymap.dtsi @@ -1,6 +1,6 @@ #include #include -#include +#include / { behaviors { diff --git a/app/tests/keypress/behavior_keymap.dtsi b/app/tests/keypress/behavior_keymap.dtsi index 64851a84..f0c5d0c2 100644 --- a/app/tests/keypress/behavior_keymap.dtsi +++ b/app/tests/keypress/behavior_keymap.dtsi @@ -1,6 +1,6 @@ #include #include -#include +#include / { keymap { diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/native_posix.keymap b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/native_posix.keymap index 1f3502d6..26af5657 100644 --- a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/native_posix.keymap +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include &kscan { diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/native_posix.keymap b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/native_posix.keymap index 9c7d7c83..9df2c152 100644 --- a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/native_posix.keymap +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include &kscan { diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/native_posix.keymap b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/native_posix.keymap index 34bb522b..5f9375fb 100644 --- a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/native_posix.keymap +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include &kscan { diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/native_posix.keymap b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/native_posix.keymap index 68e4de73..1b175d44 100644 --- a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/native_posix.keymap +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include &kscan { diff --git a/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/native_posix.keymap b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/native_posix.keymap index 73fa7cc8..0e9a2d6a 100644 --- a/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/native_posix.keymap +++ b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include &kscan { diff --git a/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/native_posix.keymap b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/native_posix.keymap index 109d60e5..10d0dbf8 100644 --- a/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/native_posix.keymap +++ b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include &kscan { diff --git a/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/native_posix.keymap b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/native_posix.keymap index 09816d94..3d6494dd 100644 --- a/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/native_posix.keymap +++ b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include &kscan { diff --git a/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/native_posix.keymap b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/native_posix.keymap index 1de00a0e..d5f372f1 100644 --- a/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/native_posix.keymap +++ b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include &kscan { diff --git a/app/tests/momentary-layer/1-normal/native_posix.keymap b/app/tests/momentary-layer/1-normal/native_posix.keymap index 2fc24d2b..b5249f7b 100644 --- a/app/tests/momentary-layer/1-normal/native_posix.keymap +++ b/app/tests/momentary-layer/1-normal/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" / { diff --git a/app/tests/momentary-layer/2-early-key-release/native_posix.keymap b/app/tests/momentary-layer/2-early-key-release/native_posix.keymap index 9ffa5f6e..96e4e8d9 100644 --- a/app/tests/momentary-layer/2-early-key-release/native_posix.keymap +++ b/app/tests/momentary-layer/2-early-key-release/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" / { diff --git a/app/tests/momentary-layer/3-covered/native_posix.keymap b/app/tests/momentary-layer/3-covered/native_posix.keymap index 2484d8b8..2dde6d88 100644 --- a/app/tests/momentary-layer/3-covered/native_posix.keymap +++ b/app/tests/momentary-layer/3-covered/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include /* this test verifies that the correct key is released when a layer is enabled "on top" diff --git a/app/tests/momentary-layer/4-nested/native_posix.keymap b/app/tests/momentary-layer/4-nested/native_posix.keymap index 0eb77d20..fd376d00 100644 --- a/app/tests/momentary-layer/4-nested/native_posix.keymap +++ b/app/tests/momentary-layer/4-nested/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include / { keymap { diff --git a/app/tests/momentary-layer/5-nested-early-key-release/native_posix.keymap b/app/tests/momentary-layer/5-nested-early-key-release/native_posix.keymap index a67035bf..c467aea3 100644 --- a/app/tests/momentary-layer/5-nested-early-key-release/native_posix.keymap +++ b/app/tests/momentary-layer/5-nested-early-key-release/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include / { keymap { diff --git a/app/tests/momentary-layer/behavior_keymap.dtsi b/app/tests/momentary-layer/behavior_keymap.dtsi index a5b6c12b..40bc31ec 100644 --- a/app/tests/momentary-layer/behavior_keymap.dtsi +++ b/app/tests/momentary-layer/behavior_keymap.dtsi @@ -1,6 +1,6 @@ #include #include -#include +#include / { keymap { diff --git a/app/tests/none/behavior_keymap.dtsi b/app/tests/none/behavior_keymap.dtsi index 0a4f7cb7..40d863c1 100644 --- a/app/tests/none/behavior_keymap.dtsi +++ b/app/tests/none/behavior_keymap.dtsi @@ -1,6 +1,6 @@ #include #include -#include +#include / { keymap { diff --git a/app/tests/none/layered/native_posix.keymap b/app/tests/none/layered/native_posix.keymap index 59ea4811..597ca2db 100644 --- a/app/tests/none/layered/native_posix.keymap +++ b/app/tests/none/layered/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/none/normal/native_posix.keymap b/app/tests/none/normal/native_posix.keymap index 94d7539c..cbeb61dc 100644 --- a/app/tests/none/normal/native_posix.keymap +++ b/app/tests/none/normal/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/sticky-keys/1-os-dn-up/native_posix.keymap b/app/tests/sticky-keys/1-os-dn-up/native_posix.keymap index dd2e6ea5..d0f26b2f 100644 --- a/app/tests/sticky-keys/1-os-dn-up/native_posix.keymap +++ b/app/tests/sticky-keys/1-os-dn-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap index c96eb9f9..2d078ba5 100644 --- a/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap +++ b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/native_posix.keymap b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/native_posix.keymap index 3c33908f..438880d5 100644 --- a/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/native_posix.keymap +++ b/app/tests/sticky-keys/3a-os-dn-kcdn-kcup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/native_posix.keymap b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/native_posix.keymap index e9290a31..067f2379 100644 --- a/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/native_posix.keymap +++ b/app/tests/sticky-keys/3b-os-dn-kcdn-up-kcup/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/native_posix.keymap b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/native_posix.keymap index 84daad69..d58641bd 100644 --- a/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/native_posix.keymap +++ b/app/tests/sticky-keys/4-os-dn-up-kcdn-timer-kcup/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/native_posix.keymap b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/native_posix.keymap index 71a0a1bb..aac6725e 100644 --- a/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/native_posix.keymap +++ b/app/tests/sticky-keys/5-os-kcdn-dn-kcup-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/native_posix.keymap b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/native_posix.keymap index 7a9901bf..66bb72d8 100644 --- a/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/native_posix.keymap +++ b/app/tests/sticky-keys/7-os-dn-up-kc1dn-kc2dn-kc1up-kc2up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { 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 45cef501..beedd44e 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 @@ -1,6 +1,6 @@ #include #include -#include +#include / { keymap { diff --git a/app/tests/sticky-keys/9-sk-dn-up-dn-up/native_posix.keymap b/app/tests/sticky-keys/9-sk-dn-up-dn-up/native_posix.keymap index 2fcc3ff6..d4c30fbf 100644 --- a/app/tests/sticky-keys/9-sk-dn-up-dn-up/native_posix.keymap +++ b/app/tests/sticky-keys/9-sk-dn-up-dn-up/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include / { keymap { diff --git a/app/tests/sticky-keys/behavior_keymap.dtsi b/app/tests/sticky-keys/behavior_keymap.dtsi index ae463966..f1277009 100644 --- a/app/tests/sticky-keys/behavior_keymap.dtsi +++ b/app/tests/sticky-keys/behavior_keymap.dtsi @@ -1,6 +1,6 @@ #include #include -#include +#include / { keymap { diff --git a/app/tests/toggle-layer/behavior_keymap.dtsi b/app/tests/toggle-layer/behavior_keymap.dtsi index 2523d867..b9c0d4a4 100644 --- a/app/tests/toggle-layer/behavior_keymap.dtsi +++ b/app/tests/toggle-layer/behavior_keymap.dtsi @@ -1,6 +1,6 @@ #include #include -#include +#include / { keymap { diff --git a/app/tests/toggle-layer/early-key-release/native_posix.keymap b/app/tests/toggle-layer/early-key-release/native_posix.keymap index 6b2b8f20..6c293390 100644 --- a/app/tests/toggle-layer/early-key-release/native_posix.keymap +++ b/app/tests/toggle-layer/early-key-release/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/toggle-layer/normal/native_posix.keymap b/app/tests/toggle-layer/normal/native_posix.keymap index 202c105c..9df9d649 100644 --- a/app/tests/toggle-layer/normal/native_posix.keymap +++ b/app/tests/toggle-layer/normal/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/transparent/behavior_keymap.dtsi b/app/tests/transparent/behavior_keymap.dtsi index d6c5e27f..2a7e783a 100644 --- a/app/tests/transparent/behavior_keymap.dtsi +++ b/app/tests/transparent/behavior_keymap.dtsi @@ -1,6 +1,6 @@ #include #include -#include +#include / { keymap { diff --git a/app/tests/transparent/layered/native_posix.keymap b/app/tests/transparent/layered/native_posix.keymap index 59ea4811..597ca2db 100644 --- a/app/tests/transparent/layered/native_posix.keymap +++ b/app/tests/transparent/layered/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/app/tests/transparent/normal/native_posix.keymap b/app/tests/transparent/normal/native_posix.keymap index 94d7539c..cbeb61dc 100644 --- a/app/tests/transparent/normal/native_posix.keymap +++ b/app/tests/transparent/normal/native_posix.keymap @@ -1,6 +1,6 @@ #include #include -#include +#include #include "../behavior_keymap.dtsi" &kscan { diff --git a/docs/docs/development/new-shield.md b/docs/docs/development/new-shield.md index 306f1b3f..18f8b420 100644 --- a/docs/docs/development/new-shield.md +++ b/docs/docs/development/new-shield.md @@ -163,7 +163,7 @@ It is preferred to define only the `col-gpios` or `row-gpios` in the common shie For `col2row` directed boards like the iris, the shared .dtsi file may look like this: ``` -#include +#include / { chosen { @@ -315,7 +315,7 @@ Whenever that default key position mapping is insufficient, the `.o Here is an example for the [nice60](https://github.com/Nicell/nice60), which uses an efficient 8x8 GPIO matrix, and uses a transform: ``` -#include +#include / { chosen { @@ -344,7 +344,7 @@ RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7 Some important things to note: -- The `#include ` is critical. The `RC` macro is used to generate the internal storage in the matrix transform, and is actually replaced by a C preprocessor before the final devicetree is compiled into ZMK. +- The `#include ` is critical. The `RC` macro is used to generate the internal storage in the matrix transform, and is actually replaced by a C preprocessor before the final devicetree is compiled into ZMK. - `RC(row, column)` is placed sequentially to define what row and column values that position corresponds to. - If you have a keyboard with options for `2u` keys in certain positions, or break away portions, it is a good idea to set the chosen `zmk,matrix_transform` to the default arrangement, and include _other_ possible matrix transform nodes in the devicetree that users can select in their user config by overriding the chosen node. From 4db5b169bff1f3de5353324baef5724be4f9a6a5 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Sat, 12 Dec 2020 23:13:49 -0500 Subject: [PATCH 03/16] refactor(splits): Ability to override split role. * Move central/peripheral setting to Kconfig.defconfig files to allow left/right .conf files to override central/peripheral role for splits. --- app/CMakeLists.txt | 12 ++++++--- app/Kconfig | 15 ++--------- app/boards/shields/corne/Kconfig.defconfig | 7 +++--- app/boards/shields/corne/corne_left.conf | 2 -- app/boards/shields/corne/corne_right.conf | 2 -- app/boards/shields/cradio/Kconfig.defconfig | 10 ++++++++ app/boards/shields/cradio/cradio_left.conf | 3 --- app/boards/shields/cradio/cradio_right.conf | 2 -- app/boards/shields/iris/Kconfig.defconfig | 10 ++++++++ app/boards/shields/iris/iris_left.conf | 2 -- app/boards/shields/iris/iris_right.conf | 2 -- app/boards/shields/jian/Kconfig.defconfig | 4 ++- app/boards/shields/jian/jian_left.conf | 2 -- app/boards/shields/jian/jian_right.conf | 2 -- app/boards/shields/jorne/Kconfig.defconfig | 3 +++ app/boards/shields/jorne/jorne_left.conf | 2 -- app/boards/shields/jorne/jorne_right.conf | 2 -- app/boards/shields/kyria/Kconfig.defconfig | 3 +++ app/boards/shields/kyria/kyria_left.conf | 2 -- app/boards/shields/kyria/kyria_right.conf | 2 -- app/boards/shields/lily58/Kconfig.defconfig | 7 ++++++ app/boards/shields/lily58/lily58_left.conf | 3 --- app/boards/shields/lily58/lily58_right.conf | 3 +-- app/boards/shields/microdox/Kconfig.defconfig | 3 +++ .../shields/microdox/microdox_left.conf | 2 -- .../shields/microdox/microdox_right.conf | 2 -- .../shields/quefrency/Kconfig.defconfig | 10 ++++++++ .../shields/quefrency/quefrency_left.conf | 2 -- .../shields/quefrency/quefrency_right.conf | 2 -- app/boards/shields/sofle/Kconfig.defconfig | 7 ++++++ app/boards/shields/sofle/sofle_left.conf | 3 --- app/boards/shields/sofle/sofle_right.conf | 3 --- .../shields/splitreus62/Kconfig.defconfig | 6 +++++ .../shields/splitreus62/splitreus62_left.conf | 2 -- .../splitreus62/splitreus62_right.conf | 2 -- app/src/ble.c | 25 +++++++++++-------- 36 files changed, 92 insertions(+), 79 deletions(-) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 5174576b..9e0612de 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -39,7 +39,7 @@ target_sources(app PRIVATE src/events/sensor_event.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/ble_active_profile_changed.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/battery_state_changed.c) target_sources_ifdef(CONFIG_USB app PRIVATE src/events/usb_conn_state_changed.c) -if (NOT CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) +if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL) target_sources(app PRIVATE src/behaviors/behavior_key_press.c) target_sources(app PRIVATE src/behaviors/behavior_reset.c) target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c) @@ -57,9 +57,13 @@ target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/behaviors/behavior target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/behaviors/behavior_bt.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/ble.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/battery.c) -target_sources_ifdef(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL app PRIVATE src/split_listener.c) -target_sources_ifdef(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL app PRIVATE src/split/bluetooth/service.c) -target_sources_ifdef(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL app PRIVATE src/split/bluetooth/central.c) +if (CONFIG_ZMK_SPLIT_BLE AND (NOT CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)) + target_sources(app PRIVATE src/split_listener.c) + target_sources(app PRIVATE src/split/bluetooth/service.c) +endif() +if (CONFIG_ZMK_SPLIT_BLE AND CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL) + target_sources(app PRIVATE src/split/bluetooth/central.c) +endif() target_sources_ifdef(CONFIG_USB app PRIVATE src/usb.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/hog.c) target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/rgb_underglow.c) diff --git a/app/Kconfig b/app/Kconfig index ec043bfe..acb288cb 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -83,7 +83,6 @@ menu "Split Support" config ZMK_SPLIT bool "Split keyboard support" - default n if ZMK_SPLIT @@ -95,19 +94,12 @@ config ZMK_SPLIT_BLE if ZMK_SPLIT_BLE -choice ZMK_SPLIT_BLE_ROLE - bool "BLE Role For Split Communication" - default ZMK_SPLIT_BLE_ROLE_CENTRAL - config ZMK_SPLIT_BLE_ROLE_CENTRAL bool "Central" select BT_CENTRAL select BT_GATT_CLIENT -config ZMK_SPLIT_BLE_ROLE_PERIPHERAL - bool "Peripheral" - -if ZMK_SPLIT_BLE_ROLE_PERIPHERAL +if !ZMK_SPLIT_BLE_ROLE_CENTRAL config ZMK_USB default n @@ -121,12 +113,9 @@ config BT_MAX_CONN config BT_GAP_AUTO_UPDATE_CONN_PARAMS default n -#ZMK_SPLIT_BLE_ROLE_PERIPHERAL +#!ZMK_SPLIT_BLE_ROLE_CENTRAL endif -#ZMK_SPLIT_BLE_ROLE -endchoice - #ZMK_SPLIT_BLE endif diff --git a/app/boards/shields/corne/Kconfig.defconfig b/app/boards/shields/corne/Kconfig.defconfig index 0355c776..9e33e089 100644 --- a/app/boards/shields/corne/Kconfig.defconfig +++ b/app/boards/shields/corne/Kconfig.defconfig @@ -1,12 +1,13 @@ - if SHIELD_CORNE_LEFT config ZMK_KEYBOARD_NAME - default "Corne Left" + default "Corne" + +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y endif - if SHIELD_CORNE_RIGHT config ZMK_KEYBOARD_NAME diff --git a/app/boards/shields/corne/corne_left.conf b/app/boards/shields/corne/corne_left.conf index 1e028a78..e69de29b 100644 --- a/app/boards/shields/corne/corne_left.conf +++ b/app/boards/shields/corne/corne_left.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y diff --git a/app/boards/shields/corne/corne_right.conf b/app/boards/shields/corne/corne_right.conf index 990cf7c0..e69de29b 100644 --- a/app/boards/shields/corne/corne_right.conf +++ b/app/boards/shields/corne/corne_right.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y diff --git a/app/boards/shields/cradio/Kconfig.defconfig b/app/boards/shields/cradio/Kconfig.defconfig index 81246baf..5e826bf0 100644 --- a/app/boards/shields/cradio/Kconfig.defconfig +++ b/app/boards/shields/cradio/Kconfig.defconfig @@ -6,6 +6,9 @@ if SHIELD_CRADIO_LEFT config ZMK_KEYBOARD_NAME default "cradio left" +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + endif if SHIELD_CRADIO_RIGHT @@ -14,3 +17,10 @@ config ZMK_KEYBOARD_NAME default "cradio right" endif + +if SHIELD_CRADIO_LEFT || SHIELD_CRADIO_RIGHT + +config ZMK_SPLIT + default y + +endif \ No newline at end of file diff --git a/app/boards/shields/cradio/cradio_left.conf b/app/boards/shields/cradio/cradio_left.conf index 405f04db..c9f7988a 100644 --- a/app/boards/shields/cradio/cradio_left.conf +++ b/app/boards/shields/cradio/cradio_left.conf @@ -1,5 +1,2 @@ # Copyright (c) 2020 The ZMK Contributors # SPDX-License-Identifier: MIT - -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y diff --git a/app/boards/shields/cradio/cradio_right.conf b/app/boards/shields/cradio/cradio_right.conf index bd2c93bf..80a6177e 100644 --- a/app/boards/shields/cradio/cradio_right.conf +++ b/app/boards/shields/cradio/cradio_right.conf @@ -1,5 +1,3 @@ # Copyright (c) 2020 The ZMK Contributors # SPDX-License-Identifier: MIT -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y diff --git a/app/boards/shields/iris/Kconfig.defconfig b/app/boards/shields/iris/Kconfig.defconfig index 6439780c..57b8c1ee 100644 --- a/app/boards/shields/iris/Kconfig.defconfig +++ b/app/boards/shields/iris/Kconfig.defconfig @@ -6,6 +6,9 @@ if SHIELD_IRIS_LEFT config ZMK_KEYBOARD_NAME default "Iris Left" +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + endif if SHIELD_IRIS_RIGHT @@ -14,3 +17,10 @@ config ZMK_KEYBOARD_NAME default "Iris Right" endif + +if SHIELD_IRIS_LEFT || SHIELD_IRIS_RIGHT + +config ZMK_SPLIT + default y + +endif \ No newline at end of file diff --git a/app/boards/shields/iris/iris_left.conf b/app/boards/shields/iris/iris_left.conf index 1e028a78..e69de29b 100644 --- a/app/boards/shields/iris/iris_left.conf +++ b/app/boards/shields/iris/iris_left.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y diff --git a/app/boards/shields/iris/iris_right.conf b/app/boards/shields/iris/iris_right.conf index 990cf7c0..e69de29b 100644 --- a/app/boards/shields/iris/iris_right.conf +++ b/app/boards/shields/iris/iris_right.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y diff --git a/app/boards/shields/jian/Kconfig.defconfig b/app/boards/shields/jian/Kconfig.defconfig index b743e7a4..9e1da623 100644 --- a/app/boards/shields/jian/Kconfig.defconfig +++ b/app/boards/shields/jian/Kconfig.defconfig @@ -4,6 +4,9 @@ if SHIELD_JIAN_LEFT config ZMK_KEYBOARD_NAME default "Jian Left" +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + endif @@ -18,6 +21,5 @@ if SHIELD_JIAN_LEFT || SHIELD_JIAN_RIGHT config ZMK_SPLIT default y - endif diff --git a/app/boards/shields/jian/jian_left.conf b/app/boards/shields/jian/jian_left.conf index 1e028a78..e69de29b 100644 --- a/app/boards/shields/jian/jian_left.conf +++ b/app/boards/shields/jian/jian_left.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y diff --git a/app/boards/shields/jian/jian_right.conf b/app/boards/shields/jian/jian_right.conf index 990cf7c0..e69de29b 100644 --- a/app/boards/shields/jian/jian_right.conf +++ b/app/boards/shields/jian/jian_right.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y diff --git a/app/boards/shields/jorne/Kconfig.defconfig b/app/boards/shields/jorne/Kconfig.defconfig index c0df54bb..5b0e0b95 100644 --- a/app/boards/shields/jorne/Kconfig.defconfig +++ b/app/boards/shields/jorne/Kconfig.defconfig @@ -4,6 +4,9 @@ if SHIELD_JORNE_LEFT config ZMK_KEYBOARD_NAME default "Jorne Left" +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + endif diff --git a/app/boards/shields/jorne/jorne_left.conf b/app/boards/shields/jorne/jorne_left.conf index 1e028a78..e69de29b 100644 --- a/app/boards/shields/jorne/jorne_left.conf +++ b/app/boards/shields/jorne/jorne_left.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y diff --git a/app/boards/shields/jorne/jorne_right.conf b/app/boards/shields/jorne/jorne_right.conf index 990cf7c0..e69de29b 100644 --- a/app/boards/shields/jorne/jorne_right.conf +++ b/app/boards/shields/jorne/jorne_right.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y diff --git a/app/boards/shields/kyria/Kconfig.defconfig b/app/boards/shields/kyria/Kconfig.defconfig index 8d5fe811..99e47bfe 100644 --- a/app/boards/shields/kyria/Kconfig.defconfig +++ b/app/boards/shields/kyria/Kconfig.defconfig @@ -4,6 +4,9 @@ if SHIELD_KYRIA_LEFT config ZMK_KEYBOARD_NAME default "Kyria Left" +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + endif diff --git a/app/boards/shields/kyria/kyria_left.conf b/app/boards/shields/kyria/kyria_left.conf index e51dee44..e69de29b 100644 --- a/app/boards/shields/kyria/kyria_left.conf +++ b/app/boards/shields/kyria/kyria_left.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y \ No newline at end of file diff --git a/app/boards/shields/kyria/kyria_right.conf b/app/boards/shields/kyria/kyria_right.conf index 990cf7c0..e69de29b 100644 --- a/app/boards/shields/kyria/kyria_right.conf +++ b/app/boards/shields/kyria/kyria_right.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y diff --git a/app/boards/shields/lily58/Kconfig.defconfig b/app/boards/shields/lily58/Kconfig.defconfig index 81feefde..915cc70e 100644 --- a/app/boards/shields/lily58/Kconfig.defconfig +++ b/app/boards/shields/lily58/Kconfig.defconfig @@ -4,6 +4,9 @@ if SHIELD_LILY58_LEFT config ZMK_KEYBOARD_NAME default "Lily58 Left" +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + endif if SHIELD_LILY58_RIGHT @@ -15,6 +18,9 @@ endif if SHIELD_LILY58_LEFT || SHIELD_LILY58_RIGHT +config ZMK_SPLIT + default y + if ZMK_DISPLAY config I2C @@ -52,3 +58,4 @@ endchoice endif # LVGL endif + diff --git a/app/boards/shields/lily58/lily58_left.conf b/app/boards/shields/lily58/lily58_left.conf index 6ff95d54..24f8d779 100644 --- a/app/boards/shields/lily58/lily58_left.conf +++ b/app/boards/shields/lily58/lily58_left.conf @@ -1,6 +1,3 @@ # Uncomment to enable encoder # CONFIG_EC11=y # CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y - -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y \ No newline at end of file diff --git a/app/boards/shields/lily58/lily58_right.conf b/app/boards/shields/lily58/lily58_right.conf index 990cf7c0..8b137891 100644 --- a/app/boards/shields/lily58/lily58_right.conf +++ b/app/boards/shields/lily58/lily58_right.conf @@ -1,2 +1 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y + diff --git a/app/boards/shields/microdox/Kconfig.defconfig b/app/boards/shields/microdox/Kconfig.defconfig index 3f8b7481..be39c9f8 100644 --- a/app/boards/shields/microdox/Kconfig.defconfig +++ b/app/boards/shields/microdox/Kconfig.defconfig @@ -6,6 +6,9 @@ if SHIELD_MICRODOX_LEFT config ZMK_KEYBOARD_NAME default "Microdox Left" +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + endif diff --git a/app/boards/shields/microdox/microdox_left.conf b/app/boards/shields/microdox/microdox_left.conf index 1e028a78..e69de29b 100644 --- a/app/boards/shields/microdox/microdox_left.conf +++ b/app/boards/shields/microdox/microdox_left.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y diff --git a/app/boards/shields/microdox/microdox_right.conf b/app/boards/shields/microdox/microdox_right.conf index 990cf7c0..e69de29b 100644 --- a/app/boards/shields/microdox/microdox_right.conf +++ b/app/boards/shields/microdox/microdox_right.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y diff --git a/app/boards/shields/quefrency/Kconfig.defconfig b/app/boards/shields/quefrency/Kconfig.defconfig index 2b00cb62..9c7e8b13 100644 --- a/app/boards/shields/quefrency/Kconfig.defconfig +++ b/app/boards/shields/quefrency/Kconfig.defconfig @@ -7,6 +7,9 @@ if SHIELD_QUEFRENCY_LEFT config ZMK_KEYBOARD_NAME default "Quefrency Left" +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + endif if SHIELD_QUEFRENCY_RIGHT @@ -15,3 +18,10 @@ config ZMK_KEYBOARD_NAME default "Quefrency Right" endif + +if SHIELD_QUEFRENCY_LEFT || SHIELD_QUEFRENCY_RIGHT + +config ZMK_SPLIT + default y + +endif \ No newline at end of file diff --git a/app/boards/shields/quefrency/quefrency_left.conf b/app/boards/shields/quefrency/quefrency_left.conf index 1e028a78..e69de29b 100644 --- a/app/boards/shields/quefrency/quefrency_left.conf +++ b/app/boards/shields/quefrency/quefrency_left.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y diff --git a/app/boards/shields/quefrency/quefrency_right.conf b/app/boards/shields/quefrency/quefrency_right.conf index 990cf7c0..e69de29b 100644 --- a/app/boards/shields/quefrency/quefrency_right.conf +++ b/app/boards/shields/quefrency/quefrency_right.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y diff --git a/app/boards/shields/sofle/Kconfig.defconfig b/app/boards/shields/sofle/Kconfig.defconfig index 6a4f863b..cde094a6 100644 --- a/app/boards/shields/sofle/Kconfig.defconfig +++ b/app/boards/shields/sofle/Kconfig.defconfig @@ -5,6 +5,10 @@ if SHIELD_SOFLE_LEFT config ZMK_KEYBOARD_NAME default "Sofle Left" + +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + endif if SHIELD_SOFLE_RIGHT @@ -15,6 +19,9 @@ endif if SHIELD_SOFLE_LEFT || SHIELD_SOFLE_RIGHT +config ZMK_SPLIT + default y + if ZMK_DISPLAY config I2C diff --git a/app/boards/shields/sofle/sofle_left.conf b/app/boards/shields/sofle/sofle_left.conf index bbac7359..e8137201 100644 --- a/app/boards/shields/sofle/sofle_left.conf +++ b/app/boards/shields/sofle/sofle_left.conf @@ -1,5 +1,2 @@ # Copyright (c) 2020 Ryan Cross # SPDX-License-Identifier: MIT - -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y diff --git a/app/boards/shields/sofle/sofle_right.conf b/app/boards/shields/sofle/sofle_right.conf index ca5de382..e8137201 100644 --- a/app/boards/shields/sofle/sofle_right.conf +++ b/app/boards/shields/sofle/sofle_right.conf @@ -1,5 +1,2 @@ # Copyright (c) 2020 Ryan Cross # SPDX-License-Identifier: MIT - -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y diff --git a/app/boards/shields/splitreus62/Kconfig.defconfig b/app/boards/shields/splitreus62/Kconfig.defconfig index a2464a79..06ac131d 100644 --- a/app/boards/shields/splitreus62/Kconfig.defconfig +++ b/app/boards/shields/splitreus62/Kconfig.defconfig @@ -8,6 +8,9 @@ if SHIELD_SPLITREUS62_LEFT config ZMK_KEYBOARD_NAME default "Splitreus62 Left" +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + endif if SHIELD_SPLITREUS62_RIGHT @@ -19,4 +22,7 @@ endif if SHIELD_SPLITREUS62_LEFT || SHIELD_SPLITREUS62_RIGHT +config ZMK_SPLIT + default y + endif diff --git a/app/boards/shields/splitreus62/splitreus62_left.conf b/app/boards/shields/splitreus62/splitreus62_left.conf index e51dee44..e69de29b 100644 --- a/app/boards/shields/splitreus62/splitreus62_left.conf +++ b/app/boards/shields/splitreus62/splitreus62_left.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y \ No newline at end of file diff --git a/app/boards/shields/splitreus62/splitreus62_right.conf b/app/boards/shields/splitreus62/splitreus62_right.conf index a835adc1..e69de29b 100644 --- a/app/boards/shields/splitreus62/splitreus62_right.conf +++ b/app/boards/shields/splitreus62/splitreus62_right.conf @@ -1,2 +0,0 @@ -CONFIG_ZMK_SPLIT=y -CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y \ No newline at end of file diff --git a/app/src/ble.c b/app/src/ble.c index 4d422877..be84de8b 100644 --- a/app/src/ble.c +++ b/app/src/ble.c @@ -63,19 +63,24 @@ static uint8_t active_profile; #define DEVICE_NAME CONFIG_BT_DEVICE_NAME #define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1) +#define IS_HOST_PERIPHERAL \ + (!IS_ENABLED(CONFIG_ZMK_SPLIT) || IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)) +#define IS_SPLIT_PERIPHERAL \ + (IS_ENABLED(CONFIG_ZMK_SPLIT) && !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)) + static const struct bt_data zmk_ble_ad[] = { -#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) +#if IS_HOST_PERIPHERAL BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN), BT_DATA_BYTES(BT_DATA_GAP_APPEARANCE, 0xC1, 0x03), #endif BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)), BT_DATA_BYTES(BT_DATA_UUID16_SOME, -#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) +#if IS_HOST_PERIPHERAL 0x12, 0x18, /* HID Service */ #endif 0x0f, 0x18 /* Battery Service */ ), -#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) +#if IS_SPLIT_PERIPHERAL BT_DATA_BYTES(BT_DATA_UUID128_ALL, ZMK_SPLIT_BT_SERVICE_UUID) #endif }; @@ -373,7 +378,7 @@ static void connected(struct bt_conn *conn, uint8_t err) { bt_conn_le_param_update(conn, BT_LE_CONN_PARAM(0x0006, 0x000c, 30, 400)); -#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) +#if IS_SPLIT_PERIPHERAL bt_conn_le_phy_update(conn, BT_CONN_LE_PHY_PARAM_2M); #endif @@ -462,7 +467,7 @@ static void auth_cancel(struct bt_conn *conn) { LOG_DBG("Pairing cancelled: %s", log_strdup(addr)); } -#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) +#if IS_HOST_PERIPHERAL static enum bt_security_err auth_pairing_accept(struct bt_conn *conn, const struct bt_conn_pairing_feat *const feat) { struct bt_conn_info info; @@ -476,7 +481,7 @@ static enum bt_security_err auth_pairing_accept(struct bt_conn *conn, return BT_SECURITY_ERR_SUCCESS; }; -#endif /* !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) */ +#endif /* IS_HOST_PERIPHERAL */ static void auth_pairing_complete(struct bt_conn *conn, bool bonded) { struct bt_conn_info info; @@ -491,22 +496,22 @@ static void auth_pairing_complete(struct bt_conn *conn, bool bonded) { return; } -#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) +#if IS_HOST_PERIPHERAL if (!zmk_ble_active_profile_is_open()) { LOG_ERR("Pairing completed but current profile is not open: %s", log_strdup(addr)); bt_unpair(BT_ID_DEFAULT, dst); return; } -#endif /* !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) */ +#endif /* IS_HOST_PERIPHERAL */ set_profile_address(active_profile, dst); update_advertising(); }; static struct bt_conn_auth_cb zmk_ble_auth_cb_display = { -#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) +#if IS_HOST_PERIPHERAL .pairing_accept = auth_pairing_accept, -#endif /* !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) */ +#endif /* IS_HOST_PERIPHERAL */ .pairing_complete = auth_pairing_complete, // .passkey_display = auth_passkey_display, From 4fc17e0b3a32096923790f28226a15beffacc686 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Thu, 17 Dec 2020 00:19:03 -0500 Subject: [PATCH 04/16] fix(shields): Enable USB by default on right side. * Ensures USB power detection for sleep/charging is properly detected on the right side by deafult. --- app/boards/shields/corne/Kconfig.defconfig | 3 +++ app/boards/shields/cradio/Kconfig.defconfig | 3 +++ app/boards/shields/iris/Kconfig.defconfig | 3 +++ app/boards/shields/jian/Kconfig.defconfig | 3 +++ app/boards/shields/jorne/Kconfig.defconfig | 3 +++ app/boards/shields/kyria/Kconfig.defconfig | 3 +++ app/boards/shields/lily58/Kconfig.defconfig | 3 +++ app/boards/shields/microdox/Kconfig.defconfig | 3 +++ app/boards/shields/quefrency/Kconfig.defconfig | 3 +++ app/boards/shields/sofle/Kconfig.defconfig | 4 ++++ app/boards/shields/splitreus62/Kconfig.defconfig | 3 +++ 11 files changed, 34 insertions(+) diff --git a/app/boards/shields/corne/Kconfig.defconfig b/app/boards/shields/corne/Kconfig.defconfig index 9e33e089..6cf60b18 100644 --- a/app/boards/shields/corne/Kconfig.defconfig +++ b/app/boards/shields/corne/Kconfig.defconfig @@ -13,6 +13,9 @@ if SHIELD_CORNE_RIGHT config ZMK_KEYBOARD_NAME default "Corne Right" +config USB + default y + endif if SHIELD_CORNE_LEFT || SHIELD_CORNE_RIGHT diff --git a/app/boards/shields/cradio/Kconfig.defconfig b/app/boards/shields/cradio/Kconfig.defconfig index 5e826bf0..25bb4331 100644 --- a/app/boards/shields/cradio/Kconfig.defconfig +++ b/app/boards/shields/cradio/Kconfig.defconfig @@ -16,6 +16,9 @@ if SHIELD_CRADIO_RIGHT config ZMK_KEYBOARD_NAME default "cradio right" +config USB + default y + endif if SHIELD_CRADIO_LEFT || SHIELD_CRADIO_RIGHT diff --git a/app/boards/shields/iris/Kconfig.defconfig b/app/boards/shields/iris/Kconfig.defconfig index 57b8c1ee..a43c0073 100644 --- a/app/boards/shields/iris/Kconfig.defconfig +++ b/app/boards/shields/iris/Kconfig.defconfig @@ -16,6 +16,9 @@ if SHIELD_IRIS_RIGHT config ZMK_KEYBOARD_NAME default "Iris Right" +config USB + default y + endif if SHIELD_IRIS_LEFT || SHIELD_IRIS_RIGHT diff --git a/app/boards/shields/jian/Kconfig.defconfig b/app/boards/shields/jian/Kconfig.defconfig index 9e1da623..07023a24 100644 --- a/app/boards/shields/jian/Kconfig.defconfig +++ b/app/boards/shields/jian/Kconfig.defconfig @@ -15,6 +15,9 @@ if SHIELD_JIAN_RIGHT config ZMK_KEYBOARD_NAME default "Jian Right" +config USB + default y + endif if SHIELD_JIAN_LEFT || SHIELD_JIAN_RIGHT diff --git a/app/boards/shields/jorne/Kconfig.defconfig b/app/boards/shields/jorne/Kconfig.defconfig index 5b0e0b95..18dcabe1 100644 --- a/app/boards/shields/jorne/Kconfig.defconfig +++ b/app/boards/shields/jorne/Kconfig.defconfig @@ -15,6 +15,9 @@ if SHIELD_JORNE_RIGHT config ZMK_KEYBOARD_NAME default "Jorne Right" +config USB + default y + endif if SHIELD_JORNE_LEFT || SHIELD_JORNE_RIGHT diff --git a/app/boards/shields/kyria/Kconfig.defconfig b/app/boards/shields/kyria/Kconfig.defconfig index 99e47bfe..d0c17105 100644 --- a/app/boards/shields/kyria/Kconfig.defconfig +++ b/app/boards/shields/kyria/Kconfig.defconfig @@ -15,6 +15,9 @@ if SHIELD_KYRIA_RIGHT config ZMK_KEYBOARD_NAME default "Kyria Right" +config USB + default y + endif if SHIELD_KYRIA_LEFT || SHIELD_KYRIA_RIGHT diff --git a/app/boards/shields/lily58/Kconfig.defconfig b/app/boards/shields/lily58/Kconfig.defconfig index 915cc70e..ebcfa7b7 100644 --- a/app/boards/shields/lily58/Kconfig.defconfig +++ b/app/boards/shields/lily58/Kconfig.defconfig @@ -14,6 +14,9 @@ if SHIELD_LILY58_RIGHT config ZMK_KEYBOARD_NAME default "Lily58 Right" +config USB + default y + endif if SHIELD_LILY58_LEFT || SHIELD_LILY58_RIGHT diff --git a/app/boards/shields/microdox/Kconfig.defconfig b/app/boards/shields/microdox/Kconfig.defconfig index be39c9f8..0afd7491 100644 --- a/app/boards/shields/microdox/Kconfig.defconfig +++ b/app/boards/shields/microdox/Kconfig.defconfig @@ -17,6 +17,9 @@ if SHIELD_MICRODOX_RIGHT config ZMK_KEYBOARD_NAME default "Microdox Right" +config USB + default y + endif if SHIELD_MICRODOX_LEFT || SHIELD_MICRODOX_RIGHT diff --git a/app/boards/shields/quefrency/Kconfig.defconfig b/app/boards/shields/quefrency/Kconfig.defconfig index 9c7e8b13..b4041cbf 100644 --- a/app/boards/shields/quefrency/Kconfig.defconfig +++ b/app/boards/shields/quefrency/Kconfig.defconfig @@ -17,6 +17,9 @@ if SHIELD_QUEFRENCY_RIGHT config ZMK_KEYBOARD_NAME default "Quefrency Right" +config USB + default y + endif if SHIELD_QUEFRENCY_LEFT || SHIELD_QUEFRENCY_RIGHT diff --git a/app/boards/shields/sofle/Kconfig.defconfig b/app/boards/shields/sofle/Kconfig.defconfig index cde094a6..765afea4 100644 --- a/app/boards/shields/sofle/Kconfig.defconfig +++ b/app/boards/shields/sofle/Kconfig.defconfig @@ -15,6 +15,10 @@ if SHIELD_SOFLE_RIGHT config ZMK_KEYBOARD_NAME default "Sofle Right" + +config USB + default y + endif if SHIELD_SOFLE_LEFT || SHIELD_SOFLE_RIGHT diff --git a/app/boards/shields/splitreus62/Kconfig.defconfig b/app/boards/shields/splitreus62/Kconfig.defconfig index 06ac131d..988041c0 100644 --- a/app/boards/shields/splitreus62/Kconfig.defconfig +++ b/app/boards/shields/splitreus62/Kconfig.defconfig @@ -18,6 +18,9 @@ if SHIELD_SPLITREUS62_RIGHT config ZMK_KEYBOARD_NAME default "Splitreus62 Right" +config USB + default y + endif if SHIELD_SPLITREUS62_LEFT || SHIELD_SPLITREUS62_RIGHT From 87179698b42a627f4ab7653749377001cb090fed Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Sat, 19 Dec 2020 17:32:02 +0000 Subject: [PATCH 05/16] refactor(app): replace zmk_key with zmk_key_t Aligns with typedef _t convention. PR: #531 --- app/include/zmk/hid.h | 8 ++++---- app/include/zmk/keys.h | 4 ++-- app/src/ble.c | 2 +- app/src/hid.c | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/include/zmk/hid.h b/app/include/zmk/hid.h index 1f755aa2..c664082e 100644 --- a/app/include/zmk/hid.h +++ b/app/include/zmk/hid.h @@ -170,12 +170,12 @@ int zmk_hid_register_mod(zmk_mod modifier); int zmk_hid_unregister_mod(zmk_mod modifier); int zmk_hid_implicit_modifiers_press(zmk_mod_flags implicit_modifiers); int zmk_hid_implicit_modifiers_release(); -int zmk_hid_keyboard_press(zmk_key key); -int zmk_hid_keyboard_release(zmk_key key); +int zmk_hid_keyboard_press(zmk_key_t key); +int zmk_hid_keyboard_release(zmk_key_t key); void zmk_hid_keyboard_clear(); -int zmk_hid_consumer_press(zmk_key key); -int zmk_hid_consumer_release(zmk_key key); +int zmk_hid_consumer_press(zmk_key_t key); +int zmk_hid_consumer_release(zmk_key_t key); void zmk_hid_consumer_clear(); struct zmk_hid_keyboard_report *zmk_hid_get_keyboard_report(); diff --git a/app/include/zmk/keys.h b/app/include/zmk/keys.h index 204de9c8..330f0adb 100644 --- a/app/include/zmk/keys.h +++ b/app/include/zmk/keys.h @@ -9,13 +9,13 @@ #include #include -typedef uint32_t zmk_key; +typedef uint32_t zmk_key_t; typedef uint8_t zmk_mod; typedef uint8_t zmk_mod_flags; struct zmk_key_event { uint32_t column; uint32_t row; - zmk_key key; + zmk_key_t key; bool pressed; }; \ No newline at end of file diff --git a/app/src/ble.c b/app/src/ble.c index be84de8b..b32696ff 100644 --- a/app/src/ble.c +++ b/app/src/ble.c @@ -596,7 +596,7 @@ int zmk_ble_unpair_all() { }; bool zmk_ble_handle_key_user(struct zmk_key_event *key_event) { - zmk_key key = key_event->key; + zmk_key_t key = key_event->key; if (!auth_passkey_entry_conn) { return true; diff --git a/app/src/hid.c b/app/src/hid.c index 2d6e6f2b..50166c43 100644 --- a/app/src/hid.c +++ b/app/src/hid.c @@ -77,7 +77,7 @@ int zmk_hid_implicit_modifiers_release() { return 0; } -int zmk_hid_keyboard_press(zmk_key code) { +int zmk_hid_keyboard_press(zmk_key_t code) { if (code >= HID_USAGE_KEY_KEYBOARD_LEFTCONTROL && code <= HID_USAGE_KEY_KEYBOARD_RIGHT_GUI) { return zmk_hid_register_mod(code - HID_USAGE_KEY_KEYBOARD_LEFTCONTROL); } @@ -85,7 +85,7 @@ int zmk_hid_keyboard_press(zmk_key code) { return 0; }; -int zmk_hid_keyboard_release(zmk_key code) { +int zmk_hid_keyboard_release(zmk_key_t code) { if (code >= HID_USAGE_KEY_KEYBOARD_LEFTCONTROL && code <= HID_USAGE_KEY_KEYBOARD_RIGHT_GUI) { return zmk_hid_unregister_mod(code - HID_USAGE_KEY_KEYBOARD_LEFTCONTROL); } @@ -95,12 +95,12 @@ int zmk_hid_keyboard_release(zmk_key code) { void zmk_hid_keyboard_clear() { memset(&keyboard_report.body, 0, sizeof(keyboard_report.body)); } -int zmk_hid_consumer_press(zmk_key code) { +int zmk_hid_consumer_press(zmk_key_t code) { TOGGLE_CONSUMER(0U, code); return 0; }; -int zmk_hid_consumer_release(zmk_key code) { +int zmk_hid_consumer_release(zmk_key_t code) { TOGGLE_CONSUMER(code, 0U); return 0; }; From 05b0d185a8c8c4eb19f63968e54f859a0f3e6484 Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Sat, 19 Dec 2020 17:32:40 +0000 Subject: [PATCH 06/16] refactor(app): replace zmk_mod with zmk_mod_t Aligns with typedef _t convention. PR: #531 --- app/include/zmk/hid.h | 4 ++-- app/include/zmk/keys.h | 2 +- app/src/hid.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/include/zmk/hid.h b/app/include/zmk/hid.h index c664082e..a2a4bf59 100644 --- a/app/include/zmk/hid.h +++ b/app/include/zmk/hid.h @@ -166,8 +166,8 @@ struct zmk_hid_consumer_report { struct zmk_hid_consumer_report_body body; } __packed; -int zmk_hid_register_mod(zmk_mod modifier); -int zmk_hid_unregister_mod(zmk_mod modifier); +int zmk_hid_register_mod(zmk_mod_t modifier); +int zmk_hid_unregister_mod(zmk_mod_t modifier); int zmk_hid_implicit_modifiers_press(zmk_mod_flags implicit_modifiers); int zmk_hid_implicit_modifiers_release(); int zmk_hid_keyboard_press(zmk_key_t key); diff --git a/app/include/zmk/keys.h b/app/include/zmk/keys.h index 330f0adb..8e372ff8 100644 --- a/app/include/zmk/keys.h +++ b/app/include/zmk/keys.h @@ -10,7 +10,7 @@ #include typedef uint32_t zmk_key_t; -typedef uint8_t zmk_mod; +typedef uint8_t zmk_mod_t; typedef uint8_t zmk_mod_flags; struct zmk_key_event { diff --git a/app/src/hid.c b/app/src/hid.c index 50166c43..de853d84 100644 --- a/app/src/hid.c +++ b/app/src/hid.c @@ -26,7 +26,7 @@ static zmk_mod_flags explicit_modifiers = 0; LOG_DBG("Modifiers set to 0x%02X", keyboard_report.body.modifiers); \ } -int zmk_hid_register_mod(zmk_mod modifier) { +int zmk_hid_register_mod(zmk_mod_t modifier) { explicit_modifier_counts[modifier]++; LOG_DBG("Modifier %d count %d", modifier, explicit_modifier_counts[modifier]); WRITE_BIT(explicit_modifiers, modifier, true); @@ -34,7 +34,7 @@ int zmk_hid_register_mod(zmk_mod modifier) { return 0; } -int zmk_hid_unregister_mod(zmk_mod modifier) { +int zmk_hid_unregister_mod(zmk_mod_t modifier) { if (explicit_modifier_counts[modifier] <= 0) { LOG_ERR("Tried to unregister modifier %d too often", modifier); return -EINVAL; From 87e7c04b00b2cb83540b757a8c909200cdb28255 Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Sat, 19 Dec 2020 17:33:15 +0000 Subject: [PATCH 07/16] refactor(app): replace zmk_mod_flags with zmk_mod_flags_t Aligns with typedef _t convention. PR: #531 --- app/include/zmk/events/keycode_state_changed.h | 2 +- app/include/zmk/events/modifiers_state_changed.h | 4 ++-- app/include/zmk/hid.h | 4 ++-- app/include/zmk/keys.h | 2 +- app/src/hid.c | 4 ++-- app/src/hid_listener.c | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/include/zmk/events/keycode_state_changed.h b/app/include/zmk/events/keycode_state_changed.h index 28282b6b..d175605b 100644 --- a/app/include/zmk/events/keycode_state_changed.h +++ b/app/include/zmk/events/keycode_state_changed.h @@ -27,7 +27,7 @@ static inline struct keycode_state_changed * 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 implicit_mods = SELECT_MODS(encoded); + zmk_mod_flags_t implicit_mods = SELECT_MODS(encoded); if (!page) { page = HID_USAGE_KEY; diff --git a/app/include/zmk/events/modifiers_state_changed.h b/app/include/zmk/events/modifiers_state_changed.h index c4daede0..4f40f4c9 100644 --- a/app/include/zmk/events/modifiers_state_changed.h +++ b/app/include/zmk/events/modifiers_state_changed.h @@ -12,13 +12,13 @@ struct modifiers_state_changed { struct zmk_event_header header; - zmk_mod_flags modifiers; + zmk_mod_flags_t modifiers; bool state; }; ZMK_EVENT_DECLARE(modifiers_state_changed); -inline struct modifiers_state_changed *create_modifiers_state_changed(zmk_mod_flags modifiers, +inline struct modifiers_state_changed *create_modifiers_state_changed(zmk_mod_flags_t modifiers, bool state) { struct modifiers_state_changed *ev = new_modifiers_state_changed(); ev->modifiers = modifiers; diff --git a/app/include/zmk/hid.h b/app/include/zmk/hid.h index a2a4bf59..1ec51262 100644 --- a/app/include/zmk/hid.h +++ b/app/include/zmk/hid.h @@ -147,7 +147,7 @@ static const uint8_t zmk_hid_report_desc[] = { // } __packed; struct zmk_hid_keyboard_report_body { - zmk_mod_flags modifiers; + zmk_mod_flags_t modifiers; uint8_t _reserved; uint8_t keys[ZMK_HID_KEYBOARD_NKRO_SIZE]; } __packed; @@ -168,7 +168,7 @@ struct zmk_hid_consumer_report { int zmk_hid_register_mod(zmk_mod_t modifier); int zmk_hid_unregister_mod(zmk_mod_t modifier); -int zmk_hid_implicit_modifiers_press(zmk_mod_flags implicit_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); int zmk_hid_keyboard_release(zmk_key_t key); diff --git a/app/include/zmk/keys.h b/app/include/zmk/keys.h index 8e372ff8..62e3cce8 100644 --- a/app/include/zmk/keys.h +++ b/app/include/zmk/keys.h @@ -11,7 +11,7 @@ typedef uint32_t zmk_key_t; typedef uint8_t zmk_mod_t; -typedef uint8_t zmk_mod_flags; +typedef uint8_t zmk_mod_flags_t; struct zmk_key_event { uint32_t column; diff --git a/app/src/hid.c b/app/src/hid.c index de853d84..37378b45 100644 --- a/app/src/hid.c +++ b/app/src/hid.c @@ -18,7 +18,7 @@ static struct zmk_hid_consumer_report consumer_report = {.report_id = 2, .body = // Keep track of how often a modifier was pressed. // Only release the modifier if the count is 0. static int explicit_modifier_counts[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -static zmk_mod_flags explicit_modifiers = 0; +static zmk_mod_flags_t explicit_modifiers = 0; #define SET_MODIFIERS(mods) \ { \ @@ -67,7 +67,7 @@ int zmk_hid_unregister_mod(zmk_mod_t modifier) { break; \ } -int zmk_hid_implicit_modifiers_press(zmk_mod_flags implicit_modifiers) { +int zmk_hid_implicit_modifiers_press(zmk_mod_flags_t implicit_modifiers) { SET_MODIFIERS(explicit_modifiers | implicit_modifiers); return 0; } diff --git a/app/src/hid_listener.c b/app/src/hid_listener.c index cf8835a2..80e9054a 100644 --- a/app/src/hid_listener.c +++ b/app/src/hid_listener.c @@ -17,7 +17,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include static int hid_listener_keycode_pressed(uint8_t usage_page, uint32_t keycode, - zmk_mod_flags implicit_modifiers) { + zmk_mod_flags_t implicit_modifiers) { int err; LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode, implicit_modifiers); @@ -42,7 +42,7 @@ static int hid_listener_keycode_pressed(uint8_t usage_page, uint32_t keycode, } static int hid_listener_keycode_released(uint8_t usage_page, uint32_t keycode, - zmk_mod_flags implicit_modifiers) { + zmk_mod_flags_t implicit_modifiers) { int err; LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode, implicit_modifiers); From 0e71dbc860e19f8eb269841a15b9fccd9ef7d37f Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Sat, 19 Dec 2020 17:37:12 +0000 Subject: [PATCH 08/16] refactor(app): replace zmk_keymap_layers_state with zmk_keymap_layers_state_t Aligns with typedef _t convention. PR: #531 --- app/include/zmk/keymap.h | 4 ++-- app/src/keymap.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/include/zmk/keymap.h b/app/include/zmk/keymap.h index 7303d4aa..1070af71 100644 --- a/app/include/zmk/keymap.h +++ b/app/include/zmk/keymap.h @@ -6,10 +6,10 @@ #pragma once -typedef uint32_t zmk_keymap_layers_state; +typedef uint32_t zmk_keymap_layers_state_t; uint8_t zmk_keymap_layer_default(); -zmk_keymap_layers_state zmk_keymap_layer_state(); +zmk_keymap_layers_state_t zmk_keymap_layer_state(); bool zmk_keymap_layer_active(uint8_t layer); uint8_t zmk_keymap_highest_layer_active(); int zmk_keymap_layer_activate(uint8_t layer); diff --git a/app/src/keymap.c b/app/src/keymap.c index cafe2ffe..3a3d4e99 100644 --- a/app/src/keymap.c +++ b/app/src/keymap.c @@ -19,7 +19,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include -static zmk_keymap_layers_state _zmk_keymap_layer_state = 0; +static zmk_keymap_layers_state_t _zmk_keymap_layer_state = 0; static uint8_t _zmk_keymap_layer_default = 0; #define DT_DRV_COMPAT zmk_keymap @@ -88,7 +88,7 @@ static inline int set_layer_state(uint8_t layer, bool state) { uint8_t zmk_keymap_layer_default() { return _zmk_keymap_layer_default; } -zmk_keymap_layers_state zmk_keymap_layer_state() { return _zmk_keymap_layer_state; } +zmk_keymap_layers_state_t zmk_keymap_layer_state() { return _zmk_keymap_layer_state; } bool zmk_keymap_layer_active(uint8_t layer) { return (_zmk_keymap_layer_state & (BIT(layer))) == (BIT(layer)); @@ -115,7 +115,7 @@ int zmk_keymap_layer_toggle(uint8_t layer) { return zmk_keymap_layer_activate(layer); }; -bool is_active_layer(uint8_t layer, zmk_keymap_layers_state layer_state) { +bool is_active_layer(uint8_t layer, zmk_keymap_layers_state_t layer_state) { return (layer_state & BIT(layer)) == BIT(layer) || layer == _zmk_keymap_layer_default; } From 9a9f155e696935f4b576b4213b5256af8adbca93 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 11 Dec 2020 11:09:07 -0500 Subject: [PATCH 09/16] feature(ci): Build split w/ display enabled for testing. --- .github/workflows/build.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac5bded1..0aee5d7f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,6 +55,7 @@ jobs: - splitreus62_right - tg4x - tidbit + cmake-args: [""] include: - board: dz60rgb_rev1 - board: nrf52840_m2 @@ -62,6 +63,14 @@ jobs: - board: planck_rev6 - board: proton_c shield: clueboard_california + - board: nice_nano + shield: kyria_left + cmake-args: -DCONFIG_ZMK_DISPLAY=y + skip-archive: true + - board: nice_nano + shield: kyria_right + cmake-args: -DCONFIG_ZMK_DISPLAY=y + skip-archive: true steps: - name: Checkout uses: actions/checkout@v2 @@ -104,8 +113,9 @@ jobs: echo ::set-output name=shield-arg::${SHIELD_ARG} echo ::set-output name=artifact-name::${ARTIFACT_NAME} - name: Build (west build) - run: west build -s app -b ${{ matrix.board }} -- ${{ steps.variables.outputs.shield-arg }} + run: west build -s app -b ${{ matrix.board }} -- ${{ steps.variables.outputs.shield-arg }} ${{ matrix.cmake-args }} - name: Archive artifacts + if: ${{ !matrix.skip-archive }} uses: actions/upload-artifact@v2 with: name: "${{ steps.variables.outputs.artifact-name }}" From 87dbd4ca28405ab3d17cf62f3df86581606279b7 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Mon, 28 Dec 2020 20:17:32 -0500 Subject: [PATCH 10/16] Add uppermost, current layer status widget to oled (#493) * Add uppermost, current layer status widget to oled * Run clang format * Fixup display widget source includes in CMakeLists * Update layer widget to only be enabled on primary half of a split keyboard and shuffle some of the options specific to the widget to be enabled via the widget * Update to latest lvgl/zmk/zephyr ; remove version text from oled per PR * Fixup file names * Remove last remenants of the version display text from the oled * Fixup clang-format Co-authored-by: KemoNine --- .../zmk/display/widgets/layer_status.h | 18 +++++ app/src/display/CMakeLists.txt | 2 +- app/src/display/status_screen.c | 15 ++-- app/src/display/widgets/CMakeLists.txt | 1 + app/src/display/widgets/Kconfig | 6 ++ app/src/display/widgets/layer_status.c | 68 +++++++++++++++++++ 6 files changed, 104 insertions(+), 6 deletions(-) create mode 100644 app/include/zmk/display/widgets/layer_status.h create mode 100644 app/src/display/widgets/layer_status.c diff --git a/app/include/zmk/display/widgets/layer_status.h b/app/include/zmk/display/widgets/layer_status.h new file mode 100644 index 00000000..3779351a --- /dev/null +++ b/app/include/zmk/display/widgets/layer_status.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#pragma once + +#include +#include + +struct zmk_widget_layer_status { + sys_snode_t node; + lv_obj_t *obj; +}; + +int zmk_widget_layer_status_init(struct zmk_widget_layer_status *widget, lv_obj_t *parent); +lv_obj_t *zmk_widget_layer_status_obj(struct zmk_widget_layer_status *widget); \ No newline at end of file diff --git a/app/src/display/CMakeLists.txt b/app/src/display/CMakeLists.txt index 3b85fc0f..d289f074 100644 --- a/app/src/display/CMakeLists.txt +++ b/app/src/display/CMakeLists.txt @@ -4,4 +4,4 @@ target_sources_ifdef(CONFIG_ZMK_DISPLAY app PRIVATE main.c) target_sources_ifdef(CONFIG_ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN app PRIVATE status_screen.c) -add_subdirectory(widgets/) \ No newline at end of file +add_subdirectory_ifdef(CONFIG_ZMK_DISPLAY widgets/) diff --git a/app/src/display/status_screen.c b/app/src/display/status_screen.c index 9a5c7b41..0c88717a 100644 --- a/app/src/display/status_screen.c +++ b/app/src/display/status_screen.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -19,14 +20,15 @@ static struct zmk_widget_battery_status battery_status_widget; static struct zmk_widget_output_status output_status_widget; #endif +#if IS_ENABLED(CONFIG_ZMK_WIDGET_LAYER_STATUS) +static struct zmk_widget_layer_status layer_status_widget; +#endif + lv_obj_t *zmk_display_status_screen() { lv_obj_t *screen; - lv_obj_t *zmk_version_label; screen = lv_obj_create(NULL, NULL); - zmk_version_label = lv_label_create(screen, NULL); - #if IS_ENABLED(CONFIG_ZMK_WIDGET_BATTERY_STATUS) zmk_widget_battery_status_init(&battery_status_widget, screen); lv_obj_align(zmk_widget_battery_status_obj(&battery_status_widget), NULL, LV_ALIGN_IN_TOP_RIGHT, @@ -39,8 +41,11 @@ lv_obj_t *zmk_display_status_screen() { 0); #endif - lv_label_set_text(zmk_version_label, "ZMK v0.1.0"); - lv_obj_align(zmk_version_label, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0); +#if IS_ENABLED(CONFIG_ZMK_WIDGET_LAYER_STATUS) + zmk_widget_layer_status_init(&layer_status_widget, screen); + lv_obj_align(zmk_widget_layer_status_obj(&layer_status_widget), NULL, LV_ALIGN_IN_BOTTOM_LEFT, + 0, 0); +#endif return screen; } diff --git a/app/src/display/widgets/CMakeLists.txt b/app/src/display/widgets/CMakeLists.txt index 1d4cca1f..ad7e132a 100644 --- a/app/src/display/widgets/CMakeLists.txt +++ b/app/src/display/widgets/CMakeLists.txt @@ -3,3 +3,4 @@ target_sources_ifdef(CONFIG_ZMK_WIDGET_BATTERY_STATUS app PRIVATE battery_status.c) target_sources_ifdef(CONFIG_ZMK_WIDGET_OUTPUT_STATUS app PRIVATE output_status.c) +target_sources_ifdef(CONFIG_ZMK_WIDGET_LAYER_STATUS app PRIVATE layer_status.c) diff --git a/app/src/display/widgets/Kconfig b/app/src/display/widgets/Kconfig index 01bc587e..bdb3024e 100644 --- a/app/src/display/widgets/Kconfig +++ b/app/src/display/widgets/Kconfig @@ -3,6 +3,12 @@ menu "ZMK Display Widgets" +config ZMK_WIDGET_LAYER_STATUS + bool "Widget for highest, active layer using small icons" + default y + depends on !ZMK_SPLIT || ZMK_SPLIT_BLE_ROLE_CENTRAL + select LVGL_FONT_MONTSERRAT_12 + config ZMK_WIDGET_BATTERY_STATUS bool "Widget for battery charge information, using small icons" depends on BT diff --git a/app/src/display/widgets/layer_status.c b/app/src/display/widgets/layer_status.c new file mode 100644 index 00000000..fb9f6897 --- /dev/null +++ b/app/src/display/widgets/layer_status.c @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); + +#include +#include +#include +#include +#include + +static sys_slist_t widgets = SYS_SLIST_STATIC_INIT(&widgets); +static lv_style_t label_style; + +static bool style_initialized = false; + +void layer_status_init() { + if (style_initialized) { + return; + } + + style_initialized = true; + lv_style_init(&label_style); + lv_style_set_text_color(&label_style, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_style_set_text_font(&label_style, LV_STATE_DEFAULT, &lv_font_montserrat_12); + lv_style_set_text_letter_space(&label_style, LV_STATE_DEFAULT, 1); + lv_style_set_text_line_space(&label_style, LV_STATE_DEFAULT, 1); +} + +void set_layer_symbol(lv_obj_t *label) { + int active_layer_index = zmk_keymap_highest_layer_active(); + char text[6] = {}; + + LOG_DBG("Layer changed to %i", active_layer_index); + sprintf(text, LV_SYMBOL_KEYBOARD "%i ", active_layer_index); + + lv_label_set_text(label, text); +} + +int zmk_widget_layer_status_init(struct zmk_widget_layer_status *widget, lv_obj_t *parent) { + layer_status_init(); + widget->obj = lv_label_create(parent, NULL); + lv_obj_add_style(widget->obj, LV_LABEL_PART_MAIN, &label_style); + + lv_obj_set_size(widget->obj, 40, 15); + set_layer_symbol(widget->obj); + + sys_slist_append(&widgets, &widget->node); + + return 0; +} + +lv_obj_t *zmk_widget_layer_status_obj(struct zmk_widget_layer_status *widget) { + return widget->obj; +} + +int layer_status_listener(const struct zmk_event_header *eh) { + struct zmk_widget_layer_status *widget; + SYS_SLIST_FOR_EACH_CONTAINER(&widgets, widget, node) { set_layer_symbol(widget->obj); } + return 0; +} + +ZMK_LISTENER(widget_layer_status, layer_status_listener) +ZMK_SUBSCRIPTION(widget_layer_status, layer_state_changed); \ No newline at end of file From 43f6d798be70ef247b0717730ec34202cb81e96d Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Tue, 15 Dec 2020 13:22:16 -0600 Subject: [PATCH 11/16] feat(ext-power): Cut power when PM is sleeping --- app/Kconfig | 3 +++ app/src/ext_power_generic.c | 46 +++++++++++++++++++++++++++++++++++++ app/src/power.c | 4 ++++ 3 files changed, 53 insertions(+) diff --git a/app/Kconfig b/app/Kconfig index acb288cb..4341df11 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -234,6 +234,9 @@ choice SYS_PM_POLICY default SYS_PM_POLICY_APP endchoice +config DEVICE_POWER_MANAGEMENT + default y + config ZMK_IDLE_SLEEP_TIMEOUT int "Milliseconds of inactivity before entering deep sleep" default 900000 diff --git a/app/src/ext_power_generic.c b/app/src/ext_power_generic.c index 7e42d495..c2e89ab8 100644 --- a/app/src/ext_power_generic.c +++ b/app/src/ext_power_generic.c @@ -31,6 +31,9 @@ struct ext_power_generic_data { #if IS_ENABLED(CONFIG_SETTINGS) bool settings_init; #endif +#ifdef CONFIG_DEVICE_POWER_MANAGEMENT + uint32_t pm_state; +#endif }; #if IS_ENABLED(CONFIG_SETTINGS) @@ -139,6 +142,10 @@ static int ext_power_generic_init(const struct device *dev) { return -EIO; } +#ifdef CONFIG_DEVICE_POWER_MANAGEMENT + data->pm_state = DEVICE_PM_ACTIVE_STATE; +#endif + #if IS_ENABLED(CONFIG_SETTINGS) settings_subsys_init(); @@ -167,6 +174,39 @@ static int ext_power_generic_init(const struct device *dev) { return 0; } +#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +static int ext_power_generic_pm_control(const struct device *dev, uint32_t ctrl_command, + void *context, device_pm_cb cb, void *arg) { + int rc; + struct ext_power_generic_data *data = dev->driver_data; + + switch (ctrl_command) { + case DEVICE_PM_SET_POWER_STATE: + if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) { + data->pm_state = DEVICE_PM_ACTIVE_STATE; + rc = 0; + } else { + ext_power_generic_disable(dev); + data->pm_state = DEVICE_PM_LOW_POWER_STATE; + rc = 0; + } + break; + case DEVICE_PM_GET_POWER_STATE: + *((uint32_t *)context) = data->pm_state; + rc = 0; + break; + default: + rc = -EINVAL; + } + + if (cb != NULL) { + cb(dev, rc, context, arg); + } + + return rc; +} +#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ + static const struct ext_power_generic_config config = { .label = DT_INST_GPIO_LABEL(0, control_gpios), .pin = DT_INST_GPIO_PIN(0, control_gpios), @@ -183,7 +223,13 @@ static const struct ext_power_api api = {.enable = ext_power_generic_enable, .disable = ext_power_generic_disable, .get = ext_power_generic_get}; +#ifdef CONFIG_DEVICE_POWER_MANAGEMENT +DEVICE_DEFINE(ext_power_generic, DT_INST_LABEL(0), ext_power_generic_init, + &ext_power_generic_pm_control, &data, &config, APPLICATION, + CONFIG_APPLICATION_INIT_PRIORITY, &api); +#else DEVICE_AND_API_INIT(ext_power_generic, DT_INST_LABEL(0), ext_power_generic_init, &data, &config, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY, &api); +#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/power.c b/app/src/power.c index d014a524..4af18cf4 100644 --- a/app/src/power.c +++ b/app/src/power.c @@ -34,3 +34,7 @@ enum power_states sys_pm_policy_next_state(int32_t ticks) { return SYS_POWER_STATE_ACTIVE; } + +bool sys_pm_policy_low_power_devices(enum power_states pm_state) { + return sys_pm_is_sleep_state(pm_state); +} \ No newline at end of file From d207c3c30f7f2d0648b32d59f481498fe048230c Mon Sep 17 00:00:00 2001 From: KemoNine Date: Tue, 29 Dec 2020 11:57:49 -0500 Subject: [PATCH 12/16] (feature) Add &to keycode/behavior (#489) feat(behaviors): Add `&to` behavior to switch to a layer. --- app/CMakeLists.txt | 1 + app/dts/behaviors.dtsi | 1 + app/dts/behaviors/to_layer.dtsi | 15 +++++++ .../behaviors/zmk,behavior-to-layer.yaml | 8 ++++ app/include/zmk/keymap.h | 1 + app/src/behaviors/behavior_to_layer.c | 38 +++++++++++++++++ app/src/keymap.c | 42 ++++++++++++++----- app/tests/to-layer/behavior_keymap.dtsi | 22 ++++++++++ app/tests/to-layer/normal/events.patterns | 3 ++ .../to-layer/normal/keycode_events.snapshot | 18 ++++++++ app/tests/to-layer/normal/native_posix.keymap | 29 +++++++++++++ docs/docs/behaviors/layers.md | 15 +++++++ 12 files changed, 183 insertions(+), 10 deletions(-) create mode 100644 app/dts/behaviors/to_layer.dtsi create mode 100644 app/dts/bindings/behaviors/zmk,behavior-to-layer.yaml create mode 100644 app/src/behaviors/behavior_to_layer.c create mode 100644 app/tests/to-layer/behavior_keymap.dtsi create mode 100644 app/tests/to-layer/normal/events.patterns create mode 100644 app/tests/to-layer/normal/keycode_events.snapshot create mode 100644 app/tests/to-layer/normal/native_posix.keymap diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 9e0612de..5fb3827c 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -47,6 +47,7 @@ if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL) target_sources(app PRIVATE src/behaviors/behavior_momentary_layer.c) target_sources(app PRIVATE src/behaviors/behavior_outputs.c) target_sources(app PRIVATE src/behaviors/behavior_toggle_layer.c) + target_sources(app PRIVATE src/behaviors/behavior_to_layer.c) target_sources(app PRIVATE src/behaviors/behavior_transparent.c) target_sources(app PRIVATE src/behaviors/behavior_none.c) target_sources(app PRIVATE src/behaviors/behavior_sensor_rotate_key_press.c) diff --git a/app/dts/behaviors.dtsi b/app/dts/behaviors.dtsi index 9a64fc6c..daa073f1 100644 --- a/app/dts/behaviors.dtsi +++ b/app/dts/behaviors.dtsi @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include diff --git a/app/dts/behaviors/to_layer.dtsi b/app/dts/behaviors/to_layer.dtsi new file mode 100644 index 00000000..b09616ff --- /dev/null +++ b/app/dts/behaviors/to_layer.dtsi @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +/ { + behaviors { + to: behavior_to_layer { + compatible = "zmk,behavior-to-layer"; + label = "TO_LAYER"; + #binding-cells = <1>; + }; + }; +}; diff --git a/app/dts/bindings/behaviors/zmk,behavior-to-layer.yaml b/app/dts/bindings/behaviors/zmk,behavior-to-layer.yaml new file mode 100644 index 00000000..cbafddf7 --- /dev/null +++ b/app/dts/bindings/behaviors/zmk,behavior-to-layer.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +description: To Layer + +compatible: "zmk,behavior-to-layer" + +include: one_param.yaml diff --git a/app/include/zmk/keymap.h b/app/include/zmk/keymap.h index 1070af71..9192772f 100644 --- a/app/include/zmk/keymap.h +++ b/app/include/zmk/keymap.h @@ -15,5 +15,6 @@ uint8_t zmk_keymap_highest_layer_active(); int zmk_keymap_layer_activate(uint8_t layer); int zmk_keymap_layer_deactivate(uint8_t layer); int zmk_keymap_layer_toggle(uint8_t layer); +int zmk_keymap_layer_to(uint8_t layer); int zmk_keymap_position_state_changed(uint32_t position, bool pressed, int64_t timestamp); diff --git a/app/src/behaviors/behavior_to_layer.c b/app/src/behaviors/behavior_to_layer.c new file mode 100644 index 00000000..3ec1bf81 --- /dev/null +++ b/app/src/behaviors/behavior_to_layer.c @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#define DT_DRV_COMPAT zmk_behavior_to_layer + +#include +#include +#include + +#include +#include + +LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); + +static int behavior_to_init(const struct device *dev) { return 0; }; + +static int to_keymap_binding_pressed(struct zmk_behavior_binding *binding, + struct zmk_behavior_binding_event event) { + LOG_DBG("position %d layer %d", event.position, binding->param1); + return zmk_keymap_layer_to(binding->param1); +} + +static int to_keymap_binding_released(struct zmk_behavior_binding *binding, + struct zmk_behavior_binding_event event) { + LOG_DBG("position %d layer %d", event.position, binding->param1); + return 0; +} + +static const struct behavior_driver_api behavior_to_driver_api = { + .binding_pressed = to_keymap_binding_pressed, + .binding_released = to_keymap_binding_released, +}; + +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); diff --git a/app/src/keymap.c b/app/src/keymap.c index 3a3d4e99..786a1773 100644 --- a/app/src/keymap.c +++ b/app/src/keymap.c @@ -78,11 +78,23 @@ static struct zmk_behavior_binding zmk_sensor_keymap[ZMK_KEYMAP_LAYERS_LEN] #endif /* ZMK_KEYMAP_HAS_SENSORS */ static inline int set_layer_state(uint8_t layer, bool state) { - if (layer >= 32) { + if (layer >= ZMK_KEYMAP_LAYERS_LEN) { return -EINVAL; } + + // Default layer should *always* remain active + if (layer == _zmk_keymap_layer_default && !state) { + return 0; + } + + zmk_keymap_layers_state_t old_state = _zmk_keymap_layer_state; WRITE_BIT(_zmk_keymap_layer_state, layer, state); - ZMK_EVENT_RAISE(create_layer_state_changed(layer, state)); + // Don't send state changes unless there was an actual change + if (old_state != _zmk_keymap_layer_state) { + LOG_DBG("layer_changed: layer %d state %d", layer, state); + ZMK_EVENT_RAISE(create_layer_state_changed(layer, state)); + } + return 0; } @@ -90,12 +102,18 @@ uint8_t zmk_keymap_layer_default() { return _zmk_keymap_layer_default; } zmk_keymap_layers_state_t zmk_keymap_layer_state() { return _zmk_keymap_layer_state; } +bool zmk_keymap_layer_active_with_state(uint8_t layer, zmk_keymap_layers_state_t state_to_test) { + // The default layer is assumed to be ALWAYS ACTIVE so we include an || here to ensure nobody + // breaks up that assumption by accident + return (state_to_test & (BIT(layer))) == (BIT(layer)) || layer == _zmk_keymap_layer_default; +}; + bool zmk_keymap_layer_active(uint8_t layer) { - return (_zmk_keymap_layer_state & (BIT(layer))) == (BIT(layer)); + return zmk_keymap_layer_active_with_state(layer, _zmk_keymap_layer_state); }; uint8_t zmk_keymap_highest_layer_active() { - for (uint8_t layer = 31; layer > 0; layer--) { + for (uint8_t layer = ZMK_KEYMAP_LAYERS_LEN - 1; layer > 0; layer--) { if (zmk_keymap_layer_active(layer)) { return layer; } @@ -115,8 +133,14 @@ int zmk_keymap_layer_toggle(uint8_t layer) { return zmk_keymap_layer_activate(layer); }; -bool is_active_layer(uint8_t layer, zmk_keymap_layers_state_t layer_state) { - return (layer_state & BIT(layer)) == BIT(layer) || layer == _zmk_keymap_layer_default; +int zmk_keymap_layer_to(uint8_t layer) { + for (int i = ZMK_KEYMAP_LAYERS_LEN - 1; i >= 0; i--) { + zmk_keymap_layer_deactivate(i); + } + + zmk_keymap_layer_activate(layer); + + return 0; } int zmk_keymap_apply_position_state(int layer, uint32_t position, bool pressed, int64_t timestamp) { @@ -150,7 +174,7 @@ int zmk_keymap_position_state_changed(uint32_t position, bool pressed, int64_t t zmk_keymap_active_behavior_layer[position] = _zmk_keymap_layer_state; } for (int layer = ZMK_KEYMAP_LAYERS_LEN - 1; layer >= _zmk_keymap_layer_default; layer--) { - if (is_active_layer(layer, zmk_keymap_active_behavior_layer[position])) { + if (zmk_keymap_layer_active_with_state(layer, zmk_keymap_active_behavior_layer[position])) { int ret = zmk_keymap_apply_position_state(layer, position, pressed, timestamp); if (ret > 0) { LOG_DBG("behavior processing to continue to next layer"); @@ -171,9 +195,7 @@ int zmk_keymap_position_state_changed(uint32_t position, bool pressed, int64_t t int zmk_keymap_sensor_triggered(uint8_t sensor_number, const struct device *sensor, int64_t timestamp) { for (int layer = ZMK_KEYMAP_LAYERS_LEN - 1; layer >= _zmk_keymap_layer_default; layer--) { - if (((_zmk_keymap_layer_state & BIT(layer)) == BIT(layer) || - layer == _zmk_keymap_layer_default) && - zmk_sensor_keymap[layer] != NULL) { + if (zmk_keymap_layer_active(layer) && zmk_sensor_keymap[layer] != NULL) { struct zmk_behavior_binding *binding = &zmk_sensor_keymap[layer][sensor_number]; const struct device *behavior; int ret; diff --git a/app/tests/to-layer/behavior_keymap.dtsi b/app/tests/to-layer/behavior_keymap.dtsi new file mode 100644 index 00000000..81e7e809 --- /dev/null +++ b/app/tests/to-layer/behavior_keymap.dtsi @@ -0,0 +1,22 @@ +#include +#include +#include + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &to 0 &to 1 + &kp A &kp S>; + }; + + second_layer { + bindings = < + &to 0 &to 1 + &kp J &kp K>; + }; + }; +}; diff --git a/app/tests/to-layer/normal/events.patterns b/app/tests/to-layer/normal/events.patterns new file mode 100644 index 00000000..fcebc4b0 --- /dev/null +++ b/app/tests/to-layer/normal/events.patterns @@ -0,0 +1,3 @@ +s/.*hid_listener_keycode/kp/p +s/.*to_keymap_binding/to/p +s/.*layer_changed/layer_changed/p \ No newline at end of file diff --git a/app/tests/to-layer/normal/keycode_events.snapshot b/app/tests/to-layer/normal/keycode_events.snapshot new file mode 100644 index 00000000..930a977a --- /dev/null +++ b/app/tests/to-layer/normal/keycode_events.snapshot @@ -0,0 +1,18 @@ +kp_pressed: usage_page 0x07 keycode 0x16 mods 0x00 +kp_released: usage_page 0x07 keycode 0x16 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 +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 +to_pressed: position 0 layer 0 +to_released: position 0 layer 0 +to_pressed: position 1 layer 1 +layer_changed: layer 1 state 1 +to_released: position 1 layer 1 diff --git a/app/tests/to-layer/normal/native_posix.keymap b/app/tests/to-layer/normal/native_posix.keymap new file mode 100644 index 00000000..056341f7 --- /dev/null +++ b/app/tests/to-layer/normal/native_posix.keymap @@ -0,0 +1,29 @@ +#include +#include +#include +#include "../behavior_keymap.dtsi" + +// Press key A +// To layer 1 +// Press key J +// To layer 0 +// Press key S +// To layer 0 -- does nothing + +&kscan { + events = ; +}; \ No newline at end of file diff --git a/docs/docs/behaviors/layers.md b/docs/docs/behaviors/layers.md index fcfdc93a..35e37aef 100644 --- a/docs/docs/behaviors/layers.md +++ b/docs/docs/behaviors/layers.md @@ -57,6 +57,21 @@ Example: < LOWER SPACE ``` +## To Layer + +The "to layer" behavior enables a layer and disables _all_ other layers _except_ the default layer. + +### Behavior Binding + +- Reference: `&to` +- Parameter: The layer number to enable, e.g. `1` + +Example: + +``` +&to 3 +``` + ## Toggle Layer The "toggle layer" behavior enables a layer until the layer is manually disabled. From 1c822754c018ad88e281f834f62b38a690ce38c2 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Tue, 29 Dec 2020 23:30:30 -0500 Subject: [PATCH 13/16] fix(west): Restore atmel west module. --- app/west.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/west.yml b/app/west.yml index d49eee9a..ca5efad2 100644 --- a/app/west.yml +++ b/app/west.yml @@ -15,7 +15,6 @@ manifest: # TODO: Rename once upstream offers option like `exclude` or `denylist` name-blacklist: - ci-tools - - hal_atmel - hal_altera - hal_cypress - hal_infineon From d6988477692f6892096885ed39953a7814a8f53a Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Wed, 30 Dec 2020 09:29:57 -0500 Subject: [PATCH 14/16] fix(power): Fix for 2.4 API changes. --- app/src/ext_power_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/ext_power_generic.c b/app/src/ext_power_generic.c index c2e89ab8..d8e7844e 100644 --- a/app/src/ext_power_generic.c +++ b/app/src/ext_power_generic.c @@ -178,7 +178,7 @@ static int ext_power_generic_init(const struct device *dev) { static int ext_power_generic_pm_control(const struct device *dev, uint32_t ctrl_command, void *context, device_pm_cb cb, void *arg) { int rc; - struct ext_power_generic_data *data = dev->driver_data; + struct ext_power_generic_data *data = dev->data; switch (ctrl_command) { case DEVICE_PM_SET_POWER_STATE: From 5072590af523cf25941e05945d490d350f148797 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Wed, 30 Dec 2020 15:43:46 -0500 Subject: [PATCH 15/16] fix(sensors): Use status filter on sensors node. --- app/include/zmk/sensors.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/include/zmk/sensors.h b/app/include/zmk/sensors.h index 63dcade0..8c6c28b3 100644 --- a/app/include/zmk/sensors.h +++ b/app/include/zmk/sensors.h @@ -7,6 +7,6 @@ #pragma once #define ZMK_KEYMAP_SENSORS_NODE DT_INST(0, zmk_keymap_sensors) -#define ZMK_KEYMAP_HAS_SENSORS DT_NODE_EXISTS(ZMK_KEYMAP_SENSORS_NODE) +#define ZMK_KEYMAP_HAS_SENSORS DT_NODE_HAS_STATUS(ZMK_KEYMAP_SENSORS_NODE, okay) #define ZMK_KEYMAP_SENSORS_LEN DT_PROP_LEN(ZMK_KEYMAP_SENSORS_NODE, sensors) -#define ZMK_KEYMAP_SENSORS_BY_IDX(idx) DT_PHANDLE_BY_IDX(ZMK_KEYMAP_SENSORS_NODE, sensors, idx) \ No newline at end of file +#define ZMK_KEYMAP_SENSORS_BY_IDX(idx) DT_PHANDLE_BY_IDX(ZMK_KEYMAP_SENSORS_NODE, sensors, idx) From 39490552f2a84282143e0ec039fdaf4b2f309539 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Wed, 30 Dec 2020 15:44:03 -0500 Subject: [PATCH 16/16] feat(boards): Add BDN9 Rev2 board. * Onboard stm32f072. * 3 possible encoder positions. * Underglow/per-key not yet support. --- .github/workflows/build.yml | 1 + app/boards/arm/bdn9/Kconfig.board | 8 ++ app/boards/arm/bdn9/Kconfig.defconfig | 17 ++++ app/boards/arm/bdn9/README.md | 37 ++++++++ app/boards/arm/bdn9/bdn9_rev2.dts | 107 ++++++++++++++++++++++++ app/boards/arm/bdn9/bdn9_rev2.keymap | 38 +++++++++ app/boards/arm/bdn9/bdn9_rev2.yaml | 14 ++++ app/boards/arm/bdn9/bdn9_rev2_defconfig | 29 +++++++ app/boards/arm/bdn9/board.cmake | 7 ++ docs/docs/hardware.md | 1 + 10 files changed, 259 insertions(+) create mode 100644 app/boards/arm/bdn9/Kconfig.board create mode 100644 app/boards/arm/bdn9/Kconfig.defconfig create mode 100644 app/boards/arm/bdn9/README.md create mode 100644 app/boards/arm/bdn9/bdn9_rev2.dts create mode 100644 app/boards/arm/bdn9/bdn9_rev2.keymap create mode 100644 app/boards/arm/bdn9/bdn9_rev2.yaml create mode 100644 app/boards/arm/bdn9/bdn9_rev2_defconfig create mode 100644 app/boards/arm/bdn9/board.cmake diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0aee5d7f..288a2dee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,6 +57,7 @@ jobs: - tidbit cmake-args: [""] include: + - board: bdn9_rev2 - board: dz60rgb_rev1 - board: nrf52840_m2 shield: m60 diff --git a/app/boards/arm/bdn9/Kconfig.board b/app/boards/arm/bdn9/Kconfig.board new file mode 100644 index 00000000..a67e9a51 --- /dev/null +++ b/app/boards/arm/bdn9/Kconfig.board @@ -0,0 +1,8 @@ +# keeb.io BDN9 board configuration + +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config BOARD_BDN9 + bool "BDN9 rev2" + depends on SOC_STM32F072XB diff --git a/app/boards/arm/bdn9/Kconfig.defconfig b/app/boards/arm/bdn9/Kconfig.defconfig new file mode 100644 index 00000000..9af7ca4c --- /dev/null +++ b/app/boards/arm/bdn9/Kconfig.defconfig @@ -0,0 +1,17 @@ +# keeb.io BDN9 board configuration + +# Copyright (c) 2020 Pete Johanson +# SPDX-License-Identifier: MIT + +if BOARD_BDN9 + +config BOARD + default "bdn9_rev2" + +config ZMK_KEYBOARD_NAME + default "BDN9 Rev2" + +config ZMK_USB + default y + +endif # BOARD_BDN9 diff --git a/app/boards/arm/bdn9/README.md b/app/boards/arm/bdn9/README.md new file mode 100644 index 00000000..7b4ef441 --- /dev/null +++ b/app/boards/arm/bdn9/README.md @@ -0,0 +1,37 @@ +# Building ZMK for the BDN9 + +Some general notes/commands for building standard BDN9 layouts from the assembly documentation. + +## Standard Build + +``` +west build -p -d build/bdn9 --board bdn9_rev2 +``` + +## Encoder Notes + +If you built your BDN9 with encoders, you'll need to change the following in your local BDN9 config or add them to the end of the file. + +``` +CONFIG_EC11=y +CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y +``` + +Then, you'll want to uncomment the necessary encoder lines in your `bdn9_rev2.keymap`: + +``` +&sensors { + status = "okay"; + sensors = <&left_encoder &mid_encoder &right_encoder>; +}; + +&left_encoder { status = "okay"; }; +&mid_encoder { status = "okay"; }; +&right_encoder { status = "okay"; }; +``` + +And then add the correct `sensor-bindings` array to each keymap layer, e.g.: + +``` +sensor-bindings = <&inc_dec_kp PG_UP PG_DN &inc_dec_kp M_VOLU M_VOLD &inc_dec_kp C_PREV C_NEXT>; +``` diff --git a/app/boards/arm/bdn9/bdn9_rev2.dts b/app/boards/arm/bdn9/bdn9_rev2.dts new file mode 100644 index 00000000..43854a16 --- /dev/null +++ b/app/boards/arm/bdn9/bdn9_rev2.dts @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +/dts-v1/; +#include + +/ { + model = "Keeb.io BDN9 rev2"; + compatible = "keebio,bdn9", "st,stm32f072"; + + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zmk,kscan = &kscan; + /* TODO: Enable once the GPIO bitbanging driver supports STM32 + zmk,underglow = &led_strip; + */ + }; + + kscan: kscan { + compatible = "zmk,kscan-gpio-direct"; + label = "KSCAN"; + + input-gpios + = <&gpiob 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpiob 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpiob 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpiob 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpiob 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpiob 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpioa 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpiof 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpiof 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + ; + }; + + /* + led_strip: ws2812 { + compatible = "worldsemi,ws2812-gpio"; + label = "WS2812"; + + in-gpios = <&gpiob 15 0>; + + chain-length = <9>; + }; + */ + + left_encoder: encoder_left { + compatible = "alps,ec11"; + label = "LEFT_ENCODER"; + a-gpios = <&gpioa 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&gpioa 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + resolution = <4>; + status = "disabled"; + }; + mid_encoder: encoder_mid { + compatible = "alps,ec11"; + label = "MID_ENCODER"; + a-gpios = <&gpioa 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&gpioa 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + resolution = <4>; + status = "disabled"; + }; + right_encoder: encoder_right { + compatible = "alps,ec11"; + label = "RIGHT_ENCODER"; + a-gpios = <&gpioa 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&gpiob 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + resolution = <4>; + status = "disabled"; + }; + + sensors: sensors { + compatible = "zmk,keymap-sensors"; + status = "disabled"; + sensors = <>; + }; +}; + +&usb { + status = "okay"; +}; + +&rtc { + status = "okay"; +}; + +&flash0 { + /* + * For more information, see: + * http://docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions + */ + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* Set 6Kb of storage at the end of the 128Kb of flash */ + storage_partition: partition@3e800 { + label = "storage"; + reg = <0x0001e800 0x00001800>; + }; + }; +}; diff --git a/app/boards/arm/bdn9/bdn9_rev2.keymap b/app/boards/arm/bdn9/bdn9_rev2.keymap new file mode 100644 index 00000000..50c273c7 --- /dev/null +++ b/app/boards/arm/bdn9/bdn9_rev2.keymap @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include + +/* Uncomment and keep whatever encoders are on your BDN9 +&sensors { + status = "okay"; + sensors = <&left_encoder &mid_encoder &right_encoder>; +}; +*/ + +// Uncomment each encoder installed on your BDN9 +// &left_encoder { status = "okay"; }; +// &mid_encoder { status = "okay"; }; +// &right_encoder { status = "okay"; }; + +/ { + keymap { + compatible = "zmk,keymap"; + + default_layer { + bindings = < + &kp HOME &kp K_PP &kp END + &kp PG_UP &kp UP &kp PG_DN + &kp LEFT &kp DOWN &kp RIGHT + >; + /* Uncomment and add necessary bindings. This examples is for one encoder + sensor-bindings = <&inc_dec_kp PG_UP PG_DN>; + */ + }; + }; +}; + diff --git a/app/boards/arm/bdn9/bdn9_rev2.yaml b/app/boards/arm/bdn9/bdn9_rev2.yaml new file mode 100644 index 00000000..bbae8833 --- /dev/null +++ b/app/boards/arm/bdn9/bdn9_rev2.yaml @@ -0,0 +1,14 @@ +identifier: bdn9 +name: keeb.io BDN9 +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +ram: 40 +supported: + - encoders + - switches + - underglow + - per_key diff --git a/app/boards/arm/bdn9/bdn9_rev2_defconfig b/app/boards/arm/bdn9/bdn9_rev2_defconfig new file mode 100644 index 00000000..139cf853 --- /dev/null +++ b/app/boards/arm/bdn9/bdn9_rev2_defconfig @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: MIT + +CONFIG_SOC_SERIES_STM32F0X=y +CONFIG_SOC_STM32F072XB=y +# 72MHz system clock +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=72000000 + +# Floating Point Options +CONFIG_FPU=y + +# enable GPIO +CONFIG_GPIO=y + +# Needed to reduce this to size that will fit on F072 +CONFIG_HEAP_MEM_POOL_SIZE=1024 + +# clock configuration +CONFIG_CLOCK_CONTROL=y + +# Clock configuration for Cube Clock control driver +CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y +# use HSI as PLL input +CONFIG_CLOCK_STM32_PLL_SRC_HSI=y +# produce 72MHz clock at PLL output +CONFIG_CLOCK_STM32_PLL_PREDIV=1 +CONFIG_CLOCK_STM32_PLL_MULTIPLIER=12 +CONFIG_CLOCK_STM32_AHB_PRESCALER=1 +CONFIG_CLOCK_STM32_APB1_PRESCALER=2 +CONFIG_CLOCK_STM32_APB2_PRESCALER=1 diff --git a/app/boards/arm/bdn9/board.cmake b/app/boards/arm/bdn9/board.cmake new file mode 100644 index 00000000..4f430e12 --- /dev/null +++ b/app/boards/arm/bdn9/board.cmake @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: MIT + +board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse") +board_runner_args(jlink "--device=STM32F072CB" "--speed=4000") + +include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/docs/docs/hardware.md b/docs/docs/hardware.md index 406b9ad8..89761c42 100644 --- a/docs/docs/hardware.md +++ b/docs/docs/hardware.md @@ -19,6 +19,7 @@ That being said, there are currently only a few specific [boards](/docs/faq#what - [nrfMicro](https://github.com/joric/nrfmicro) (`nrfmicro_13`, `nrfmicro_11`, `nrfmicro_11_flipped`) - [BlueMicro840](https://store.jpconstantineau.com/#/group/bluemicro) (`bluemicro840_v1`) - [QMK Proton-C](https://qmk.fm/proton-c/) (`proton_c`) +- [BDN9 Rev2](https://keeb.io/products/bdn9-rev-2-3x3-9-key-macropad-rotary-encoder-and-rgb) (`bdn9_rev2`) ## Keyboard Shields