diff --git a/app/boards/shields/waterfowl/Kconfig.defconfig b/app/boards/shields/waterfowl/Kconfig.defconfig new file mode 100644 index 00000000..897184f6 --- /dev/null +++ b/app/boards/shields/waterfowl/Kconfig.defconfig @@ -0,0 +1,47 @@ + +if SHIELD_WATERFOWL_LEFT + +config ZMK_KEYBOARD_NAME + default "Waterfowl" + +config ZMK_SPLIT_ROLE_CENTRAL + default y + +endif + +if SHIELD_WATERFOWL_LEFT || SHIELD_WATERFOWL_RIGHT + +config ZMK_SPLIT + default y + +if ZMK_DISPLAY + +config I2C + default y + +config SSD1306 + default y + +config SSD1306_REVERSE_MODE + default y + +endif # ZMK_DISPLAY + +if LVGL + +config LVGL_VDB_SIZE + default 64 + +config LVGL_DPI + default 148 + +config LVGL_BITS_PER_PIXEL + default 1 + +choice LVGL_COLOR_DEPTH + default LVGL_COLOR_DEPTH_1 +endchoice + +endif # LVGL + +endif diff --git a/app/boards/shields/waterfowl/Kconfig.shield b/app/boards/shields/waterfowl/Kconfig.shield new file mode 100644 index 00000000..a321b73d --- /dev/null +++ b/app/boards/shields/waterfowl/Kconfig.shield @@ -0,0 +1,9 @@ +#Copyright (c) 2022 The ZMK Contributors +#SPDX-License-Identifier: MIT + + +config SHIELD_WATERFOWL_LEFT + def_bool $(shields_list_contains,waterfowl_left) + +config SHIELD_WATERFOWL_RIGHT + def_bool $(shields_list_contains,waterfowl_right) diff --git a/app/boards/shields/waterfowl/waterfowl.conf b/app/boards/shields/waterfowl/waterfowl.conf new file mode 100644 index 00000000..449e0b1f --- /dev/null +++ b/app/boards/shields/waterfowl/waterfowl.conf @@ -0,0 +1,6 @@ +# Uncomment these two line to add support for encoders to your firmware +CONFIG_EC11=y +CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y + +# Uncomment the following line to enable the Waterfowl OLED Display +# CONFIG_ZMK_DISPLAY=y diff --git a/app/boards/shields/waterfowl/waterfowl.dtsi b/app/boards/shields/waterfowl/waterfowl.dtsi new file mode 100644 index 00000000..c21dcf07 --- /dev/null +++ b/app/boards/shields/waterfowl/waterfowl.dtsi @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2022 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + chosen { + zephyr,display = &oled; + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <16>; + rows = <4>; +// | MX5 | MX4 | MX3 | MX2 | MX1 | | MX1 | MX2 | MX3 | MX4 | MX5 | +// | MX10 | MX9 | MX8 | MX7 | MX6 | | MX6 | MX7 | MX8 | MX9 | MX10 | +// | MX15 | MX14 | MX13 | MX12 | MX11 | | MX11 | MX12 | MX13 | MX14 | MX15 | +// | MX20 | MX19 | MX18 | MX17 | MX16 | | MX16 | MX17 | MX18 | MX19 | MX20 | + map = < +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(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(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(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) + >; + }; + + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + + diode-direction = "col2row"; + row-gpios + = <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + + }; + + left_encoder: encoder_left { //roller + compatible = "alps,ec11"; + label = "LEFT_ENCODER"; + a-gpios = <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + resolution = <4>; + }; + + right_encoder: encoder_right { //Standard encoder on left half + compatible = "alps,ec11"; + label = "RIGHT_ENCODER"; + a-gpios = <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + resolution = <2>; + }; + + sensors { + compatible = "zmk,keymap-sensors"; + sensors = <&left_encoder &right_encoder>; + }; + + // TODO: RGB node(s) +}; + +&pro_micro_i2c { + status = "okay"; + + oled: ssd1306@3c { + compatible = "solomon,ssd1306fb"; + reg = <0x3c>; + label = "DISPLAY"; + width = <128>; + height = <64>; + segment-offset = <0>; + page-offset = <0>; + display-offset = <0>; + multiplex-ratio = <63>; + prechargep = <0x22>; + }; +}; diff --git a/app/boards/shields/waterfowl/waterfowl.keymap b/app/boards/shields/waterfowl/waterfowl.keymap new file mode 100644 index 00000000..9a1dabac --- /dev/null +++ b/app/boards/shields/waterfowl/waterfowl.keymap @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2022 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include + +/ { + keymap { + compatible = "zmk,keymap"; + + default_layer { +/* QWERTY + * + * ,----------------------------------. ,----------------------------------. + * | Q | W | E | R | T | | Y | U | I | O | P | + * |------+------+------+------+------| |------+------+------+------+------| + * | A | S | D | F | G | | H | J | K | L | ; | + * |------+------+------+------+------| ,-----. ,-----. |------+------+------+------+------| + * | Z | X | C | V | B | | 2 | | 3 | | N | M | , | . | / | + * `----------------------------------' `-----' `-----' `----------------------------------' + * ,-----. ,--------------------. ,--------------------. ,-----. + * | 1 | | DEL | SPACE | TAB | | ESC | BS | ENTER | | 4 | + * `-----' `--------------------' `--------------------' `-----' + */ + bindings = < + &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P + &mt LGUI A &mt LALT S &mt LCTRL D &mt LSHFT F &kp G &kp H &mt LSHFT J &mt LCTRL K &mt LALT L &mt LGUI SEMI + &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH + &kp N1 < 3 DEL < 1 SPACE &kp TAB &kp N2 &kp N3 &kp ESC &kp BSPC < 2 RET &kp N4 + >; + + sensor-bindings = <&inc_dec_kp PAGE_UP PAGE_DOWN &inc_dec_kp TAB LS(TAB)>; + }; + + navnum_layer { +/* NAVNUM + * + * ,----------------------------------. ,----------------------------------. + * | | PgUp | UP | PgDn | | | / | 7 | 8 | 9 | - | + * |------+------+------+------+------| |------+------+------+------+------| + * | Home | Left | Down | Right| End | | = | 4 | 5 | 6 | + | + * |------+------+------+------+------| ,-----. ,-----. |------+------+------+------+------| + * | | | INS | | | | 2 | | 3 | | 0 | 1 | 2 | 3 | * | + * `----------------------------------' `-----' `-----' `----------------------------------' + * ,-----. ,--------------------. ,--------------------. ,-----. + * | 1 | | DEL | SPACE | MO(3)| | ESC | BS | ENTER | | 4 | + * `-----' `--------------------' `--------------------' `-----' + */ + bindings = < + &trans &kp PG_UP &kp UP &kp PG_DN &trans &kp FSLH &kp N7 &kp N8 &kp N9 &kp MINUS + &kp HOME &kp LEFT &kp DOWN &kp RIGHT &kp END &kp EQUAL &kp N4 &kp N5 &kp N6 &kp PLUS + &trans &trans &kp INS &trans &trans &kp N0 &kp N1 &kp N2 &kp N3 &kp ASTERISK + &kp N1 < 3 DEL < 1 SPACE &kp TAB &kp N2 &kp N3 &kp ESC &kp BSPC < 2 RET &kp N4 + >; + + sensor-bindings = <&inc_dec_kp PAGE_UP PAGE_DOWN &inc_dec_kp TAB LS(TAB)>; + }; + + symbol_layer { +/* SYM + * + * ,----------------------------------. ,----------------------------------. + * | % | @ | [ | ] | \ | | | | ^ | | | + * |------+------+------+------+------| |------+------+------+------+------| + * | # | ! | ( | ) | | | | _ | ' | " | ~ | ` | + * |------+------+------+------+------| ,-----. ,-----. |------+------+------+------+------| + * | $ | | { | } | & | | 2 | | 3 | | | | | | | + * `----------------------------------' `-----' `-----' `----------------------------------' + * ,-----. ,--------------------. ,--------------------. ,-----. + * | 1 | | DEL | SPACE | TAB | | ESC | BS | ENTER | | 4 | + * `-----' `--------------------' `--------------------' `-----' + */ + bindings = < + &kp PRCNT &kp AT &kp LBKT &kp RBKT &kp NON_US_BSLH &trans &trans &kp CARET &trans &trans + &kp HASH &kp EXCL &kp LPAR &kp RPAR &kp PIPE &kp UNDER &kp APOS &kp DOUBLE_QUOTES &kp TILDE &kp GRAVE + &kp DLLR &trans &kp LBRC &kp RBRC &kp AMPS &trans &trans &trans &trans &trans + &kp N1 < 3 DEL < 1 SPACE &kp TAB &kp N2 &kp N3 &kp ESC &kp BSPC < 2 RET &kp N4 + >; + + sensor-bindings = <&inc_dec_kp PAGE_UP PAGE_DOWN &inc_dec_kp TAB LS(TAB)>; + }; + + function_layer { +/* FUNC + * + * ,----------------------------------. ,----------------------------------. + * | | | BTCLR| | Reset| | Reset| F7 | F8 | F9 | F11 | + * |------+------+------+------+------| |------+------+------+------+------| + * | BT0 | BT1 | BT2 | BT3 | BT4 | | | F4 | F5 | F6 | F12 | + * |------+------+------+------+------| ,-----. ,-----. |------+------+------+------+------| + * | | | | | | | 2 | | 3 | | F10 | F1 | F2 | F3 | F13 | + * `----------------------------------' `-----' `-----' `----------------------------------' + * ,-----. ,--------------------. ,--------------------. ,-----. + * | 1 | | DEL | SPACE | TAB | | ESC | BS | ENTER | | 4 | + * `-----' `--------------------' `--------------------' `-----' + */ + bindings = < + &trans &trans &bt BT_CLR &trans &reset &reset &kp F7 &kp F8 &kp F9 &kp F11 + &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &trans &kp F4 &kp F5 &kp F6 &kp F12 + &trans &trans &trans &trans &trans &kp F10 &kp F1 &kp F2 &kp F3 &kp F13 + &kp N1 < 3 DEL < 1 SPACE &kp TAB &kp N2 &kp N3 &kp ESC &kp BSPC < 2 RET &kp N4 + >; + + sensor-bindings = <&inc_dec_kp PAGE_UP PAGE_DOWN &inc_dec_kp TAB LS(TAB)>; + }; + + }; +}; \ No newline at end of file diff --git a/app/boards/shields/waterfowl/waterfowl.zmk.yml b/app/boards/shields/waterfowl/waterfowl.zmk.yml new file mode 100644 index 00000000..3cd48686 --- /dev/null +++ b/app/boards/shields/waterfowl/waterfowl.zmk.yml @@ -0,0 +1,14 @@ +file_format: "1" +id: waterfowl +name: Waterfowl +type: shield +url: https://waterfowl.bio.link/ +requires: [pro_micro] +exposes: [i2c_oled] +features: + - keys + - display + - encoder +siblings: + - waterfowl_left + - waterfowl_right diff --git a/app/boards/shields/waterfowl/waterfowl_left.conf b/app/boards/shields/waterfowl/waterfowl_left.conf new file mode 100644 index 00000000..2f561d0d --- /dev/null +++ b/app/boards/shields/waterfowl/waterfowl_left.conf @@ -0,0 +1,2 @@ +CONFIG_EC11=y +CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y \ No newline at end of file diff --git a/app/boards/shields/waterfowl/waterfowl_left.overlay b/app/boards/shields/waterfowl/waterfowl_left.overlay new file mode 100644 index 00000000..031936ea --- /dev/null +++ b/app/boards/shields/waterfowl/waterfowl_left.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2022 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include "waterfowl.dtsi" + +&kscan0 { + col-gpios + = <&pro_micro 21 GPIO_ACTIVE_HIGH> + , <&pro_micro 20 GPIO_ACTIVE_HIGH> + , <&pro_micro 19 GPIO_ACTIVE_HIGH> + , <&pro_micro 18 GPIO_ACTIVE_HIGH> + , <&pro_micro 15 GPIO_ACTIVE_HIGH> + ; +}; + +&left_encoder { + status = "okay"; +}; diff --git a/app/boards/shields/waterfowl/waterfowl_right.conf b/app/boards/shields/waterfowl/waterfowl_right.conf new file mode 100644 index 00000000..2f561d0d --- /dev/null +++ b/app/boards/shields/waterfowl/waterfowl_right.conf @@ -0,0 +1,2 @@ +CONFIG_EC11=y +CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y \ No newline at end of file diff --git a/app/boards/shields/waterfowl/waterfowl_right.overlay b/app/boards/shields/waterfowl/waterfowl_right.overlay new file mode 100644 index 00000000..cff0d53c --- /dev/null +++ b/app/boards/shields/waterfowl/waterfowl_right.overlay @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include "waterfowl.dtsi" + +&default_transform { + col-offset = <5>; +}; + +&kscan0 { + col-gpios + = <&pro_micro 15 GPIO_ACTIVE_HIGH> + , <&pro_micro 18 GPIO_ACTIVE_HIGH> + , <&pro_micro 19 GPIO_ACTIVE_HIGH> + , <&pro_micro 20 GPIO_ACTIVE_HIGH> + , <&pro_micro 21 GPIO_ACTIVE_HIGH> + ; +}; + + +&right_encoder { + status = "okay"; +};