From ab5517b85867de908eb79ab1caefd76174ce959f Mon Sep 17 00:00:00 2001 From: ClicketySplit Date: Tue, 8 Mar 2022 22:30:30 -0700 Subject: [PATCH] The inaugural commit for Leeloo's firmware. --- app/boards/shields/leeloo/Kconfig.defconfig | 55 ++++++++++++ app/boards/shields/leeloo/Kconfig.shield | 8 ++ app/boards/shields/leeloo/README.md | 42 +++++++++ .../shields/leeloo/boards/nice_nano.overlay | 29 +++++++ app/boards/shields/leeloo/leeloo.conf | 9 ++ app/boards/shields/leeloo/leeloo.dtsi | 86 +++++++++++++++++++ app/boards/shields/leeloo/leeloo.keymap | 58 +++++++++++++ app/boards/shields/leeloo/leeloo.zmk.yml | 14 +++ app/boards/shields/leeloo/leeloo_left.conf | 9 ++ app/boards/shields/leeloo/leeloo_left.overlay | 21 +++++ app/boards/shields/leeloo/leeloo_right.conf | 9 ++ .../shields/leeloo/leeloo_right.overlay | 25 ++++++ 12 files changed, 365 insertions(+) create mode 100644 app/boards/shields/leeloo/Kconfig.defconfig create mode 100644 app/boards/shields/leeloo/Kconfig.shield create mode 100644 app/boards/shields/leeloo/README.md create mode 100644 app/boards/shields/leeloo/boards/nice_nano.overlay create mode 100644 app/boards/shields/leeloo/leeloo.conf create mode 100644 app/boards/shields/leeloo/leeloo.dtsi create mode 100644 app/boards/shields/leeloo/leeloo.keymap create mode 100644 app/boards/shields/leeloo/leeloo.zmk.yml create mode 100644 app/boards/shields/leeloo/leeloo_left.conf create mode 100644 app/boards/shields/leeloo/leeloo_left.overlay create mode 100644 app/boards/shields/leeloo/leeloo_right.conf create mode 100644 app/boards/shields/leeloo/leeloo_right.overlay diff --git a/app/boards/shields/leeloo/Kconfig.defconfig b/app/boards/shields/leeloo/Kconfig.defconfig new file mode 100644 index 00000000..6068dcfc --- /dev/null +++ b/app/boards/shields/leeloo/Kconfig.defconfig @@ -0,0 +1,55 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if SHIELD_LEELOO_LEFT + +config ZMK_KEYBOARD_NAME + default "Leeloo" + +config ZMK_SPLIT_BLE_ROLE_CENTRAL + default y + +endif + +if SHIELD_LEELOO_LEFT || SHIELD_LEELOO_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/leeloo/Kconfig.shield b/app/boards/shields/leeloo/Kconfig.shield new file mode 100644 index 00000000..48cf3cf5 --- /dev/null +++ b/app/boards/shields/leeloo/Kconfig.shield @@ -0,0 +1,8 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config SHIELD_LEELOO_LEFT + def_bool $(shields_list_contains,leeloo_left) + +config SHIELD_LEELOO_RIGHT + def_bool $(shields_list_contains,leeloo_right) diff --git a/app/boards/shields/leeloo/README.md b/app/boards/shields/leeloo/README.md new file mode 100644 index 00000000..db705656 --- /dev/null +++ b/app/boards/shields/leeloo/README.md @@ -0,0 +1,42 @@ +# Clickety Split | Leeloo + +![Leeloo](https://cdn.shopify.com/s/files/1/0599/3460/5491/files/Leeloo-rev1.0-w.jpg?v=1646798726) + +Keyboard Designer: [clicketysplit.ca](https://clicketysplit.ca) +GitHub: [ClicketySplit](https://github.com/ClicketySplit) +Hardware Supported: Pro Micro, Elite-C, nice!nano v2 + +Albeit, there is no doubt where Leeloo's heritage is derived from—Lily58, and Corne. It is not a copy-paste-modify implementation. + +Leeloo has been designed from scratch; everything from the schematic to its PCB footprints, and column stagger. There are some subtle differences that may not be apparent; however, its subtle changes enable an interesting future. + +Features: +* 4x6x5m Split Keyboard +* Support for MX/Box or Low Profile Choc switches. +* 90% of the switches are socketed; with the exception to the rotary encoder positions—6 positions require soldering. +* Support for 128x32 OLED Displays. +* The option to select one of three positions for an EC11 rotary encoder on each half. +* Support for Alps Alpine Micro Switch +* Support for 3.7v 301230 LiPo Battery + +# Building Your Firmware +ZMK Firmware: [Introduction to ZMK](https://zmk.dev/docs/) +Installation: [Installing ZMK](https://zmk.dev/docs/user-setup) +Customization: [Customizing ZMK](https://zmk.dev/docs/customization) +Development Environment: [Basic Setup](https://zmk.dev/docs/development/setup) + +Build command for the default keymap of Leeloo: + + west build -d build/left -p -b nice_nano_v2 -- -DSHIELD=leeloo_left + west build -d build/right -p -b nice_nano_v2 -- -DSHIELD=leeloo_right + +Build command for your custom keymap of Leeloo: + + west build -d build/right -p -b nice_nano_v2 -- -DSHIELD=leeloo_right -DZMK_CONFIG="C:\dev\zmk\[yourNmae]\leeloo\config" + west build -d build/left -p -b nice_nano_v2 -- -DSHIELD=leeloo_left -DZMK_CONFIG="C:\dev\zmk\[yourName]\leeloo\config" + +# Support +If you have any questions with regards to Leeloo, please [Contact Us](https://clicketysplit.ca/pages/contact-us). + +Clickety Split +For the love of split keyboards. diff --git a/app/boards/shields/leeloo/boards/nice_nano.overlay b/app/boards/shields/leeloo/boards/nice_nano.overlay new file mode 100644 index 00000000..83ebae04 --- /dev/null +++ b/app/boards/shields/leeloo/boards/nice_nano.overlay @@ -0,0 +1,29 @@ +&spi1 { + compatible = "nordic,nrf-spim"; + /* Cannot be used together with i2c0. */ + status = "okay"; + mosi-pin = <6>; + // 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 = "SK6812mini"; + + /* SPI */ + reg = <0>; /* ignored, but necessary for SPI bindings */ + spi-max-frequency = <4000000>; + + /* WS2812 */ + chain-length = <6>; /* There are per-key RGB, but the first 6 are underglow */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/leeloo/leeloo.conf b/app/boards/shields/leeloo/leeloo.conf new file mode 100644 index 00000000..cd89c2b4 --- /dev/null +++ b/app/boards/shields/leeloo/leeloo.conf @@ -0,0 +1,9 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +# Uncomment the following line to enable the 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/leeloo/leeloo.dtsi b/app/boards/shields/leeloo/leeloo.dtsi new file mode 100644 index 00000000..4c0f2b31 --- /dev/null +++ b/app/boards/shields/leeloo/leeloo.dtsi @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2020 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 = <12>; + rows = <5>; +// | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 | +// | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 | +// | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 | +// | SW19 | SW20 | SW21 | SW22 | SW23 | SW24 | SW29 | | SW29 | SW24 | SW23 | SW22 | SW21 | SW20 | SW19 | +// | SW25 | SW26 | SW27 | SW28 | | SW28 | SW27 | SW26 | SW25 | + 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(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(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,5) RC(4,6) 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 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)> + , <&pro_micro 9 (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>; + }; + + 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>; + }; + + 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>; + }; +}; \ No newline at end of file diff --git a/app/boards/shields/leeloo/leeloo.keymap b/app/boards/shields/leeloo/leeloo.keymap new file mode 100644 index 00000000..c0964f69 --- /dev/null +++ b/app/boards/shields/leeloo/leeloo.keymap @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ +#include +#include +#include +#include + +// Layers +#define DEFAULT 0 // default_layer +#define LOWER 1 // lower_layer +#define RAISE 2 // raise_layer + +/ { + + keymap { + compatible = "zmk,keymap"; + + default_layer { + bindings = < +&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSLH +&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp GRAV +&kp CAPS &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT +&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT + &kp LALT &kp LCTRL < 1 RET < 2 MINUS &kp LGUI &kp LGUI < 2 EQUAL < 1 SPACE &kp BSPC &kp DEL + >; + + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + + lower_layer { + bindings = < +&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 &trans &trans &trans &trans &trans &trans &trans + >; + + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + + raise_layer { + bindings = < +&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 &trans &trans &trans &trans &trans &trans &trans + >; + + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; + }; + + }; +}; diff --git a/app/boards/shields/leeloo/leeloo.zmk.yml b/app/boards/shields/leeloo/leeloo.zmk.yml new file mode 100644 index 00000000..c7e0e6e8 --- /dev/null +++ b/app/boards/shields/leeloo/leeloo.zmk.yml @@ -0,0 +1,14 @@ +file_format: "1" +id: leeloo +name: Leeloo +type: shield +url: https://clicketysplit.ca/pages/leeloo +requires: [pro_micro] +exposes: [i2c_oled] +features: + - keys + - display + - encoder +siblings: + - leeloo_left + - leeloo_right diff --git a/app/boards/shields/leeloo/leeloo_left.conf b/app/boards/shields/leeloo/leeloo_left.conf new file mode 100644 index 00000000..cd89c2b4 --- /dev/null +++ b/app/boards/shields/leeloo/leeloo_left.conf @@ -0,0 +1,9 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +# Uncomment the following line to enable the 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/leeloo/leeloo_left.overlay b/app/boards/shields/leeloo/leeloo_left.overlay new file mode 100644 index 00000000..70ea6560 --- /dev/null +++ b/app/boards/shields/leeloo/leeloo_left.overlay @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ +#include "leeloo.dtsi" + +&kscan0 { + col-gpios + = <&pro_micro 19 GPIO_ACTIVE_HIGH> + , <&pro_micro 18 GPIO_ACTIVE_HIGH> + , <&pro_micro 15 GPIO_ACTIVE_HIGH> + , <&pro_micro 14 GPIO_ACTIVE_HIGH> + , <&pro_micro 16 GPIO_ACTIVE_HIGH> + , <&pro_micro 10 GPIO_ACTIVE_HIGH> + ; +}; + +&left_encoder { + status = "okay"; +}; diff --git a/app/boards/shields/leeloo/leeloo_right.conf b/app/boards/shields/leeloo/leeloo_right.conf new file mode 100644 index 00000000..cd89c2b4 --- /dev/null +++ b/app/boards/shields/leeloo/leeloo_right.conf @@ -0,0 +1,9 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +# Uncomment the following line to enable the 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/leeloo/leeloo_right.overlay b/app/boards/shields/leeloo/leeloo_right.overlay new file mode 100644 index 00000000..5729656d --- /dev/null +++ b/app/boards/shields/leeloo/leeloo_right.overlay @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ +#include "leeloo.dtsi" + +&default_transform { + col-offset = <6>; +}; + +&kscan0 { + col-gpios + = <&pro_micro 10 GPIO_ACTIVE_HIGH> + , <&pro_micro 16 GPIO_ACTIVE_HIGH> + , <&pro_micro 14 GPIO_ACTIVE_HIGH> + , <&pro_micro 15 GPIO_ACTIVE_HIGH> + , <&pro_micro 18 GPIO_ACTIVE_HIGH> + , <&pro_micro 19 GPIO_ACTIVE_HIGH> + ; +}; + +&right_encoder { + status = "okay"; +};