From 3ae944d0a6d282b65f10f8be240750e90c41a259 Mon Sep 17 00:00:00 2001 From: Kyle McCreery Date: Sun, 4 Sep 2022 02:23:30 -0400 Subject: [PATCH] First draft. Unable to compile sugarglider, but OBE is working as expected. --- app/boards/arm/pillbug/pillbug.dtsi | 4 +- .../shields/sugarglider/Kconfig.defconfig | 7 +- app/boards/shields/sugarglider/Kconfig.shield | 4 +- .../shields/sugarglider/boards/pillbug.conf | 4 +- .../sugarglider/boards/pillbug.overlay | 4 +- .../shields/sugarglider/sugarglider.keymap | 20 +++-- .../shields/sugarglider/sugarglider.overlay | 74 ++++++++++++------- 7 files changed, 70 insertions(+), 47 deletions(-) diff --git a/app/boards/arm/pillbug/pillbug.dtsi b/app/boards/arm/pillbug/pillbug.dtsi index d9521317..5939b943 100644 --- a/app/boards/arm/pillbug/pillbug.dtsi +++ b/app/boards/arm/pillbug/pillbug.dtsi @@ -45,8 +45,8 @@ &i2c0 { compatible = "nordic,nrf-twi"; - sda-pin = <32>; - scl-pin = <24>; + sda-pin = <15>; + scl-pin = <13>; }; &uart0 { diff --git a/app/boards/shields/sugarglider/Kconfig.defconfig b/app/boards/shields/sugarglider/Kconfig.defconfig index 678a858a..39ef5b85 100644 --- a/app/boards/shields/sugarglider/Kconfig.defconfig +++ b/app/boards/shields/sugarglider/Kconfig.defconfig @@ -1,10 +1,10 @@ # Copyright (c) 2022 The ZMK Contributors # SPDX-License-Identifier: MIT -if SHIELD_OBE +if SHIELD_SUGARGLIDER config ZMK_KEYBOARD_NAME - default "OrangeBoyErgo" + default "Sugar Glider" if LVGL @@ -23,4 +23,7 @@ endchoice endif # LVGL +# Enable IO multiplexer +CONFIG_GPIO_MCP23017=y + endif diff --git a/app/boards/shields/sugarglider/Kconfig.shield b/app/boards/shields/sugarglider/Kconfig.shield index e1af663a..684347ef 100644 --- a/app/boards/shields/sugarglider/Kconfig.shield +++ b/app/boards/shields/sugarglider/Kconfig.shield @@ -1,5 +1,5 @@ # Copyright (c) 2022 The ZMK Contributors # SPDX-License-Identifier: MIT -config SHIELD_OBE - def_bool $(shields_list_contains,obe) +config SHIELD_SUGARGLIDER + def_bool $(shields_list_contains,sugarglider) diff --git a/app/boards/shields/sugarglider/boards/pillbug.conf b/app/boards/shields/sugarglider/boards/pillbug.conf index dda71c13..83effb38 100644 --- a/app/boards/shields/sugarglider/boards/pillbug.conf +++ b/app/boards/shields/sugarglider/boards/pillbug.conf @@ -1,3 +1,3 @@ # Uncomment both to enable underglow -CONFIG_ZMK_RGB_UNDERGLOW=y -CONFIG_WS2812_STRIP=y +#CONFIG_ZMK_RGB_UNDERGLOW=y +#CONFIG_WS2812_STRIP=y diff --git a/app/boards/shields/sugarglider/boards/pillbug.overlay b/app/boards/shields/sugarglider/boards/pillbug.overlay index 241862af..7db762a9 100644 --- a/app/boards/shields/sugarglider/boards/pillbug.overlay +++ b/app/boards/shields/sugarglider/boards/pillbug.overlay @@ -4,12 +4,12 @@ * SPDX-License-Identifier: MIT */ - #include +#include &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; - mosi-pin = <25>; + mosi-pin = <36>; // Unused pins, needed for SPI definition, but not used by the ws2812 driver itself. sck-pin = <27>; miso-pin = <28>; diff --git a/app/boards/shields/sugarglider/sugarglider.keymap b/app/boards/shields/sugarglider/sugarglider.keymap index 7927ad28..802730ec 100644 --- a/app/boards/shields/sugarglider/sugarglider.keymap +++ b/app/boards/shields/sugarglider/sugarglider.keymap @@ -17,7 +17,7 @@ status = "okay"; }; -&encoder_1 { +&encoder_2 { status = "okay"; }; @@ -58,11 +58,10 @@ default_layer { label = "default layer"; bindings = < - &kp C_MUTE &kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &trans &kp BSPC - &kp PG_UP &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH - &kp PG_DN &mo 1 &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp APOS &kp ENTER - &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp UP &kp RSHFT - &kp LCTRL &kp LGUI &kp LALT &kp SPACE &mo 1 &kp SPACE &kp RALT &mo 1 &kp LEFT &kp DOWN &kp RIGHT + &kp ESC &kp Q &kp W &kp E &kp R &kp T &trans &kp Y &kp U &kp I &kp O &kp P &kp BSPC + &kp TAB &kp A &kp S &kp D &kp F &kp G &kp C_MUTE &trans &kp H &kp J &kp K &kp L &kp SEMI &kp ENTER + &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &trans &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT + &kp C_MUTE &kp LCTRL &kp LALT &kp SPACE &kp Y &kp Y &kp Y &kp SPACE &kp SPACE &kp RGUI &kp C_MUTE >; sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN>; @@ -71,11 +70,10 @@ fn_layer { label = "fn layer"; bindings = < - &bt BT_CLR &trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &trans &kp DEL - &bootloader &trans &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &trans &trans &trans &trans &trans &trans &trans &trans &trans - &bt BT_NXT &kp CAPS &kp KP_NUM &kp SLCK &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 &rgb_ug RGB_BRD &rgb_ug RGB_EFR &ext_power EP_TOG &rgb_ug RGB_EFF &rgb_ug RGB_BRI &trans &kp HOME &trans &kp END + &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 &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 >; sensor-bindings = <&inc_dec_kp PG_UP PG_DN &inc_dec_kp C_VOL_UP C_VOL_DN>; diff --git a/app/boards/shields/sugarglider/sugarglider.overlay b/app/boards/shields/sugarglider/sugarglider.overlay index 8bd74912..5e1bc47f 100644 --- a/app/boards/shields/sugarglider/sugarglider.overlay +++ b/app/boards/shields/sugarglider/sugarglider.overlay @@ -18,48 +18,70 @@ diode-direction = "col2row"; row-gpios - = <&blackpill 29 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&blackpill 28 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&blackpill 27 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&blackpill 26 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&blackpill 25 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&blackpill 38 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> - , <&blackpill 39 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + = <&ext_gpio 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&ext_gpio 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&ext_gpio 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&ext_gpio 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&ext_gpio 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&ext_gpio 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&ext_gpio 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&ext_gpio 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&ext_gpio 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> ; col-gpios - = <&blackpill 21 GPIO_ACTIVE_HIGH> - , <&blackpill 19 GPIO_ACTIVE_HIGH> - , <&blackpill 18 GPIO_ACTIVE_HIGH> - , <&blackpill 17 GPIO_ACTIVE_HIGH> - , <&blackpill 16 GPIO_ACTIVE_HIGH> - , <&blackpill 15 GPIO_ACTIVE_HIGH> - , <&blackpill 14 GPIO_ACTIVE_HIGH> - , <&blackpill 13 GPIO_ACTIVE_HIGH> - , <&blackpill 12 GPIO_ACTIVE_HIGH> - , <&blackpill 11 GPIO_ACTIVE_HIGH> + = <&ext_gpio 8 (GPIO_ACTIVE_HIGH)> + , <&ext_gpio 9 (GPIO_ACTIVE_HIGH)> + , <&ext_gpio 10 (GPIO_ACTIVE_HIGH)> + , <&ext_gpio 11 (GPIO_ACTIVE_HIGH)> + , <&ext_gpio 12 (GPIO_ACTIVE_HIGH)> + , <&ext_gpio 13 (GPIO_ACTIVE_HIGH)> ; }; default_transform: keymap_transform_0 { compatible = "zmk,matrix-transform"; - columns = <12>; - rows = <4>; + columns = <6>; + rows = <9>; map = < - RC(5,5) RC(5,4) RC(5,3) RC(5,2) RC(5,1) RC(5,0) RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) - RC(6,5) RC(5,9) RC(5,8) RC(5,7) RC(5,6) 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(6,4) RC(6,9) RC(6,8) RC(6,3) 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(6,2) RC(6,0) RC(6,7) RC(6,6) RC(3,0) RC(3,1) 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(6,1) 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(4,8) RC(4,9) + RC(0,0) RC(5,1) RC(5,2) RC(5,3) RC(5,4) RC(5,5) RC(8,0) RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) + RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(8,5) RC(8,1) RC(5,0) RC(5,1) RC(5,2) RC(5,3) RC(5,4) RC(5,5) + RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(8,2) RC(6,0) RC(6,1) RC(6,2) RC(6,3) RC(6,4) RC(6,5) + RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7,4) RC(7,5) >; }; encoder_1: encoder_1 { compatible = "alps,ec11"; label = "Encoder 1"; - a-gpios = <&blackpill 40 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; - b-gpios = <&blackpill 41 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + a-gpios = <&blackpill 38 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + b-gpios = <&blackpill 39 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + resolution = <4>; + status = "disabled"; + }; + + encoder_2: encoder_2 { + compatible = "alps,ec11"; + label = "Encoder 2"; + a-gpios = <&blackpill 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + b-gpios = <&blackpill 18 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; resolution = <4>; status = "disabled"; }; }; + +&i2c0 { + status = "okay"; + clock-frequency = ; + + ext_gpio: mcp23017@20 { + compatible = "microchip,mcp23017"; + status = "okay"; + gpio-controller; + reg = <0x20>; + label = "EXT_GPIO"; + #gpio-cells = <2>; + ngpios = <16>; + }; +}; +