From 2ff217d39e33ec746559f75ddd7fd020f45f1c3e Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Thu, 25 Jun 2020 23:21:53 -0400 Subject: [PATCH] Refactor ProMicro to a/d connector. --- .../arm/nice_nano/arduino_pro_micro_pins.dtsi | 55 +++++++----- .../arm/proton_c/arduino_pro_micro_pins.dtsi | 55 +++++++----- app/boards/shields/kyria/kyria.overlay | 88 ++++++++++--------- .../petejohanson_proton_handwire.overlay | 8 +- 4 files changed, 120 insertions(+), 86 deletions(-) diff --git a/app/boards/arm/nice_nano/arduino_pro_micro_pins.dtsi b/app/boards/arm/nice_nano/arduino_pro_micro_pins.dtsi index f11dcddf..bd482b5f 100644 --- a/app/boards/arm/nice_nano/arduino_pro_micro_pins.dtsi +++ b/app/boards/arm/nice_nano/arduino_pro_micro_pins.dtsi @@ -5,30 +5,45 @@ */ / { - pro_micro_pins: connector { + pro_micro_d: connector_d { compatible = "arduino-pro-micro"; #gpio-cells = <2>; gpio-map-mask = <0xffffffff 0xffffffc0>; gpio-map-pass-thru = <0 0x3f>; - gpio-map = - <1 0 &gpio0 6 0>, /* D1 */ - <0 0 &gpio0 8 0>, /* D0 */ - <2 0 &gpio0 17 0>, /* D2 */ - <3 0 &gpio0 20 0>, /* D3 */ - <4 0 &gpio0 22 0>, /* D4/A6 */ - <5 0 &gpio0 24 0>, /* D5 */ - <6 0 &gpio1 0 0>, /* D6/A7 */ - <7 0 &gpio0 11 0>, /* D7 */ - <8 0 &gpio1 4 0>, /* D8/A8 */ - <9 0 &gpio1 6 0>, /* D9/A9 */ - <10 0 &gpio0 9 0>, /* D10/A10 */ - <16 0 &gpio0 10 0>, /* D16 */ - <14 0 &gpio1 11 0>, /* D14 */ - <15 0 &gpio1 13 0>, /* D15 */ - <18 0 &gpio1 15 0>, /* A0 */ - <19 0 &gpio0 2 0>, /* A1 */ - <20 0 &gpio0 29 0>, /* A2 */ - <21 0 &gpio0 31 0>; /* A3 */ + gpio-map + = <0 0 &gpio0 8 0> /* D0 */ + , <1 0 &gpio0 6 0> /* D1 */ + , <2 0 &gpio0 17 0> /* D2 */ + , <3 0 &gpio0 20 0> /* D3 */ + , <4 0 &gpio0 22 0> /* D4/A6 */ + , <5 0 &gpio0 24 0> /* D5 */ + , <6 0 &gpio1 0 0> /* D6/A7 */ + , <7 0 &gpio0 11 0> /* D7 */ + , <8 0 &gpio1 4 0> /* D8/A8 */ + , <9 0 &gpio1 6 0> /* D9/A9 */ + , <10 0 &gpio0 9 0> /* D10/A10 */ + , <16 0 &gpio0 10 0> /* D16 */ + , <14 0 &gpio1 11 0> /* D14 */ + , <15 0 &gpio1 13 0> /* D15 */ + ; + }; + + pro_micro_a: connector_a { + compatible = "arduino-pro-micro"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map + = <0 0 &gpio1 15 0> /* A0 */ + , <1 0 &gpio0 2 0> /* A1 */ + , <2 0 &gpio0 29 0> /* A2 */ + , <3 0 &gpio0 31 0> /* A3 */ + , <6 0 &gpio0 22 0> /* D4/A6 */ + , <7 0 &gpio1 0 0> /* D6/A7 */ + , <8 0 &gpio1 4 0> /* D8/A8 */ + , <9 0 &gpio1 6 0> /* D9/A9 */ + , <10 0 &gpio0 9 0> /* D10/A10 */ + ; }; }; diff --git a/app/boards/arm/proton_c/arduino_pro_micro_pins.dtsi b/app/boards/arm/proton_c/arduino_pro_micro_pins.dtsi index d1b050ac..1b22121a 100644 --- a/app/boards/arm/proton_c/arduino_pro_micro_pins.dtsi +++ b/app/boards/arm/proton_c/arduino_pro_micro_pins.dtsi @@ -5,33 +5,44 @@ */ / { - pro_micro_pins: connector { + pro_micro_d: connector_d { compatible = "arduino-pro-micro"; #gpio-cells = <2>; gpio-map-mask = <0xffffffff 0xffffffc0>; gpio-map-pass-thru = <0 0x3f>; - gpio-map = - /* Down the front left side */ - <1 0 &gpioa 9 0>, /* D1 */ - <0 0 &gpioa 10 0>, /* D0 */ - <2 0 &gpiob 7 0>, /* D2 */ - <3 0 &gpiob 6 0>, /* D3 */ - <4 0 &gpiob 5 0>, /* D4/A6 */ - <5 0 &gpiob 4 0>, /* D5 */ - <6 0 &gpiob 3 0>, /* D6/A7 */ - <7 0 &gpiob 2 0>, /* D7 */ - <8 0 &gpiob 1 0>, /* D8/A8 */ - <9 0 &gpiob 0 0>, /* D9/A9 */ + gpio-map + = <00 0 &gpioa 10 0> /* D0 */ + , <01 0 &gpioa 9 0> /* D1 */ + , <02 0 &gpiob 7 0> /* D2 */ + , <03 0 &gpiob 6 0> /* D3 */ + , <04 0 &gpiob 5 0> /* D4/A6 */ + , <05 0 &gpiob 4 0> /* D5 */ + , <06 0 &gpiob 3 0> /* D6/A7 */ + , <07 0 &gpiob 2 0> /* D7 */ + , <08 0 &gpiob 1 0> /* D8/A8 */ + , <09 0 &gpiob 0 0> /* D9/A9 */ + , <10 0 &gpiob 9 0> /* D10/A10 */ + , <16 0 &gpiob 15 0> /* D16 */ + , <14 0 &gpiob 14 0> /* D14 */ + , <15 0 &gpiob 13 0> /* D15 */ + }; - /* Back up the front right side */ - <10 0 &gpiob 9 0>, /* D10/A10 */ - <16 0 &gpiob 15 0>, /* D16 */ - <14 0 &gpiob 14 0>, /* D14 */ - <15 0 &gpiob 13 0>, /* D15 */ - <18 0 &gpiob 8 0>, /* A0 */ - <19 0 &gpioa 0 0>, /* A1 */ - <20 0 &gpioa 1 0>, /* A2 */ - <21 0 &gpioa 2 0>; /* A3 */ + pro_micro_a: connector_a { + compatible = "arduino-pro-micro"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map + = <00 0 &gpiob 8 0> /* A0 */ + , <01 0 &gpioa 0 0> /* A1 */ + , <02 0 &gpioa 1 0> /* A2 */ + , <03 0 &gpioa 2 0> /* A3 */ + , <06 0 &gpiob 5 0> /* D4/A6 */ + , <07 0 &gpiob 3 0> /* D6/A7 */ + , <08 0 &gpiob 1 0> /* D8/A8 */ + , <09 0 &gpiob 0 0> /* D9/A9 */ + , <10 0 &gpiob 9 0> /* D10/A10 */ + ; }; }; diff --git a/app/boards/shields/kyria/kyria.overlay b/app/boards/shields/kyria/kyria.overlay index ddca524a..85b22bec 100644 --- a/app/boards/shields/kyria/kyria.overlay +++ b/app/boards/shields/kyria/kyria.overlay @@ -10,7 +10,7 @@ / { chosen { - zmk,kscan = &kscan0; + zmk,kscan = &kscan_left; zmk,matrix_transform = &default_transform; }; @@ -25,12 +25,12 @@ 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>; - }; + // 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 { @@ -65,41 +65,49 @@ 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) compatible = "zmk,kscan-gpio-matrix"; label = "KSCAN_LEFT"; - diode-direction = "row2col"; - row-gpios = <&pro_micro_pins 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; - - col-gpios = <&pro_micro_pins 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 18 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 19 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 20 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 21 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + 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 = "row2col"; - row-gpios = <&pro_micro_pins 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; - - col-gpios = <&pro_micro_pins 21 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 20 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 19 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 18 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; - }; + // 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 diff --git a/app/boards/shields/petejohanson_proton_handwire/petejohanson_proton_handwire.overlay b/app/boards/shields/petejohanson_proton_handwire/petejohanson_proton_handwire.overlay index 65753fd5..1b27b939 100644 --- a/app/boards/shields/petejohanson_proton_handwire/petejohanson_proton_handwire.overlay +++ b/app/boards/shields/petejohanson_proton_handwire/petejohanson_proton_handwire.overlay @@ -9,9 +9,9 @@ label = "KSCAN"; diode-direction = "row2col"; - row-gpios = <&pro_micro_pins 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; - col-gpios = <&pro_micro_pins 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&pro_micro_pins 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + row-gpios = <&pro_micro_d 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro_d 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + col-gpios = <&pro_micro_d 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&pro_micro_d 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; }; };