diff --git a/app/boards/shields/mokulua/Kconfig.defconfig b/app/boards/shields/mokulua/Kconfig.defconfig new file mode 100644 index 00000000..c2ce95cc --- /dev/null +++ b/app/boards/shields/mokulua/Kconfig.defconfig @@ -0,0 +1,52 @@ +if SHIELD_MOKULUA_LEFT + +config ZMK_KEYBOARD_NAME + default "Mokulua" + +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + +endif + +if SHIELD_MOKULUA_LEFT || SHIELD_MOKULUA_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/mokulua/Kconfig.shield b/app/boards/shields/mokulua/Kconfig.shield new file mode 100644 index 00000000..fbd59606 --- /dev/null +++ b/app/boards/shields/mokulua/Kconfig.shield @@ -0,0 +1,8 @@ +#Copyright (c) 2022 Kyle McCreery +#SPDX-License-Identifier: MIT + +config SHIELD_MOKULUA_LEFT + def_bool $(shields_list_contains,mokulua_left) + +config SHIELD_MOKULUA_RIGHT + def_bool $(shields_list_contains,mokulua_right) diff --git a/app/boards/shields/mokulua/boards/nice_nano.conf b/app/boards/shields/mokulua/boards/nice_nano.conf new file mode 100644 index 00000000..dda71c13 --- /dev/null +++ b/app/boards/shields/mokulua/boards/nice_nano.conf @@ -0,0 +1,3 @@ +# Uncomment both to enable underglow +CONFIG_ZMK_RGB_UNDERGLOW=y +CONFIG_WS2812_STRIP=y diff --git a/app/boards/shields/mokulua/boards/nice_nano.overlay b/app/boards/shields/mokulua/boards/nice_nano.overlay new file mode 100644 index 00000000..b663d8aa --- /dev/null +++ b/app/boards/shields/mokulua/boards/nice_nano.overlay @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Kyle McCreery + * + * SPDX-License-Identifier: MIT + */ + + #include + +&spi1 { + compatible = "nordic,nrf-spim"; + status = "okay"; + mosi-pin = <9>; + // Unused pins, needed for SPI definition, but not used by the ws2812 driver itself. + sck-pin = <5>; + miso-pin = <7>; + + led_strip: ws2812@0 { + compatible = "worldsemi,ws2812-spi"; + label = "WS2812"; + + /* SPI */ + reg = <0>; /* ignored, but necessary for SPI bindings */ + spi-max-frequency = <4000000>; + + /* WS2812 */ + chain-length = <8>; /* number of LEDs */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + + color-mapping = ; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; \ No newline at end of file diff --git a/app/boards/shields/mokulua/mokulua.conf b/app/boards/shields/mokulua/mokulua.conf new file mode 100644 index 00000000..db81ee43 --- /dev/null +++ b/app/boards/shields/mokulua/mokulua.conf @@ -0,0 +1,14 @@ +# Uncomment to turn on logging, and set ZMK logging to debug output +# CONFIG_ZMK_USB_LOGGING=y +# CONFIG_SENSOR_LOG_LEVEL_DBG=y + +# Uncomment both to enable encoder +CONFIG_EC11=y +CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y + +# Uncomment the following lines to enable the Mokulua RGB Underglow +CONFIG_ZMK_RGB_UNDERGLOW=y + +# Uncomment the following line to enable the Mokulua OLED Display +CONFIG_ZMK_DISPLAY=y +CONFIG_ZMK_WIDGET_LAYER_STATUS=y \ No newline at end of file diff --git a/app/boards/shields/mokulua/mokulua.dtsi b/app/boards/shields/mokulua/mokulua.dtsi new file mode 100644 index 00000000..efc4ce5c --- /dev/null +++ b/app/boards/shields/mokulua/mokulua.dtsi @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022 Kyle McCreery + * + * 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 = <12>; + rows = <6>; + + map = < +RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(5,5) RC(5,6) 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(5,4) 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(5,3) RC(5,7) 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(5,1) RC(5,2) RC(5,9) RC(5,8) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) +RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(5,0) RC(5,10) RC(4,6) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11) + >; + }; + + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + + diode-direction = "col2row"; + row-gpios + = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + + }; + + left_encoder: encoder_left { + compatible = "alps,ec11"; + label = "LEFT_ENCODER"; + a-gpios = <&gpio0 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&gpio0 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + resolution = <4>; + status = "disabled"; + }; + + right_encoder: encoder_right { + compatible = "alps,ec11"; + label = "RIGHT_ENCODER"; + a-gpios = <&gpio0 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; + b-gpios = <&gpio0 10 (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"; + + oled: 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/mokulua/mokulua.keymap b/app/boards/shields/mokulua/mokulua.keymap new file mode 100644 index 00000000..15f645f6 --- /dev/null +++ b/app/boards/shields/mokulua/mokulua.keymap @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2022 Kyle McCreery + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include +#include + +#define BASE 0 +#define FN1 1 +#define FN2 2 +#define FN3 3 + +/ { + keymap { + compatible = "zmk,keymap"; + + default_layer { +// -------------------------------------------- --------------------------------------------- +// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | | - | 7 | 8 | 9 | 0 | NONE | BKSP | +// | TAB | Q | W | E | R | T | Y | | Y | U | I | O | P | \ | +// | FN1 | A | S | D | F | G | H | | ; | H | J | K | L | ' | ENT | +// | SHFT |NONE| Z | X | C | V | B | MUTE | | MUTE | B | N | M | , | . | UP | SHFT | +// | CTRL | GUI | ALT | FN2 | SP1 | SP2 | FN3 | | FN3 | SP2 | SP1 | FN2 | LFT | DWN | RGHT | +// -------------------------------------------------- ---------------------------------------------------- + bindings = < + &kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp MINUS &kp N7 &kp N8 &kp N9 &kp N0 &none &kp BSPC + &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp Y &kp U &kp I &kp O &kp P &kp BSLH + &mo FN1 &kp A &kp S &kp D &kp F &kp G &kp H &kp SEMI &kp H &kp J &kp K &kp L &kp SQT &kp RET + &kp LSHFT &none &kp Z &kp X &kp C &kp V &kp B &kp C_MUTE &kp C_MUTE &kp B &kp N &kp M &kp COMMA &kp DOT &kp UP &kp RSHFT + &kp LCTRL &kp LGUI &kp LALT &mo FN2 < FN1 SPACE < FN2 SPACE &mo FN3 &mo FN3 < FN2 SPACE < FN1 SPACE &mo FN2 &kp LEFT &kp DOWN &kp RIGHT + >; + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN>; + }; + + fn1_layer { +// -------------------------------------------- -------------------------------------- +// | | F1 | F2 | F3 | F4 | F5 | F6 | | = | F7 | F8 | F9 | F10 | NONE | DEL | +// | | | | | | | | | | | | LBKT | RBKT | | +// | | | | | | | | | | | | | | ; | | +// | |NONE| | | | | | | | | | | | | / | PGUP|CAPS WORD| +// | | | | | | | | | | | | | HOME |PGDWN| END | +// -------------------------------------------------- ---------------------------------------------------- + bindings = < + &trans &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp EQUAL &kp F7 &kp F8 &kp F9 &kp F10 &none &kp DEL + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp LBKT &kp RBKT &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp SEMI &trans + &trans &none &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp FSLH &kp PG_UP &caps_word + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp HOME &kp PG_DN &kp END + >; + }; + + fn2_layer { +// -------------------------------------------- -------------------------------------- +// | | F11 | F12 | | | | | | | | | | | NONE | | +// | | | | | | | | | | | | | | | +// | | | | | | | | | | | | | | ; | | +// | |NONE| | | | | | | | | | | | | | | | +// | | | | | | | | | | | | | | | | +// -------------------------------------------------- ---------------------------------------------------- + bindings = < + &trans &kp F11 &kp F12 &trans &trans &trans &trans &trans &trans &trans &trans &trans &none &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 &none &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 + >; + }; + + fn3_layer { +// -------------------------------------------- -------------------------------------- +// |BT CLR| BT1 | BT2 | BT3 | BT4 | BT5 | | | | | | | | NONE | | +// | |BT PRV|BT NXT| |RESET| | | | | |RESET| | | | +// | | | | | | | | | | | | | | | | +// | |NONE| | | | | BOOT |RGB_TOG| |EP_TOG| BOOT | | | | | | | +// | | | | | | |RGB_EFR| |RGB_EFF| | | | | | | +// -------------------------------------------------- -------------------------------------------------------- + bindings = < + &bt BT_CLR &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &bt BT_SEL 5 &trans &trans &trans &trans &trans &trans &none &trans + &trans &bt BT_PRV &bt BT_NXT &trans &reset &trans &trans &trans &trans &reset &trans &trans &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + &trans &none &trans &trans &trans &bootloader &rgb_ug RGB_TOG &ext_power EP_TOG &bootloader &trans &trans &trans &trans &trans &trans + &trans &trans &trans &trans &trans &trans &rgb_ug RGB_EFF &trans &rgb_ug RGB_EFR &trans &trans &trans &trans &trans + >; + }; + }; + + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN>; +}; diff --git a/app/boards/shields/mokulua/mokulua.zmk.yml b/app/boards/shields/mokulua/mokulua.zmk.yml new file mode 100644 index 00000000..4213470f --- /dev/null +++ b/app/boards/shields/mokulua/mokulua.zmk.yml @@ -0,0 +1,15 @@ +file_format: "1" +id: mokulua +name: Mokulua +type: shield +url:https://mechwild.com/product/mokulua/ +requires: [pro_micro] +exposes: [i2c_oled] +features: + - keys + - display + - encoder + - underglow +siblings: + - mokulua_left + - mokulua_right diff --git a/app/boards/shields/mokulua/mokulua_left.conf b/app/boards/shields/mokulua/mokulua_left.conf new file mode 100644 index 00000000..db81ee43 --- /dev/null +++ b/app/boards/shields/mokulua/mokulua_left.conf @@ -0,0 +1,14 @@ +# Uncomment to turn on logging, and set ZMK logging to debug output +# CONFIG_ZMK_USB_LOGGING=y +# CONFIG_SENSOR_LOG_LEVEL_DBG=y + +# Uncomment both to enable encoder +CONFIG_EC11=y +CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y + +# Uncomment the following lines to enable the Mokulua RGB Underglow +CONFIG_ZMK_RGB_UNDERGLOW=y + +# Uncomment the following line to enable the Mokulua OLED Display +CONFIG_ZMK_DISPLAY=y +CONFIG_ZMK_WIDGET_LAYER_STATUS=y \ No newline at end of file diff --git a/app/boards/shields/mokulua/mokulua_left.overlay b/app/boards/shields/mokulua/mokulua_left.overlay new file mode 100644 index 00000000..7ddd8ca8 --- /dev/null +++ b/app/boards/shields/mokulua/mokulua_left.overlay @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2022 Kyle McCreery + * + * SPDX-License-Identifier: MIT + */ + +#include "mokulua.dtsi" + +&kscan0 { + col-gpios + = <&pro_micro 4 GPIO_ACTIVE_HIGH> + , <&pro_micro 5 GPIO_ACTIVE_HIGH> + , <&pro_micro 6 GPIO_ACTIVE_HIGH> + , <&pro_micro 7 GPIO_ACTIVE_HIGH> + , <&pro_micro 8 GPIO_ACTIVE_HIGH> + , <&pro_micro 9 GPIO_ACTIVE_HIGH> + ; +}; + +&left_encoder { + status = "okay"; +}; diff --git a/app/boards/shields/mokulua/mokulua_right.conf b/app/boards/shields/mokulua/mokulua_right.conf new file mode 100644 index 00000000..db81ee43 --- /dev/null +++ b/app/boards/shields/mokulua/mokulua_right.conf @@ -0,0 +1,14 @@ +# Uncomment to turn on logging, and set ZMK logging to debug output +# CONFIG_ZMK_USB_LOGGING=y +# CONFIG_SENSOR_LOG_LEVEL_DBG=y + +# Uncomment both to enable encoder +CONFIG_EC11=y +CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y + +# Uncomment the following lines to enable the Mokulua RGB Underglow +CONFIG_ZMK_RGB_UNDERGLOW=y + +# Uncomment the following line to enable the Mokulua OLED Display +CONFIG_ZMK_DISPLAY=y +CONFIG_ZMK_WIDGET_LAYER_STATUS=y \ No newline at end of file diff --git a/app/boards/shields/mokulua/mokulua_right.overlay b/app/boards/shields/mokulua/mokulua_right.overlay new file mode 100644 index 00000000..bfe77d04 --- /dev/null +++ b/app/boards/shields/mokulua/mokulua_right.overlay @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 Kyle McCreery + * + * SPDX-License-Identifier: MIT + */ + +#include "mokulua.dtsi" + +&default_transform { + col-offset = <6>; +}; + +&kscan0 { + col-gpios + = <&pro_micro 4 GPIO_ACTIVE_HIGH> + , <&pro_micro 5 GPIO_ACTIVE_HIGH> + , <&pro_micro 6 GPIO_ACTIVE_HIGH> + , <&pro_micro 7 GPIO_ACTIVE_HIGH> + , <&pro_micro 8 GPIO_ACTIVE_HIGH> + , <&pro_micro 9 GPIO_ACTIVE_HIGH> + ; +}; + +&right_encoder { + status = "okay"; +}; \ No newline at end of file