From 0460472bc0ba3c39196950c2415fce65f4da33b6 Mon Sep 17 00:00:00 2001 From: Dusan Date: Fri, 9 Aug 2024 02:23:19 +0200 Subject: [PATCH] dongle --- boards/shields/.gitkeep | 0 build.yaml | 26 +--- config/boards/shields/kb/Kconfig.defconfig | 22 ++++ config/boards/shields/kb/Kconfig.shield | 8 ++ config/boards/shields/kb/kb.conf | 8 ++ config/boards/shields/kb/kb.dtsi | 33 ++++++ .../shields/kb/kb.keymap} | 112 +++++++++--------- config/boards/shields/kb/kb.zmk.yml | 13 ++ config/boards/shields/kb/kb_common.dtsi | 53 +++++++++ config/boards/shields/kb/kb_dongle.conf | 6 + config/boards/shields/kb/kb_dongle.overlay | 27 +++++ config/boards/shields/kb/kb_left.conf | 4 + config/boards/shields/kb/kb_left.overlay | 23 ++++ config/boards/shields/kb/kb_right.conf | 4 + config/boards/shields/kb/kb_right.overlay | 28 +++++ config/kyria_rev3.conf | 7 -- config/west.yml | 4 +- zephyr/module.yml | 3 - 18 files changed, 289 insertions(+), 92 deletions(-) delete mode 100644 boards/shields/.gitkeep create mode 100644 config/boards/shields/kb/Kconfig.defconfig create mode 100644 config/boards/shields/kb/Kconfig.shield create mode 100644 config/boards/shields/kb/kb.conf create mode 100644 config/boards/shields/kb/kb.dtsi rename config/{kyria_rev3.keymap => boards/shields/kb/kb.keymap} (58%) create mode 100644 config/boards/shields/kb/kb.zmk.yml create mode 100644 config/boards/shields/kb/kb_common.dtsi create mode 100644 config/boards/shields/kb/kb_dongle.conf create mode 100644 config/boards/shields/kb/kb_dongle.overlay create mode 100644 config/boards/shields/kb/kb_left.conf create mode 100644 config/boards/shields/kb/kb_left.overlay create mode 100644 config/boards/shields/kb/kb_right.conf create mode 100644 config/boards/shields/kb/kb_right.overlay delete mode 100644 config/kyria_rev3.conf delete mode 100644 zephyr/module.yml diff --git a/boards/shields/.gitkeep b/boards/shields/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/build.yaml b/build.yaml index ca68e6e..d82cf5a 100644 --- a/build.yaml +++ b/build.yaml @@ -1,24 +1,10 @@ -# This file generates the GitHub Actions matrix. -# For simple board + shield combinations, add them to the top level board and -# shield arrays, for more control, add individual board + shield combinations -# to the `include` property. You can also use the `cmake-args` property to -# pass flags to the build command and `artifact-name` to assign a name to -# distinguish build outputs from each other: -# -# board: [ "nice_nano_v2" ] -# shield: [ "corne_left", "corne_right" ] -# include: -# - board: bdn9_rev2 -# - board: nice_nano_v2 -# shield: reviung41 -# - board: nice_nano_v2 -# shield: corne_left -# cmake-args: -DCONFIG_ZMK_USB_LOGGING=y -# artifact-name: corne_left_with_logging -# --- include: - board: nice_nano_v2 - shield: kyria_rev3_left + shield: kb_left - board: nice_nano_v2 - shield: kyria_rev3_right + shield: kb_right + - board: nice_nano_v2 + shield: kb_dongle + - board: nice_nano_v2 + shield: settings_reset diff --git a/config/boards/shields/kb/Kconfig.defconfig b/config/boards/shields/kb/Kconfig.defconfig new file mode 100644 index 0000000..5a273eb --- /dev/null +++ b/config/boards/shields/kb/Kconfig.defconfig @@ -0,0 +1,22 @@ +if SHIELD_KB_DONGLE + +config ZMK_KEYBOARD_NAME + default "Kyria" + +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + +config ZMK_USB + default y + +endif + +if SHIELD_KB_LEFT || SHIELD_KB_RIGHT || SHIELD_KB_DONGLE + +config ZMK_SPLIT + default y + +config ZMK_BLE + default y + +endif diff --git a/config/boards/shields/kb/Kconfig.shield b/config/boards/shields/kb/Kconfig.shield new file mode 100644 index 0000000..fc626f7 --- /dev/null +++ b/config/boards/shields/kb/Kconfig.shield @@ -0,0 +1,8 @@ +config SHIELD_KB_LEFT + def_bool $(shields_list_contains,kb_left) + +config SHIELD_KB_RIGHT + def_bool $(shields_list_contains,kb_right) + +config SHIELD_KB_DONGLE + def_bool $(shields_list_contains,kb_dongle) diff --git a/config/boards/shields/kb/kb.conf b/config/boards/shields/kb/kb.conf new file mode 100644 index 0000000..5fba44e --- /dev/null +++ b/config/boards/shields/kb/kb.conf @@ -0,0 +1,8 @@ +CONFIG_ZMK_SLEEP=y +CONFIG_PM_DEVICE=y +CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=900000 +CONFIG_ZMK_EXT_POWER=y + +CONFIG_ZMK_KEYBOARD_NAME="Kyria" + +CONFIG_BT_CTLR_TX_PWR_PLUS_8=n diff --git a/config/boards/shields/kb/kb.dtsi b/config/boards/shields/kb/kb.dtsi new file mode 100644 index 0000000..b65e37d --- /dev/null +++ b/config/boards/shields/kb/kb.dtsi @@ -0,0 +1,33 @@ +#include "kb_common.dtsi" + +/ { + chosen { + zmk,matrix-transform = &default_transform; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <14>; + rows = <4>; + // | MX6 | MX5 | MX4 | MX3 | MX2 | MX1 | | MX1 | MX2 | MX3 | MX4 | MX5 | MX6 | + // | MX12 | MX11 | MX10 | MX9 | MX8 | MX7 | | MX7 | MX8 | MX9 | MX10 | MX11 | MX12 | + // | MX20 | MX19 | MX18 | MX17 | MX16 | MX15 | MX14 | MX13 | | MX13 | MX14 | MX15 | MX16 | MX17 | MX18 | MX19 | MX20 | + // | MX25 | MX24 | MX23 | MX22 | MX21 | | MX21 | MX22 | MX23 | MX24 | MX25 | + map = < + RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,8) RC(0,9) RC(0,10) RC(0,11) RC(0,12) RC(0,13) + RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,8) RC(1,9) RC(1,10) RC(1,11) RC(1,12) RC(1,13) + RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(3,3) RC(2,6) RC(2,7) RC(3,10) RC(2,8) RC(2,9) RC(2,10) RC(2,11) RC(2,12) RC(2,13) + RC(3,2) RC(3,4) RC(3,5) RC(3,1) RC(3,6) RC(3,7) RC(3,12) RC(3,8) RC(3,9) RC(3,11) + >; + }; +}; + +&left_encoder { + a-gpios = <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; +}; + +&right_encoder { + a-gpios = <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; +}; diff --git a/config/kyria_rev3.keymap b/config/boards/shields/kb/kb.keymap similarity index 58% rename from config/kyria_rev3.keymap rename to config/boards/shields/kb/kb.keymap index 41645ee..9c42318 100644 --- a/config/kyria_rev3.keymap +++ b/config/boards/shields/kb/kb.keymap @@ -1,94 +1,88 @@ -/* - * Copyright (c) 2023 The ZMK Contributors - * - * SPDX-License-Identifier: MIT - */ - #include #include #include < { - tapping-term-ms = <300>; - flavor = "hold-preferred"; + tapping-term-ms = <300>; + flavor = "hold-preferred"; }; / { - behaviors { - shift_sym: shift_sym { - compatible = "zmk,behavior-mod-morph"; - label = "SHIFT_SYM"; - bindings = << 1 ENTER>, <&to 1>; + behaviors { + shift_sym: shift_sym { + compatible = "zmk,behavior-mod-morph"; + label = "SHIFT_SYM"; + bindings = << 1 ENTER>, <&to 1>; - #binding-cells = <0>; - mods = <(MOD_LSFT|MOD_RSFT)>; - }; + #binding-cells = <0>; + mods = <(MOD_LSFT|MOD_RSFT)>; + }; - shift_nav: shift_nav { - compatible = "zmk,behavior-mod-morph"; - label = "SHIFT_NAV"; - bindings = << 2 SPACE>, <&to 2>; + shift_nav: shift_nav { + compatible = "zmk,behavior-mod-morph"; + label = "SHIFT_NAV"; + bindings = << 2 SPACE>, <&to 2>; - #binding-cells = <0>; - mods = <(MOD_LSFT|MOD_RSFT)>; - }; + #binding-cells = <0>; + mods = <(MOD_LSFT|MOD_RSFT)>; + }; - bc_del: bc_del { - compatible = "zmk,behavior-mod-morph"; - label = "BC_DEL"; - bindings = <&kp BACKSPACE>, <&kp DELETE>; + bc_del: bc_del { + compatible = "zmk,behavior-mod-morph"; + label = "BC_DEL"; + bindings = <&kp BACKSPACE>, <&kp DELETE>; - #binding-cells = <0>; - mods = <(MOD_LSFT|MOD_RSFT)>; - }; - }; + #binding-cells = <0>; + mods = <(MOD_LSFT|MOD_RSFT)>; + }; + }; - keymap { - compatible = "zmk,keymap"; + keymap { + compatible = "zmk,keymap"; - alpha { - bindings = < + alpha { + bindings = < &kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &bc_del &kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp K_FORWARD &kp LSHFT &mo 3 &kp K_BACK &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp BACKSLASH - &kp LCTRL &kp LALT &kp LGUI &mt LCTRL SPACE &shift_nav &shift_sym &mt RIGHT_SHIFT ENTER &kp RIGHT_GUI &kp RIGHT_ALT &kp K_MENU - >; - }; + &kp LCTRL &kp LALT &kp LGUI &mt LCTRL SPACE &shift_nav &shift_sym &mt RIGHT_SHIFT ENTER &kp RIGHT_GUI &kp RIGHT_ALT &kp K_MENU + >; + }; - sym { - bindings = < + sym { + bindings = < &kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp EQUAL &kp BSPC &kp EXCL &kp AT_SIGN &kp HASH &kp DOLLAR &kp PERCENT &kp CARET &kp AMPERSAND &kp ASTERISK &kp LEFT_PARENTHESIS &kp RIGHT_PARENTHESIS &kp PLUS &kp PIPE &kp BACKSLASH &kp COLON &kp SEMICOLON &kp MINUS &kp LEFT_BRACKET &kp LEFT_BRACE &trans &trans &kp RIGHT_BRACE &kp RIGHT_BRACKET &kp UNDERSCORE &kp COMMA &kp PERIOD &kp SLASH &kp QUESTION - &trans &trans &trans &trans &trans &to 0 &trans &trans &trans &trans - >; - }; + &trans &trans &trans &trans &trans &to 0 &trans &trans &trans &trans + >; + }; - nav { - bindings = < + nav { + bindings = < &trans &trans &trans &trans &trans &trans &kp PG_UP &kp HOME &kp UP_ARROW &kp END &kp C_VOLUME_UP &kp DELETE &kp C_PLAY_PAUSE &kp K_PLAY_PAUSE &trans &trans &trans &trans &kp PAGE_DOWN &kp LEFT &kp DOWN &kp RIGHT &kp C_VOL_DN &kp INSERT &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp C_PLAY &kp C_STOP &kp C_PREVIOUS &kp C_NEXT &kp C_MUTE &kp PRINTSCREEN - &trans &trans &trans &trans &to 0 &trans &trans &trans &trans &trans - >; - }; + &trans &trans &trans &trans &to 0 &trans &trans &trans &trans &trans + >; + }; - funct { - bindings = < + funct { + bindings = < &trans &kp F9 &kp F10 &kp F11 &kp F12 &trans &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &bt BT_CLR &trans &kp F5 &kp F6 &kp F7 &kp F8 &trans &trans &trans &trans &trans &trans &trans &trans &kp F1 &kp F2 &kp F3 &kp F4 &trans &trans &trans &trans &tog 4 &trans &trans &trans &trans &trans &trans - &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans - >; - }; + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + >; + }; - game { - bindings = < + game { + bindings = < &trans &trans &kp Q &kp W &kp E &kp R &trans &trans &trans &trans &trans &trans &trans &trans &kp A &kp S &kp D &kp F &trans &trans &trans &trans &trans &trans &tog 0 &trans &kp Z &kp X &kp C &kp V &kp G &kp I &trans &trans &trans &trans &trans &trans &trans &tog 0 - &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans - >; - }; - }; + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + >; + }; + }; }; diff --git a/config/boards/shields/kb/kb.zmk.yml b/config/boards/shields/kb/kb.zmk.yml new file mode 100644 index 0000000..cfc5dd3 --- /dev/null +++ b/config/boards/shields/kb/kb.zmk.yml @@ -0,0 +1,13 @@ +file_format: "1" +id: kyria_rev3 +name: Kyria Rev3 +type: shield +url: https://splitkb.com/products/kyria-pcb-kit +requires: [pro_micro] +exposes: [i2c_oled] +features: + - keys +siblings: + - kb_left + - kb_right + - kb_dongle diff --git a/config/boards/shields/kb/kb_common.dtsi b/config/boards/shields/kb/kb_common.dtsi new file mode 100644 index 0000000..b055224 --- /dev/null +++ b/config/boards/shields/kb/kb_common.dtsi @@ -0,0 +1,53 @@ +#include + +/ { + chosen { + zephyr,display = &oled; + zmk,kscan = &kscan0; + zmk,matrix-transform = &default_transform; + }; + + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + wakeup-source; + + diode-direction = "col2row"; + }; + + left_encoder: encoder_left { + compatible = "alps,ec11"; + steps = <80>; + status = "disabled"; + }; + + right_encoder: encoder_right { + compatible = "alps,ec11"; + steps = <80>; + status = "disabled"; + }; + + sensors: sensors { + compatible = "zmk,keymap-sensors"; + sensors = <&left_encoder &right_encoder>; + triggers-per-rotation = <20>; + }; + + // TODO: RGB node(s) +}; + +&pro_micro_i2c { + status = "okay"; + + oled: ssd1306@3c { + compatible = "solomon,ssd1306fb"; + reg = <0x3c>; + width = <128>; + height = <64>; + segment-offset = <0>; + page-offset = <0>; + display-offset = <0>; + multiplex-ratio = <63>; + prechargep = <0x22>; + inversion-on; + }; +}; diff --git a/config/boards/shields/kb/kb_dongle.conf b/config/boards/shields/kb/kb_dongle.conf new file mode 100644 index 0000000..9dc2e97 --- /dev/null +++ b/config/boards/shields/kb/kb_dongle.conf @@ -0,0 +1,6 @@ +CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS=2 +CONFIG_BT_CTLR_TX_PWR_PLUS_8=y + +CONFIG_ZMK_SLEEP=n +CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=900000 +CONFIG_ZMK_EXT_POWER=y diff --git a/config/boards/shields/kb/kb_dongle.overlay b/config/boards/shields/kb/kb_dongle.overlay new file mode 100644 index 0000000..7a52b10 --- /dev/null +++ b/config/boards/shields/kb/kb_dongle.overlay @@ -0,0 +1,27 @@ +#include "kb.dtsi" + +&default_transform { + col-offset = <7>; +}; + +&kscan0 { + row-gpios + = <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + col-gpios + = <&pro_micro 16 GPIO_ACTIVE_HIGH> + , <&pro_micro 4 GPIO_ACTIVE_HIGH> + , <&pro_micro 5 GPIO_ACTIVE_HIGH> + , <&pro_micro 6 GPIO_ACTIVE_HIGH> + , <&pro_micro 7 GPIO_ACTIVE_HIGH> + , <&pro_micro 8 GPIO_ACTIVE_HIGH> + , <&pro_micro 10 GPIO_ACTIVE_HIGH> + ; +}; + +&right_encoder { + status = "okay"; +}; diff --git a/config/boards/shields/kb/kb_left.conf b/config/boards/shields/kb/kb_left.conf new file mode 100644 index 0000000..f6e2c16 --- /dev/null +++ b/config/boards/shields/kb/kb_left.conf @@ -0,0 +1,4 @@ +CONFIG_ZMK_SLEEP=y +CONFIG_PM_DEVICE=y +CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=900000 +CONFIG_ZMK_EXT_POWER=y diff --git a/config/boards/shields/kb/kb_left.overlay b/config/boards/shields/kb/kb_left.overlay new file mode 100644 index 0000000..3c64207 --- /dev/null +++ b/config/boards/shields/kb/kb_left.overlay @@ -0,0 +1,23 @@ +#include "kb.dtsi" + +&kscan0 { + row-gpios + = <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + col-gpios + = <&pro_micro 10 GPIO_ACTIVE_HIGH> + , <&pro_micro 16 GPIO_ACTIVE_HIGH> + , <&pro_micro 14 GPIO_ACTIVE_HIGH> + , <&pro_micro 15 GPIO_ACTIVE_HIGH> + , <&pro_micro 18 GPIO_ACTIVE_HIGH> + , <&pro_micro 19 GPIO_ACTIVE_HIGH> + , <&pro_micro 8 GPIO_ACTIVE_HIGH> + ; +}; + +&left_encoder { + status = "okay"; +}; diff --git a/config/boards/shields/kb/kb_right.conf b/config/boards/shields/kb/kb_right.conf new file mode 100644 index 0000000..f6e2c16 --- /dev/null +++ b/config/boards/shields/kb/kb_right.conf @@ -0,0 +1,4 @@ +CONFIG_ZMK_SLEEP=y +CONFIG_PM_DEVICE=y +CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=900000 +CONFIG_ZMK_EXT_POWER=y diff --git a/config/boards/shields/kb/kb_right.overlay b/config/boards/shields/kb/kb_right.overlay new file mode 100644 index 0000000..bfcad93 --- /dev/null +++ b/config/boards/shields/kb/kb_right.overlay @@ -0,0 +1,28 @@ +#include "kb.dtsi" + +&default_transform { + col-offset = <7>; +}; + +&kscan0 { + row-gpios + = <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + col-gpios + = <&pro_micro 16 GPIO_ACTIVE_HIGH> + , <&pro_micro 4 GPIO_ACTIVE_HIGH> + , <&pro_micro 5 GPIO_ACTIVE_HIGH> + , <&pro_micro 6 GPIO_ACTIVE_HIGH> + , <&pro_micro 7 GPIO_ACTIVE_HIGH> + , <&pro_micro 8 GPIO_ACTIVE_HIGH> + , <&pro_micro 10 GPIO_ACTIVE_HIGH> + ; +}; + +&right_encoder { + status = "okay"; +}; + diff --git a/config/kyria_rev3.conf b/config/kyria_rev3.conf deleted file mode 100644 index 312adc5..0000000 --- a/config/kyria_rev3.conf +++ /dev/null @@ -1,7 +0,0 @@ -CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES=y -CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=3600000 -CONFIG_ZMK_SLEEP=y - -CONFIG_ZMK_BATTERY_REPORT_INTERVAL=600 -CONFIG_BT_PERIPHERAL_PREF_MIN_INT=24 -CONFIG_BT_PERIPHERAL_PREF_MAX_INT=40 diff --git a/config/west.yml b/config/west.yml index b886cbe..adc97b7 100644 --- a/config/west.yml +++ b/config/west.yml @@ -2,12 +2,10 @@ manifest: remotes: - name: zmkfirmware url-base: https://github.com/zmkfirmware - # Additional modules containing boards/shields/custom code can be listed here as well - # See https://docs.zephyrproject.org/3.2.0/develop/west/manifest.html#projects projects: - name: zmk remote: zmkfirmware revision: main import: app/west.yml self: - path: config + path: config \ No newline at end of file diff --git a/zephyr/module.yml b/zephyr/module.yml deleted file mode 100644 index 1cc2b35..0000000 --- a/zephyr/module.yml +++ /dev/null @@ -1,3 +0,0 @@ -build: - settings: - board_root: .