From 23150cdc590b3dd1453c025c5619aafebf5196dc Mon Sep 17 00:00:00 2001 From: Hugo van Rijswijk Date: Tue, 8 Sep 2020 12:09:47 +0200 Subject: [PATCH] Add redox shield --- .github/workflows/build.yml | 2 + app/boards/shields/redox/Kconfig.defconfig | 16 ++++++ app/boards/shields/redox/Kconfig.shield | 8 +++ app/boards/shields/redox/redox.conf | 0 app/boards/shields/redox/redox.dtsi | 51 +++++++++++++++++ app/boards/shields/redox/redox.keymap | 60 ++++++++++++++++++++ app/boards/shields/redox/redox_left.conf | 2 + app/boards/shields/redox/redox_left.overlay | 23 ++++++++ app/boards/shields/redox/redox_right.conf | 2 + app/boards/shields/redox/redox_right.overlay | 27 +++++++++ docs/static/setup.sh | 3 +- 11 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 app/boards/shields/redox/Kconfig.defconfig create mode 100644 app/boards/shields/redox/Kconfig.shield create mode 100644 app/boards/shields/redox/redox.conf create mode 100644 app/boards/shields/redox/redox.dtsi create mode 100644 app/boards/shields/redox/redox.keymap create mode 100644 app/boards/shields/redox/redox_left.conf create mode 100644 app/boards/shields/redox/redox_left.overlay create mode 100644 app/boards/shields/redox/redox_right.conf create mode 100644 app/boards/shields/redox/redox_right.overlay diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8a711c1..b66916fc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,8 @@ jobs: - kyria_right - lily58_left - lily58_right + - redox_left + - redox_right - romac include: - board: proton_c diff --git a/app/boards/shields/redox/Kconfig.defconfig b/app/boards/shields/redox/Kconfig.defconfig new file mode 100644 index 00000000..679e258b --- /dev/null +++ b/app/boards/shields/redox/Kconfig.defconfig @@ -0,0 +1,16 @@ +# Copyright (c) 2020 Pete Johanson, Kurtis Lew +# SPDX-License-Identifier: MIT + +if SHIELD_REDOX_LEFT + +config ZMK_KEYBOARD_NAME + default "Redox Left" + +endif + +if SHIELD_REDOX_RIGHT + +config ZMK_KEYBOARD_NAME + default "Redox Right" + +endif diff --git a/app/boards/shields/redox/Kconfig.shield b/app/boards/shields/redox/Kconfig.shield new file mode 100644 index 00000000..c888b67b --- /dev/null +++ b/app/boards/shields/redox/Kconfig.shield @@ -0,0 +1,8 @@ +# Copyright (c) 2020 Pete Johanson, Kurtis Lew +# SPDX-License-Identifier: MIT + +config SHIELD_REDOX_LEFT + def_bool $(shields_list_contains,redox_left) + +config SHIELD_REDOX_RIGHT + def_bool $(shields_list_contains,redox_right) diff --git a/app/boards/shields/redox/redox.conf b/app/boards/shields/redox/redox.conf new file mode 100644 index 00000000..e69de29b diff --git a/app/boards/shields/redox/redox.dtsi b/app/boards/shields/redox/redox.dtsi new file mode 100644 index 00000000..c4b1fa86 --- /dev/null +++ b/app/boards/shields/redox/redox.dtsi @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2020 Pete Johanson, Kurtis Lew + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + chosen { + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <10>; + rows = <7>; +// | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 | | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | +// | SW13 | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 | | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | SW13 | +// | SW20 | SW19 | SW18 | SW17 | SW16 | SW15 | SW14 | | SW14 | SW15 | SW16 | SW17 | SW18 | SW19 | SW20 | +// | SW28 | SW27 | SW26 | SW25 | SW24 | SW23 | SW22 | SW21 | | SW21 | SW22 | SW23 | SW24 | SW25 | SW26 | SW27 | SW28 | +// | SW35 | SW34 | SW33 | SW32 | | SW31 | | SW30 | SW29 | | SW29 | SW30 | | SW31 | | SW32 | SW33 | SW34 | SW35 | + 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(1,0) RC(1,1) RC(1,2) RC(1,3) +RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(0,6) RC(0,7) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) +RC(2,8) RC(2,9) RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(2,0) RC(2,1) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(4,0) RC(4,1) +RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(3,4) RC(4,8) RC(4,9) RC(3,5) RC(5,0) RC(5,1) RC(5,2) RC(5,3) RC(5,4) RC(5,5) +RC(5,6) RC(5,7) RC(5,8) RC(5,9) RC(6,0) RC(6,1) RC(6,2) RC(6,3) RC(6,4) RC(6,5) RC(6,6) RC(6,7) RC(6,8) RC(6,9) + >; + }; + + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + + diode-direction = "col2row"; + row-gpios + = <&pro_micro_d 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + + }; + + bt_unpair_combo: bt_unpair_combo { + compatible = "zmk,bt-unpair-combo"; + }; +}; diff --git a/app/boards/shields/redox/redox.keymap b/app/boards/shields/redox/redox.keymap new file mode 100644 index 00000000..01ff2f3e --- /dev/null +++ b/app/boards/shields/redox/redox.keymap @@ -0,0 +1,60 @@ +# Copyright (c) 2020 Pete Johanson, Kurtis Lew +# SPDX-License-Identifier: MIT + +#include +#include + +/ { + + keymap { + compatible = "zmk,keymap"; + default_layer { +// ------------------------------------------------------------------------------------------------------------------------------- +// | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - | +// | TAB | Q | W | E | R | T | LOWER | | LOWER | Y | U | I | O | P | = | +// | ESC | A | S | D | F | G | "[" | | "]" | H | J | K | L | ; | ' | +// | SHIFT | Z | X | C | V | B | PGUP | PGDN | | HOME | END | N | M | , | . | / | SHIFT | +// | GUI | + | - | ALT | | CTRL | | BSPC | DEL | | ENTER | SPACE | | ALT | | <- | v | ^ | -> | + bindings = < +&kp GRAV &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp NUM_0 &kp MINUS +&kp TAB &kp Q &kp W &kp E &kp R &kp T &mo 1 &mo 1 &kp Y &kp U &kp I &kp O &kp P &kp EQL +&kp ESC &kp A &kp S &kp D &kp F &kp G &kp LBKT &kp RBKT &kp H &kp J &kp K &kp L &kp SCLN &kp QUOT +&kp LSFT &kp Z &kp X &kp C &kp V &kp B &kp PGUP &kp PGDN &kp HOME &kp END &kp N &kp M &kp CMMA &kp DOT &kp FSLH &kp RSFT +&kp LGUI &kp KPLS &kp MINUS &kp LALT &kp LCTL &kp BKSP &kp DEL &kp RET &kp SPC &kp RALT &kp LARW &kp DARW &kp UAWR &kp RARW + >; + }; + + lower_layer { +// ---------------------------------------------------------------------------------------------------------------------- +// | | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | | +// | | ! | @ | { | } | "|" | | | | / | 7 | 8 | 9 | - | | +// | | # | $ | "[" | "]" | ` | | | | * | 4 | 5 | 6 | + | | +// | | % | ^ | ( | ) | ~ | | | | | | | 1 | 2 | 3 | ENTER | | +// | | | | | | | | | | | | | | 0 | | 0 | . | ENTER | | + bindings = < +&trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &trans +&trans &kp BANG &kp ATSN &kp LCUR &kp RCUR &kp PIPE &trans &trans &kp FSLH &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp MINUS &trans +&trans &kp HASH &kp CURU &kp LBKT &kp RBKT &kp GRAV &trans &trans &kp KMLT &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp KPLS &trans +&trans &kp PRCT &kp CRRT &kp LPRN &kp RPRN &kp TILD &trans &trans &trans &trans &trans &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp RET &trans +&trans &trans &trans &trans &trans &trans &trans &trans &trans &kp NUM_0 &kp NUM_0 &kp DOT &kp RET &trans + >; + }; + +// TODO: raise_layer layout + raise_layer { +// ---------------------------------------------------------------------------------------------------------------------- +// | | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | | +// | | ! | @ | { | } | "|" | | | | / | 7 | 8 | 9 | - | | +// | | # | $ | "[" | "]" | ` | | | | * | 4 | 5 | 6 | + | | +// | | % | ^ | ( | ) | ~ | | | | | | | 1 | 2 | 3 | ENTER | | +// | | | | | | | | | | | | | | 0 | | 0 | . | ENTER | | + bindings = < +&trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &trans +&trans &kp BANG &kp ATSN &kp LCUR &kp RCUR &kp PIPE &trans &trans &kp FSLH &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp MINUS &trans +&trans &kp HASH &kp CURU &kp LBKT &kp RBKT &kp GRAV &trans &trans &kp KMLT &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp KPLS &trans +&trans &kp PRCT &kp CRRT &kp LPRN &kp RPRN &kp TILD &trans &trans &trans &trans &trans &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp RET &trans +&trans &trans &trans &trans &trans &trans &trans &trans &trans &kp NUM_0 &kp NUM_0 &kp DOT &kp RET &trans + >; + }; + }; +}; diff --git a/app/boards/shields/redox/redox_left.conf b/app/boards/shields/redox/redox_left.conf new file mode 100644 index 00000000..1e028a78 --- /dev/null +++ b/app/boards/shields/redox/redox_left.conf @@ -0,0 +1,2 @@ +CONFIG_ZMK_SPLIT=y +CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y diff --git a/app/boards/shields/redox/redox_left.overlay b/app/boards/shields/redox/redox_left.overlay new file mode 100644 index 00000000..eb335f50 --- /dev/null +++ b/app/boards/shields/redox/redox_left.overlay @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2020 Pete Johanson, Kurtis Lew + * + * SPDX-License-Identifier: MIT + */ + +#include "redox.dtsi" + +&kscan0 { + col-gpios + = <&pro_micro_a 3 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 2 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 1 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 0 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 14 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 16 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 10 GPIO_ACTIVE_HIGH> + ; +}; + +&bt_unpair_combo { + key-positions = <0 60>; +}; diff --git a/app/boards/shields/redox/redox_right.conf b/app/boards/shields/redox/redox_right.conf new file mode 100644 index 00000000..990cf7c0 --- /dev/null +++ b/app/boards/shields/redox/redox_right.conf @@ -0,0 +1,2 @@ +CONFIG_ZMK_SPLIT=y +CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y diff --git a/app/boards/shields/redox/redox_right.overlay b/app/boards/shields/redox/redox_right.overlay new file mode 100644 index 00000000..c28ca745 --- /dev/null +++ b/app/boards/shields/redox/redox_right.overlay @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2020 Pete Johanson, Kurtis Lew + * + * SPDX-License-Identifier: MIT + */ + +#include "redox.dtsi" + +&default_transform { + col-offset = <8>; +}; + +&kscan0 { + col-gpios + = <&pro_micro_d 10 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 16 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 14 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 0 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 1 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 2 GPIO_ACTIVE_HIGH> + , <&pro_micro_a 3 GPIO_ACTIVE_HIGH> + ; +}; + +&bt_unpair_combo { + key-positions = <11 71>; +}; diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 5d203a4c..40033e2a 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -38,7 +38,7 @@ echo "" echo "Keyboard Shield Selection:" prompt="Pick an keyboard:" -options=("Kyria" "Lily58" "Corne" "Splitreus62" "Sofle" "Iris" "RoMac") +options=("Kyria" "Lily58" "Corne" "Splitreus62" "Sofle" "Iris" "RoMac" "Redox") PS3="$prompt " # TODO: Add support for "Other" and linking to docs on adding custom shields in user config repos. @@ -54,6 +54,7 @@ select opt in "${options[@]}" "Quit"; do 5 ) shield_title="Sofle" shield="sofle"; split="y"; break;; 6 ) shield_title="Iris" shield="iris"; split="y"; break;; 7 ) shield_title="RoMac" shield="romac"; split="n"; break;; + 8 ) shield_title="Redox" shield="redox"; split="y"; break;; # Add link to docs on adding your own custom shield in your ZMK config! # $(( ${#options[@]}+1 )) ) echo "Other!"; break;;