diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d74fb89 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,5 @@ +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + uses: zmkfirmware/zmk/.github/workflows/build-user-config.yml@main diff --git a/README.md b/README.md new file mode 100644 index 0000000..e3da391 --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +# ZMK Firmware for Ergonaut One keyboard + +This is a repository for a ZMK Firmware for Ergonaut One keyboard. + +## Default keymap + +Visual representation of the default keymap in keyboard-layout-editor: [KLE](http://www.keyboard-layout-editor.com/#/gists/13d0f7ae7a8b5835efcd23d61f50336a) + +This layout is heavily inspired from [Watchman 42-key layout](https://github.com/aroum/Watchman-layouts) + +## FAQ + +- [FAQ](#faq) + - [How to change the keymap?](#how-to-change-the-keymap) + - [How to flash the keyboard?](#how-to-flash-the-keyboard) + - [How to pair halves?](#how-to-pair-halves) + - [Problems](#problems) + - [I'm getting File Transfer Error after copying firmware to the keyboard](#im-getting-file-transfer-error-after-copying-firmware-to-the-keyboard) + +### How to change the keymap? + +1. Fork or use this repository as a template https://github.com/ergonautkb/one-zmk-config. +2. Enable Github Actions for your repository. + +You have two options on how to configure your desired keymap: + +#### Option 1. Keymap Editor + +1. Open [Keymap Editor](https://nickcoutsos.github.io/keymap-editor/). +2. Connect it to your Github account and give an access to your repository to Keymap Editor's app. +3. Make changes to your keymap and press `Save` - it will trigger software build. Wait for it to complete. +4. Grab the `firmware.zip` archive. + +#### Option 2. Manual + +1. Make changes to the [ergonaut_one.keymap](config/boards/shields/ergonaut_one/ergonaut_one.keymap) file using your favorite text editor. +2. Commit changes to your repository. +3. Go to `Actions` tab in your Github repository, locate the latest build and wait for it to complete. +4. Grab the `firmware.zip` archive + +### How to flash the keyboard? + +1. Obtain `firmware.zip` +2. Unzip `firmware.zip` - you should have `ergonaut_one_left-seeeduino_xiao_ble-zmk.uf2` and `ergonaut_one_right-seeeduino_xiao_ble-zmk.uf2` files +3. Turn off the power for selected halve (move slider to position `OFF`) +4. Connect selected halve to the PC via USB-C cable +5. Press `RESET` button **twice** to enter DFU mode - you should see new USB device in your file manager +6. Copy the corresponding firmware to the root directory of the new USB device +7. Disconnect selected halve from the PC +8. Repeat steps 3-7 for the other halve + +### How to pair halves? + +1. Turn off the power for both halves (move slider to position `OFF`) +2. Turn on the power for both halves (move slider to position `ON`) +3. Press `RESET` button **once** on both halves **simultaneously** + +### Problems + +#### I'm getting File Transfer Error after copying firmware to the keyboard + +It's OK. Proof: https://zmk.dev/docs/troubleshooting#file-transfer-error \ No newline at end of file diff --git a/build.yaml b/build.yaml new file mode 100644 index 0000000..fd852aa --- /dev/null +++ b/build.yaml @@ -0,0 +1,7 @@ +include: + - board: seeeduino_xiao_ble + shield: ergonaut_one_left + - board: seeeduino_xiao_ble + shield: ergonaut_one_right + - board: seeeduino_xiao_ble + shield: settings_reset diff --git a/config/boards/shields/ergonaut_one/Kconfig.defconfig b/config/boards/shields/ergonaut_one/Kconfig.defconfig new file mode 100644 index 0000000..db1b767 --- /dev/null +++ b/config/boards/shields/ergonaut_one/Kconfig.defconfig @@ -0,0 +1,19 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if SHIELD_ERGONAUT_ONE_LEFT + +config ZMK_KEYBOARD_NAME + default "Ergonaut One" + +config ZMK_SPLIT_ROLE_CENTRAL + default y + +endif + +if SHIELD_ERGONAUT_ONE_LEFT || SHIELD_ERGONAUT_ONE_RIGHT + +config ZMK_SPLIT + default y + +endif diff --git a/config/boards/shields/ergonaut_one/Kconfig.shield b/config/boards/shields/ergonaut_one/Kconfig.shield new file mode 100644 index 0000000..f085401 --- /dev/null +++ b/config/boards/shields/ergonaut_one/Kconfig.shield @@ -0,0 +1,8 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config SHIELD_ERGONAUT_ONE_LEFT + def_bool $(shields_list_contains,ergonaut_one_left) + +config SHIELD_ERGONAUT_ONE_RIGHT + def_bool $(shields_list_contains,ergonaut_one_right) diff --git a/config/boards/shields/ergonaut_one/ergonaut_one.dtsi b/config/boards/shields/ergonaut_one/ergonaut_one.dtsi new file mode 100644 index 0000000..0d53ab3 --- /dev/null +++ b/config/boards/shields/ergonaut_one/ergonaut_one.dtsi @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + chosen { + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + /* /delete-property/ zephyr,console; */ + /* /delete-property/ zephyr,shell-uart; */ + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <12>; + rows = <4>; + + // | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 | + // | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 | + // | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 | + // | | | | SW20 | SW21 | SW22 | | SW22 | SW21 | SW20 | | | | + + map = < + RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,11) RC(0,10) RC(0,9) RC(0,8) RC(0,7) RC(0,6) + RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,11) RC(1,10) RC(1,9) RC(1,8) RC(1,7) RC(1,6) + RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,11) RC(2,10) RC(2,9) RC(2,8) RC(2,7) RC(2,6) + RC(3,3) RC(3,4) RC(3,5) RC(3,11) RC(3,10) RC(3,9) + >; + }; + + kscan0: kscan_0 { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + + diode-direction = "col2row"; + row-gpios + = <&xiao_d 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&xiao_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&xiao_d 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&xiao_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + }; +}; + +&xiao_spi { status = "disabled"; }; +&xiao_i2c { status = "disabled"; }; +&xiao_serial { status = "disabled"; }; diff --git a/config/boards/shields/ergonaut_one/ergonaut_one.keymap b/config/boards/shields/ergonaut_one/ergonaut_one.keymap new file mode 100644 index 0000000..6ee719e --- /dev/null +++ b/config/boards/shields/ergonaut_one/ergonaut_one.keymap @@ -0,0 +1,65 @@ +#include +#include +#include + +#define DEF 0 +#define LWR 1 +#define RSE 2 +#define ADJ 3 + +< { + quick-tap-ms = <200>; +}; + +&mt { + quick-tap-ms = <200>; +}; + +/ { + conditional_layers { + compatible = "zmk,conditional-layers"; + + tri-layer { + if-layers = <1 2>; + then-layer = <3>; + }; + }; + + keymap { + compatible = "zmk,keymap"; + + default_layer { + bindings = < + &mt LGUI RBKT &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT + &mt LCTRL GRAVE &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &mt RCTRL SQT + &mt LALT MINUS &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &mt RALT BSLH + < RSE TAB &mt LSHFT SPACE < LWR RET < LWR ESC &mt RSHFT BSPC < RSE DEL + >; + }; + lower_layer { + bindings = < + &mt LGUI F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 + &mt LCTRL PLUS &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp STAR &kp LPAR &kp RPAR &mt RCTRL MINUS + &mt LALT EQUAL &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp RALT + &trans &trans &trans &trans &trans &trans + >; + }; + + raise_layer { + bindings = < + &mt LGUI KP_NUM &kp KP_SLASH &kp KP_N7 &kp KP_N8 &kp KP_N9 &kp KP_MINUS &kp C_VOL_UP &kp HOME &kp PSCRN &kp PG_UP &kp SLCK &kp CLCK + &mt LCTRL EQUAL &kp KP_MULTIPLY &kp KP_N4 &kp KP_N5 &kp KP_N6 &kp KP_PLUS &kp C_MUTE &kp LEFT &kp UP &kp RIGHT &kp INS &mt RCTRL K_APP + &kp LALT &kp KP_N0 &kp KP_N1 &kp KP_N2 &kp KP_N3 &kp KP_DOT &kp C_VOL_DN &kp END &kp DOWN &kp PG_DN &kp PAUSE_BREAK &kp RALT + &trans &trans &trans &trans &trans &trans + >; + }; + adjust_layer { + bindings = < + &bootloader &none &none &none &none &none &none &none &none &none &none &bootloader + &bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &bt BT_SEL 4 &bt BT_SEL 3 &bt BT_SEL 2 &bt BT_SEL 1 &bt BT_SEL 0 &bt BT_CLR + &sys_reset &none &none &none &none &none &none &none &none &none &none &sys_reset + &trans &none &trans &none &trans &trans + >; + }; + }; +}; diff --git a/config/boards/shields/ergonaut_one/ergonaut_one.zmk.yml b/config/boards/shields/ergonaut_one/ergonaut_one.zmk.yml new file mode 100644 index 0000000..d7c537f --- /dev/null +++ b/config/boards/shields/ergonaut_one/ergonaut_one.zmk.yml @@ -0,0 +1,11 @@ +file_format: '1' +id: ergonaut_one +name: Ergonaut One +type: shield +url: https://github.com/ergonautkb/one +requires: [seeeduino_xiao_ble] +features: + - keys +siblings: + - ergonaut_one_left + - ergonaut_one_right diff --git a/config/boards/shields/ergonaut_one/ergonaut_one_left.conf b/config/boards/shields/ergonaut_one/ergonaut_one_left.conf new file mode 100644 index 0000000..c9f7988 --- /dev/null +++ b/config/boards/shields/ergonaut_one/ergonaut_one_left.conf @@ -0,0 +1,2 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT diff --git a/config/boards/shields/ergonaut_one/ergonaut_one_left.overlay b/config/boards/shields/ergonaut_one/ergonaut_one_left.overlay new file mode 100644 index 0000000..c63045b --- /dev/null +++ b/config/boards/shields/ergonaut_one/ergonaut_one_left.overlay @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include "ergonaut_one.dtsi" + +&kscan0 { + col-gpios + = <&xiao_d 0 GPIO_ACTIVE_HIGH> + , <&xiao_d 1 GPIO_ACTIVE_HIGH> + , <&xiao_d 2 GPIO_ACTIVE_HIGH> + , <&xiao_d 3 GPIO_ACTIVE_HIGH> + , <&xiao_d 4 GPIO_ACTIVE_HIGH> + , <&xiao_d 5 GPIO_ACTIVE_HIGH> + ; +}; diff --git a/config/boards/shields/ergonaut_one/ergonaut_one_right.conf b/config/boards/shields/ergonaut_one/ergonaut_one_right.conf new file mode 100644 index 0000000..c9f7988 --- /dev/null +++ b/config/boards/shields/ergonaut_one/ergonaut_one_right.conf @@ -0,0 +1,2 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT diff --git a/config/boards/shields/ergonaut_one/ergonaut_one_right.overlay b/config/boards/shields/ergonaut_one/ergonaut_one_right.overlay new file mode 100644 index 0000000..b4a6cb5 --- /dev/null +++ b/config/boards/shields/ergonaut_one/ergonaut_one_right.overlay @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include "ergonaut_one.dtsi" + +&default_transform { + col-offset = <6>; +}; + +&kscan0 { + col-gpios + = <&xiao_d 0 GPIO_ACTIVE_HIGH> + , <&xiao_d 1 GPIO_ACTIVE_HIGH> + , <&xiao_d 2 GPIO_ACTIVE_HIGH> + , <&xiao_d 3 GPIO_ACTIVE_HIGH> + , <&xiao_d 4 GPIO_ACTIVE_HIGH> + , <&xiao_d 5 GPIO_ACTIVE_HIGH> + ; +}; diff --git a/config/ergonaut_one.conf b/config/ergonaut_one.conf new file mode 100644 index 0000000..ac9038d --- /dev/null +++ b/config/ergonaut_one.conf @@ -0,0 +1,15 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +CONFIG_BT_MAX_CONN=5 +CONFIG_BT_MAX_PAIRED=5 + +CONFIG_ZMK_IDLE_TIMEOUT=30000 +CONFIG_ZMK_SLEEP=y +CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=900000 +CONFIG_ZMK_BATTERY_REPORT_INTERVAL=1800 + +CONFIG_ZMK_USB=y +CONFIG_ZMK_BLE=y + +CONFIG_BT_CTLR_TX_PWR_PLUS_8=y diff --git a/config/ergonaut_one.json b/config/ergonaut_one.json new file mode 100644 index 0000000..e06e36f --- /dev/null +++ b/config/ergonaut_one.json @@ -0,0 +1,56 @@ +{ + "id": "ergonaut_one", + "name": "Ergonaut One", + "layouts": { + "LAYOUT": { + "layout": [ + { "row": 0, "col": 0, "x": 0, "y": 0.375 }, + { "row": 0, "col": 1, "x": 1, "y": 0.375 }, + { "row": 0, "col": 2, "x": 2, "y": 0.125 }, + { "row": 0, "col": 3, "x": 3, "y": 0.000 }, + { "row": 0, "col": 4, "x": 4, "y": 0.125 }, + { "row": 0, "col": 5, "x": 5, "y": 0.250 }, + { "row": 0, "col": 6, "x": 9, "y": 0.250 }, + { "row": 0, "col": 7, "x": 10, "y": 0.125 }, + { "row": 0, "col": 8, "x": 11, "y": 0.000 }, + { "row": 0, "col": 9, "x": 12, "y": 0.125 }, + { "row": 0, "col": 10, "x": 13, "y": 0.375 }, + { "row": 0, "col": 11, "x": 14, "y": 0.375 }, + + { "row": 1, "col": 0, "x": 0, "y": 1.375 }, + { "row": 1, "col": 1, "x": 1, "y": 1.375 }, + { "row": 1, "col": 2, "x": 2, "y": 1.125 }, + { "row": 1, "col": 3, "x": 3, "y": 1.000 }, + { "row": 1, "col": 4, "x": 4, "y": 1.125 }, + { "row": 1, "col": 5, "x": 5, "y": 1.250 }, + { "row": 1, "col": 6, "x": 9, "y": 1.250 }, + { "row": 1, "col": 7, "x": 10, "y": 1.125 }, + { "row": 1, "col": 8, "x": 11, "y": 1.000 }, + { "row": 1, "col": 9, "x": 12, "y": 1.125 }, + { "row": 1, "col": 10, "x": 13, "y": 1.375 }, + { "row": 1, "col": 11, "x": 14, "y": 1.375 }, + + { "row": 2, "col": 0, "x": 0, "y": 2.375 }, + { "row": 2, "col": 1, "x": 1, "y": 2.375 }, + { "row": 2, "col": 2, "x": 2, "y": 2.125 }, + { "row": 2, "col": 3, "x": 3, "y": 2.000 }, + { "row": 2, "col": 4, "x": 4, "y": 2.125 }, + { "row": 2, "col": 5, "x": 5, "y": 2.250 }, + { "row": 2, "col": 6, "x": 9, "y": 2.250 }, + { "row": 2, "col": 7, "x": 10, "y": 2.125 }, + { "row": 2, "col": 8, "x": 11, "y": 2.000 }, + { "row": 2, "col": 9, "x": 12, "y": 2.125 }, + { "row": 2, "col": 10, "x": 13, "y": 2.375 }, + { "row": 2, "col": 11, "x": 14, "y": 2.375 }, + + { "row": 3, "col": 3, "x": 3.5, "y": 3.250 }, + { "row": 3, "col": 4, "x": 3.5, "y": 3.250, "r": 15, "rx": 4, "ry": 8.05 }, + { "row": 3, "col": 5, "x": 3.5, "y": 3.250, "r": 30, "rx": 4, "ry": 8.05 }, + { "row": 3, "col": 6, "x": 10.5, "y": 3.250, "r": -30, "rx": 11, "ry": 8.05 }, + { "row": 3, "col": 7, "x": 10.5, "y": 3.250, "r": -15, "rx": 11, "ry": 8.05 }, + { "row": 3, "col": 8, "x": 10.5, "y": 3.250 } + ] + } + }, + "sensors": [] +} diff --git a/config/ergonaut_one.keymap b/config/ergonaut_one.keymap new file mode 120000 index 0000000..d6403e1 --- /dev/null +++ b/config/ergonaut_one.keymap @@ -0,0 +1 @@ +boards/shields/ergonaut_one/ergonaut_one.keymap \ No newline at end of file diff --git a/config/west.yml b/config/west.yml new file mode 100644 index 0000000..379d291 --- /dev/null +++ b/config/west.yml @@ -0,0 +1,11 @@ +manifest: + remotes: + - name: zmkfirmware + url-base: https://github.com/zmkfirmware + projects: + - name: zmk + remote: zmkfirmware + revision: main + import: app/west.yml + self: + path: config