From 5ffd95694fafa4fb424c9f0122d6f07a486cd81f Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Sat, 27 Jun 2020 00:16:15 -0400 Subject: Kyria left/right overlays, matrix transform fixes * Refactor Kyria into separate left/right "revisions" of the Kyria shield, and include central kyria.dtsi file with common definition. * Fixes for keymaps to work fully with matrix transforms that override effective rows/columns. * Add ability for matrix transform to do row/col offsets, which is needed for split keyboards. --- app/boards/shields/kyria/Kconfig.defconfig | 2 +- app/boards/shields/kyria/Kconfig.shield | 7 +- app/boards/shields/kyria/keymap/keymap.overlay | 2 +- app/boards/shields/kyria/kyria.dtsi | 65 ++++++++++++++ app/boards/shields/kyria/kyria.overlay | 116 ------------------------- app/boards/shields/kyria/kyria_left.overlay | 21 +++++ app/boards/shields/kyria/kyria_right.overlay | 25 ++++++ 7 files changed, 118 insertions(+), 120 deletions(-) create mode 100644 app/boards/shields/kyria/kyria.dtsi delete mode 100644 app/boards/shields/kyria/kyria.overlay create mode 100644 app/boards/shields/kyria/kyria_left.overlay create mode 100644 app/boards/shields/kyria/kyria_right.overlay (limited to 'app/boards/shields/kyria') diff --git a/app/boards/shields/kyria/Kconfig.defconfig b/app/boards/shields/kyria/Kconfig.defconfig index 0bd3562..25af537 100644 --- a/app/boards/shields/kyria/Kconfig.defconfig +++ b/app/boards/shields/kyria/Kconfig.defconfig @@ -1,5 +1,5 @@ -if SHIELD_KYRIA +if SHIELD_KYRIA_LEFT || SHIELD_KYRIA_RIGHT config ZMK_KEYBOARD_NAME default "Kyria" diff --git a/app/boards/shields/kyria/Kconfig.shield b/app/boards/shields/kyria/Kconfig.shield index 598fc81..7dee044 100644 --- a/app/boards/shields/kyria/Kconfig.shield +++ b/app/boards/shields/kyria/Kconfig.shield @@ -1,5 +1,8 @@ # Copyright (c) 2020 Pete Johanson # SPDX-License-Identifier: MIT -config SHIELD_KYRIA - def_bool $(shields_list_contains,kyria) +config SHIELD_KYRIA_LEFT + def_bool $(shields_list_contains,kyria_left) + +config SHIELD_KYRIA_RIGHT + def_bool $(shields_list_contains,kyria_right) diff --git a/app/boards/shields/kyria/keymap/keymap.overlay b/app/boards/shields/kyria/keymap/keymap.overlay index f61bb6c..0c00aef 100644 --- a/app/boards/shields/kyria/keymap/keymap.overlay +++ b/app/boards/shields/kyria/keymap/keymap.overlay @@ -26,7 +26,7 @@ bindings = < &kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp PIPE &kp BKSP &kp A &kp S &kp D &kp F &kp G &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 LSFT &kp LSFT &kp LSFT &kp LSFT &kp N &kp M &kp CMMA &kp DOT &kp BSLH &kp MINUS + &kp LSFT &kp Z &kp X &kp C &kp V &kp B &kp LSFT &kp LSFT &kp LSFT &kp LSFT &kp N &kp M &kp CMMA &kp DOT &kp BSLH &kp MINUS &kp LGUI &kp DEL &kp RET &kp SPC &kp ESC &kp RET &kp SPC &kp TAB &kp BKSP &kp RALT >; }; diff --git a/app/boards/shields/kyria/kyria.dtsi b/app/boards/shields/kyria/kyria.dtsi new file mode 100644 index 0000000..f96adf0 --- /dev/null +++ b/app/boards/shields/kyria/kyria.dtsi @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2020 Pete Johanson + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + chosen { + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <16>; + 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,10) RC(0,11) RC(0,12) RC(0,13) RC(0,14) RC(0,15) +RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,10) RC(1,11) RC(1,12) RC(1,13) RC(1,14) RC(1,15) +RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11) RC(2,12) RC(2,13) RC(2,14) RC(2,15) + RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,12) + >; + }; + +// | MX5 | MX4 | MX3 | MX2 | MX1 | | MX1 | MX2 | MX3 | MX4 | MX5 | +// | MX11 | MX10 | MX9 | MX8 | MX7 | | MX7 | MX8 | MX9 | MX10 | MX11 | +// | MX19 | MX18 | MX17 | MX16 | MX15 | MX14 | MX13 | | MX13 | MX14 | MX15 | MX16 | MX17 | MX18 | MX19 | +// | MX25 | MX24 | MX23 | MX22 | MX21 | | MX21 | MX22 | MX23 | MX24 | MX25 | + five_column_transform: keymap_transform_1 { + compatible = "zmk,matrix-transform"; + columns = <14>; + rows = <4>; + map = < +RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) 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,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(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11) RC(2,12) RC(2,13) + RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) + >; + }; + + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + + diode-direction = "col2row"; + row-gpios + = <&pro_micro_d 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + + }; + + // TODO: Encoder node(s) + // TODO: OLED node + // TODO: RGB node(s) +}; + diff --git a/app/boards/shields/kyria/kyria.overlay b/app/boards/shields/kyria/kyria.overlay deleted file mode 100644 index 85b22be..0000000 --- a/app/boards/shields/kyria/kyria.overlay +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2020 Pete Johanson - * - * SPDX-License-Identifier: MIT - */ - -#include -#include -#include - -/ { - chosen { - zmk,kscan = &kscan_left; - zmk,matrix_transform = &default_transform; - }; - - kscan0: kscan_comp { - compatible = "zmk,kscan-composite"; - - label = "KSCAN_COMP"; - rows = <4>; - columns = <16>; - - left { - kscan = <&kscan_left>; - }; - - // right { - // kscan = <&kscan_right>; - // // TODO: Actually put this in the kscan driver, so it can report - // // HID events directly to host if plugged in directly. - // column-offset = <8>; - // }; - }; - - default_transform: keymap_transform_0 { - compatible = "zmk,matrix-transform"; -// | 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,10) RC(0,11) RC(0,12) RC(0,13) RC(0,14) RC(0,15) -RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,10) RC(1,11) RC(1,12) RC(1,13) RC(1,14) RC(1,15) -RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11) RC(2,12) RC(2,13) RC(2,14) RC(2,15) - RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,12) - >; - }; - -// | MX5 | MX4 | MX3 | MX2 | MX1 | | MX1 | MX2 | MX3 | MX4 | MX5 | -// | MX11 | MX10 | MX9 | MX8 | MX7 | | MX7 | MX8 | MX9 | MX10 | MX11 | -// | MX19 | MX18 | MX17 | MX16 | MX15 | MX14 | MX13 | | MX13 | MX14 | MX15 | MX16 | MX17 | MX18 | MX19 | -// | MX25 | MX24 | MX23 | MX22 | MX21 | | MX21 | MX22 | MX23 | MX24 | MX25 | - five_column_transform: keymap_transform_1 { - compatible = "zmk,matrix-transform"; - map = < -RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) 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,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(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11) RC(2,12) RC(2,13) - RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) - >; - }; - - kscan_left: kscan_left { - compatible = "zmk,kscan-gpio-matrix"; - label = "KSCAN_LEFT"; - - diode-direction = "col2row"; - row-gpios - = <&pro_micro_d 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&pro_micro_d 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - ; - - 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 15 (GPIO_ACTIVE_HIGH)> - , <&pro_micro_d 14 (GPIO_ACTIVE_HIGH)> - , <&pro_micro_d 16 (GPIO_ACTIVE_HIGH)> - , <&pro_micro_d 10 (GPIO_ACTIVE_HIGH)> - ; - - }; - - // kscan_right: kscan_right { - // compatible = "zmk,kscan-gpio-matrix"; - // label = "KSCAN_RIGHT"; - - // diode-direction = "col2row"; - // row-gpios - // = <&pro_micro_d 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - // , <&pro_micro_d 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - // , <&pro_micro_d 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - // , <&pro_micro_d 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - // ; - // col-gpios - // = <&pro_micro_d 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - // , <&pro_micro_d 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - // , <&pro_micro_d 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - // , <&pro_micro_d 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - // , <&pro_micro_a 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - // , <&pro_micro_a 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - // , <&pro_micro_a 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - // , <&pro_micro_a 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - // ; - // }; - - // TODO: Encoder node(s) - // TODO: OLED node - // TODO: RGB node(s) -}; - diff --git a/app/boards/shields/kyria/kyria_left.overlay b/app/boards/shields/kyria/kyria_left.overlay new file mode 100644 index 0000000..c6305bd --- /dev/null +++ b/app/boards/shields/kyria/kyria_left.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2020 Pete Johanson + * + * SPDX-License-Identifier: MIT + */ + +#include "kyria.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 15 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 14 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 16 GPIO_ACTIVE_HIGH> + , <&pro_micro_d 10 GPIO_ACTIVE_HIGH> + ; +}; + diff --git a/app/boards/shields/kyria/kyria_right.overlay b/app/boards/shields/kyria/kyria_right.overlay new file mode 100644 index 0000000..b919bb2 --- /dev/null +++ b/app/boards/shields/kyria/kyria_right.overlay @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2020 Pete Johanson + * + * SPDX-License-Identifier: MIT + */ + +#include "kyria.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_d 15 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> + ; +}; + -- cgit v1.2.3