diff --git a/app/boards/shields/lotus58/Kconfig.defconfig b/app/boards/shields/lotus58/Kconfig.defconfig new file mode 100644 index 00000000..f0d35f4d --- /dev/null +++ b/app/boards/shields/lotus58/Kconfig.defconfig @@ -0,0 +1,55 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if SHIELD_LOTUS58_LEFT + +config ZMK_KEYBOARD_NAME + default "Lotus58" + +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + +endif + +if SHIELD_LOTUS58_LEFT || SHIELD_LOTUS58_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_HOR_RES_MAX + default 128 + +config LVGL_VER_RES_MAX + default 32 + +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/lotus58/Kconfig.shield b/app/boards/shields/lotus58/Kconfig.shield new file mode 100644 index 00000000..dbf7ba01 --- /dev/null +++ b/app/boards/shields/lotus58/Kconfig.shield @@ -0,0 +1,8 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config SHIELD_LOTUS58_LEFT + def_bool $(shields_list_contains,lotus58_left) + +config SHIELD_LOTUS58_RIGHT + def_bool $(shields_list_contains,lotus58_right) diff --git a/app/boards/shields/lotus58/lotus58.conf b/app/boards/shields/lotus58/lotus58.conf new file mode 100644 index 00000000..193f1ab4 --- /dev/null +++ b/app/boards/shields/lotus58/lotus58.conf @@ -0,0 +1,9 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +# Uncomment the following line to enable the Lotus58 OLED Display +# CONFIG_ZMK_DISPLAY=y + +# Uncomment these two lines to add support for encoders +# CONFIG_EC11=y +# CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y diff --git a/app/boards/shields/lotus58/lotus58.dtsi b/app/boards/shields/lotus58/lotus58.dtsi new file mode 100644 index 00000000..fb0d174f --- /dev/null +++ b/app/boards/shields/lotus58/lotus58.dtsi @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022 The ZMK Contributors + * + * 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>; +// | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 | | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | +// | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 | | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | +// | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 | SW30 | | SW30 | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | +// | SW24 | SW23 | SW22 | SW21 | SW20 | SW19 | SW25 | | SW25 | SW19 | SW20 | SW21 | SW22 | SW23 | SW24 | +// | SW29 | SW28 | SW27 | SW26 | | SW26 | SW27 | SW28 | SW29 | + 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(0,10) RC(0,11) +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(1,10) RC(1,11) +RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(4,0) RC(4,11) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11) +RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) + RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,7) RC(4,8) RC(4,9) RC(4,10) + >; + }; + + 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)> + , <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + }; + + left_encoder: encoder_left { + compatible = "alps,ec11"; + label = "LEFT_ENCODER"; + a-gpios = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + resolution = <4>; + status = "disabled"; + }; + + right_encoder: encoder_right { + compatible = "alps,ec11"; + label = "RIGHT_ENCODER"; + a-gpios = <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + resolution = <4>; + status = "disabled"; + }; + + sensors { + compatible = "zmk,keymap-sensors"; + sensors = <&left_encoder &right_encoder>; + }; +}; + +&pro_micro_i2c { + status = "okay"; + + ssd1306@3c { + compatible = "solomon,ssd1306fb"; + reg = <0x3c>; + label = "DISPLAY"; + width = <128>; + height = <32>; + segment-offset = <0>; + page-offset = <0>; + display-offset = <0>; + multiplex-ratio = <31>; + segment-remap; + com-invdir; + com-sequential; + prechargep = <0x22>; + }; +}; diff --git a/app/boards/shields/lotus58/lotus58.keymap b/app/boards/shields/lotus58/lotus58.keymap new file mode 100644 index 00000000..cfe4342c --- /dev/null +++ b/app/boards/shields/lotus58/lotus58.keymap @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2022 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include + +/ { + combos { + compatible = "zmk,combos"; + combo_dsklg { + timeout-ms = <100>; + key-positions = <24 52>; + layers = <0>; + bindings = <&kp LGUI>; + }; + }; + + behaviors { + fofunc: four_ffour { + compatible = "zmk,behavior-mod-morph"; + label = "FOUR_FUNCFOUR"; + #binding-cells = <0>; + bindings = <&kp N4>, <&kp F4>; + mods = <(MOD_LALT|MOD_RALT)>; + }; + sleft: s_left { + compatible = "zmk,behavior-mod-morph"; + label = "S_LEFT"; + #binding-cells = <0>; + bindings = <&kp S>, <&kp LEFT>; + mods = <(MOD_LGUI|MOD_RGUI)>; + }; + fright: f_right { + compatible = "zmk,behavior-mod-morph"; + label = "R_RIGHT"; + #binding-cells = <0>; + bindings = <&kp F>, <&kp RIGHT>; + mods = <(MOD_LGUI|MOD_RGUI)>; + }; + }; + + keymap { + compatible = "zmk,keymap"; + + default_layer { +// ------------------------------------------------------------------------------------------------------------ +// 0| ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | = | 11 +// 12| TAB | Q | W | E | R | T | | Y | U | I | O | P | [ | 23 +// 24| SFT | A | S | D | F | G | RESET | | RESET | H | J | K | L | ; | ' SFT | 37 +// 38| CTRL | Z | X | C | V | B | MUTE | | PLAY | N | M | , | . | / | \ CTRL| 51 +// 52 |ENT RS| ALT | SPACE|DELETE LW| |ENTER RS| BSPC | ] LW | RGUI | 59 + bindings = < +&kp ESC &kp N1 &kp N2 &kp N3 &fofunc &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp EQUAL +&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 LSHFT &kp A &sleft &kp D &fright &kp G &reset &reset &kp H &kp J &kp K &kp L &kp SEMI &mt RSHFT SQT +&kp LCTRL &kp Z &kp X &kp C &kp V &kp B &kp C_MUTE &kp C_PP &kp N &kp M &kp COMMA &kp DOT &kp FSLH &mt RCTRL BSLH + < 2 RET &kp LALT &kp SPACE < 1 DEL < 2 RET &kp BSPC < 1 RBKT &kp LGUI + >; + + sensor-bindings = <&inc_dec_kp C_VOL_DN C_VOL_UP &inc_dec_kp PG_UP PG_DN>; + }; + + lower_layer { +// ------------------------------------------------------------------------------------------------------------ +// | ` | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 | +// | | ! | HOME| ^ | END | % | | VOL^ | PGUP | INS | ^ | PSCR | - | +// | | # | <- | v | -> | $ | | | | VOLv | <- | ^ | -> | ~ | _ | +// | | @ | - | ( | ) | & | | | | MUTE | PGDN | v | : | * | | | +// | F11 | | | | | | | | F12 | + bindings = < +&kp GRAVE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp PLUS +&trans &kp EXCL &kp HOME &kp UP &kp END &kp PRCNT &kp C_VOL_UP &kp PG_UP &kp INS &kp CARET &kp PSCRN &kp MINUS +&trans &kp HASH &kp LEFT &kp DOWN &kp RIGHT &kp DLLR &trans &trans &kp C_VOL_DN &kp LEFT &kp UP &kp RIGHT &kp TILDE &kp UNDER +&trans &kp AT &kp MINUS &kp LBRC &kp RBRC &kp AMPS &trans &trans &kp C_MUTE &kp PG_DN &kp DOWN &kp COLON &kp STAR &kp PIPE + &kp F11 &trans &trans &trans &trans &trans &trans &kp F12 + >; + + sensor-bindings = <&inc_dec_kp C_VOL_DN C_VOL_UP &inc_dec_kp C_NEXT C_PREV>; + }; + + raise_layer { +// ------------------------------------------------------------------------------------------------------------ +// |BTCLR| BT1 | BT2 | BT3 | BT4 | BT5 | |OUTTOG|OUTUSB| OUTBT | | RESET | FLASH | +// | | INS | PSCR | GUI | RESET | | | PGUP | | ^ | | | | +// | | ALT | CTRL | SHIFT | FLASH | CAPS | | | | PGDN | <- | v | -> | DEL | BSPC | +// | | UNDO | CUT | COPY | PASTE | | | | | | |> | <|<| | |>|> | | | +// | | | | | | | | | | + bindings = < +&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &out OUT_TOG &out OUT_USB &out OUT_BLE &trans &reset &bootloader +&trans &kp INS &kp PSCRN &kp K_CMENU &reset &trans &kp PG_UP &trans &kp UP &trans &trans &trans +&trans &kp LALT &kp LCTRL &kp LSHFT &bootloader &kp CLCK &trans &trans &kp PG_DN &kp LEFT &kp DOWN &kp RIGHT &kp DEL &kp BSPC +&trans &kp K_UNDO &kp K_CUT &kp K_COPY &kp K_PASTE &trans &trans &trans &trans &kp C_PP &kp C_PREV &kp C_NEXT &trans &trans + &trans &trans &trans &trans &trans &trans &trans &trans + >; + + sensor-bindings = <&inc_dec_kp C_VOL_DN C_VOL_UP &inc_dec_kp PG_UP PG_DN>; + }; + }; +}; diff --git a/app/boards/shields/lotus58/lotus58.zmk.yml b/app/boards/shields/lotus58/lotus58.zmk.yml new file mode 100644 index 00000000..5cabbd0e --- /dev/null +++ b/app/boards/shields/lotus58/lotus58.zmk.yml @@ -0,0 +1,14 @@ +file_format: "1" +id: lotus58 +name: Lotus58 +type: shield +url: https://github.com/TweetyDaBird/Lotus58 +requires: [pro_micro] +exposes: [i2c_oled] +features: + - keys + - display + - encoder +siblings: + - lotus58_left + - lotus58_right diff --git a/app/boards/shields/lotus58/lotus58_left.overlay b/app/boards/shields/lotus58/lotus58_left.overlay new file mode 100644 index 00000000..9755ae0b --- /dev/null +++ b/app/boards/shields/lotus58/lotus58_left.overlay @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2022 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include "lotus58.dtsi" + +&kscan0 { + col-gpios + = <&pro_micro 15 GPIO_ACTIVE_HIGH> + , <&pro_micro 16 GPIO_ACTIVE_HIGH> + , <&pro_micro 14 GPIO_ACTIVE_HIGH> + , <&pro_micro 10 GPIO_ACTIVE_HIGH> + , <&pro_micro 18 GPIO_ACTIVE_HIGH> + , <&pro_micro 19 GPIO_ACTIVE_HIGH> + ; +}; + +&left_encoder { + status = "okay"; +}; diff --git a/app/boards/shields/lotus58/lotus58_right.overlay b/app/boards/shields/lotus58/lotus58_right.overlay new file mode 100644 index 00000000..dffcaeb1 --- /dev/null +++ b/app/boards/shields/lotus58/lotus58_right.overlay @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include "lotus58.dtsi" + +&default_transform { + col-offset = <6>; +}; + +&kscan0 { + col-gpios + = <&pro_micro 19 GPIO_ACTIVE_HIGH> + , <&pro_micro 18 GPIO_ACTIVE_HIGH> + , <&pro_micro 10 GPIO_ACTIVE_HIGH> + , <&pro_micro 14 GPIO_ACTIVE_HIGH> + , <&pro_micro 16 GPIO_ACTIVE_HIGH> + , <&pro_micro 15 GPIO_ACTIVE_HIGH> + ; +}; + +&right_encoder { + status = "okay"; +};