Leeloo-Micro v1 updates to support Zephyr 3.2

This commit is contained in:
Clickety Split 2023-04-19 22:22:54 -06:00 committed by ClicketySplit
parent d03848fc2d
commit b9640483b7
11 changed files with 558 additions and 0 deletions

View file

@ -0,0 +1,49 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
if SHIELD_LEELOO_MICRO_LEFT
config ZMK_KEYBOARD_NAME
default "Leeloo-Micro"
config ZMK_SPLIT_ROLE_CENTRAL
default y
endif
if SHIELD_LEELOO_MICRO
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 LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
default 148
config LV_Z_BITS_PER_PIXEL
default 1
choice LV_COLOR_DEPTH
default LV_COLOR_DEPTH_1
endchoice
endif # LVGL
endif

View file

@ -0,0 +1,13 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
config SHIELD_LEELOO_MICRO
bool
config SHIELD_LEELOO_MICRO_LEFT
def_bool $(shields_list_contains,leeloo_micro_left)
select SHIELD_LEELOO_MICRO
config SHIELD_LEELOO_MICRO_RIGHT
def_bool $(shields_list_contains,leeloo_micro_right)
select SHIELD_LEELOO_MICRO

View file

@ -0,0 +1,102 @@
# Clickety Split | Leeloo-Micro
![Leeloo-Micro v1 Wireless](https://github.com/ClicketySplit/build-guides/blob/main/leeloo/images/gallery/Leeloo-Micro-v1-ZMK.jpg)
Keyboard Designer: [clicketysplit.ca](https://clicketysplit.ca)
GitHub: [ClicketySplit](https://github.com/ClicketySplit)
Hardware Supported: nice!nano v2, nice!view v1
Leeloo-Micro is a 3x5x5m derivative of Leeloo v2; inheriting the column stagger and modifiers row, yet, reducing the number of switches by removing the top row and outside columns. With Leeloo-Micro's inaugural release being wireless, it leverages nice!nanos and nice!views for its microcontrollers and displays.
## Features
* 3x5x5m Split Keyboard
* Support for Kailh Low Profile Choc switches with 18mm x 18mm spacing.
* All switch locations are socketed.
* Support for Alps Alpine EC11 Rotary Encoders—one on each side, in one of two locations.
- Rotary encoder locations are socketed.
* nice!view Displays are inherently supported, socketed, and no extra wiring is required.
* Support for per-switch RGB underglow.
* Support for both 110mAh or 700mAh batteries.
* Support for Alps Alpine Micro On/off switches.
# Building Leeloo-Micro ZMK 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 commands for the default keymap of Leeloo-Micro:
```
west build -d build/left -p -b nice_nano_v2 -- -DSHIELD=leeloo_micro_left
west build -d build/right -p -b nice_nano_v2 -- -DSHIELD=leeloo_micro_right
```
Build commands for your custom keymap of Leeloo-Micro:
```
west build -d build/right -p -b nice_nano_v2 -- -DSHIELD=leeloo_micro_right -DZMK_CONFIG="C:/dev/zmk/[yourNmae]/leeloo_micro/config"
west build -d build/left -p -b nice_nano_v2 -- -DSHIELD=leeloo_micro_left -DZMK_CONFIG="C:/dev/zmk/[yourName]/leeloo_micro/config"
```
## Building Leeloo-Micro's ZMK Firmware with nice!view Displays
There are a couple of files that need to be adjusted before the build commands can be run.
### Edit the leeloo_micro.keymap File
Near the top 3rd of the leeloo_micro.keymap file, locate the following code block:
```
//nice_view_spi: &spi0 {
// compatible = "nordic,nrf-spim";
// pinctrl-0 = <&spi0_default>;
// pinctrl-1 = <&spi0_sleep>;
// pinctrl-names = "default", "sleep";
// cs-gpios = <&pro_micro 4 GPIO_ACTIVE_HIGH>;
//};
```
Remove the forward slashes to resemble the following:
```
nice_view_spi: &spi0 {
compatible = "nordic,nrf-spim";
pinctrl-0 = <&spi0_default>;
pinctrl-1 = <&spi0_sleep>;
pinctrl-names = "default", "sleep";
cs-gpios = <&pro_micro 4 GPIO_ACTIVE_HIGH>;
};
```
Save your changes and close the file.
### Edit the leeloo_micro.conf file:
Near the top of the leeloo_micro.conf file, locate the following line items:
```
# Uncomment the following line to enable the OLED Display or nice!view Display
# CONFIG_ZMK_DISPLAY=y
```
Remove the # character in front of the CONFIG_ZMK_DISPLAY configuration item to resemble the following:
```
# Uncomment the following line to enable the OLED Display or nice!view Display
CONFIG_ZMK_DISPLAY=y
```
Save your changes and close the file.
### Sample Build Commands for nice!view Displays
Build commands for the default keymap of Leeloo-Micro:
```
west build -d build/left -p -b nice_nano_v2 -- -DSHIELD="leeloo_micro_left nice_view_adapter nice_view"
west build -d build/right -p -b nice_nano_v2 -- -DSHIELD="leeloo_micro_right nice_view_adapter nice_view"
```
Build commands for your custom keymap of Leeloo-Micro:
```
west build -d build/left -p -b nice_nano_v2 -- -DSHIELD="leeloo_micro_left nice_view_adapter nice_view" -DZMK_CONFIG="/workspaces/zmk-config/[yourNmae]/leeloo_micro/config"
west build -d build/right -p -b nice_nano_v2 -- -DSHIELD="leeloo_micro_right nice_view_adapter nice_view" -DZMK_CONFIG="/workspaces/zmk-config/[yourNmae]/leeloo_micro/config"
```
# Support
If you have any questions with regards to Leeloo-Micro, please [Contact Us](https://clicketysplit.ca/pages/contact-us).
Clickety Split
For the love of split keyboards.

View file

@ -0,0 +1,47 @@
#include <dt-bindings/led/led.h>
&pinctrl {
spi3_default: spi3_default {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 6)>;
};
};
spi3_sleep: spi3_sleep {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 6)>;
low-power-enable;
};
};
};
&spi3 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi3_default>;
pinctrl-1 = <&spi3_sleep>;
pinctrl-names = "default", "sleep";
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 = <20>; /* arbitrary; change at will */
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;
color-mapping = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};
/ {
chosen {
zmk,underglow = &led_strip;
};
};

View file

@ -0,0 +1,38 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
# Uncomment the following line to enable the OLED Display or nice!view Display
# CONFIG_ZMK_DISPLAY=y
# Uncomment to turn off WPM Status.
# CONFIG_ZMK_WIDGET_WPM_STATUS=n
# Uncomment to invert colour, if using nice!view Displays
# CONFIG_LVGL_USE_THEME_MONO=y
# Uncomment the following line to enable per-key lighting
# CONFIG_ZMK_RGB_UNDERGLOW=y
# Use the STRIP config specific to the LEDs you're using
# CONFIG_WS2812_STRIP=y
# Keep OLED or nice!view Displays on even when toggling off LEDs
# Change to y if you wish to toggle Displays on and off with LEDs
# CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER=n
# Turn off LEDs when idle.
# Change to n if you wish to keep LEDs on even when idle.
# CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_IDLE=y
# When USB is disconnected, turn off LEDs
# Change to n if you wish to keep LEDs on even when USB is unpluged.
# CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_USB=y
# Start LEDs off at 75%
# CONFIG_ZMK_RGB_UNDERGLOW_BRT_START=75
# Uncomment these two lines to add support for encoders
# CONFIG_EC11=y
# CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y

View file

@ -0,0 +1,6 @@
/*
* Copyright (c) 2022 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/
#include "leeloo_micro_common.dtsi"

View file

@ -0,0 +1,155 @@
/*
* Copyright (c) 2022 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/outputs.h>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/rgb.h>
// Layers
#define QW_M 0 // Main
#define QW_L 1 // Lower
#define QW_R 2 // Raise
#define QW_A 3 // Adjust
#define QC_N 4 // Number Pad
#define QC_B 5 // Firmware
// Short versions
#define BT0 BT_SEL 0
#define BT1 BT_SEL 1
#define BT2 BT_SEL 2
#define BT3 BT_SEL 3
#define BT4 BT_SEL 4
#define BOOTLDR &bootloader
#define RGBON &rgb_ug RGB_ON
#define RGBOFF &rgb_ug RGB_OFF
#define RGBTOG &rgb_ug RGB_TOG
#define RGBHUI &rgb_ug RGB_HUI
#define RGBHUD &rgb_ug RGB_HUD
#define RGBSAI &rgb_ug RGB_SAI
#define RGBSAD &rgb_ug RGB_SAD
#define RGBBRI &rgb_ug RGB_BRI
#define RGBBRD &rgb_ug RGB_BRD
#define RGBEFF &rgb_ug RGB_EFF
/*
* Assign the cs-gpios pin to 4.
* Uncomment these next few lines if implementing nice!view Displays.
*/
//nice_view_spi: &spi0 {
// compatible = "nordic,nrf-spim";
// pinctrl-0 = <&spi0_default>;
// pinctrl-1 = <&spi0_sleep>;
// pinctrl-names = "default", "sleep";
// cs-gpios = <&pro_micro 4 GPIO_ACTIVE_HIGH>;
//};
/ {
conditional_layers {
compatible = "zmk,conditional-layers";
adjust_layer {
if-layers = <1 2>;
then-layer = <3>;
};
};
combos {
compatible = "zmk,combos";
combo_esc {
timeout-ms = <50>;
key-positions = <0 1>;
layers = <QW_M>;
bindings = <&kp ESC>;
};
};
keymap {
compatible = "zmk,keymap";
default_layer {
label = " QWERTY";
bindings = <
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P
&kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI
&mt LSFT Z &kp X &kp C &kp V &kp B &mo QC_N &kp RGUI &kp N &kp M &kp COMMA &kp DOT &mt RSFT FSLH
&kp LALT &kp LCTRL &lt 1 RET &lt 2 MINUS &lt 2 EQUAL &lt 1 SPACE &kp BSPC &mo QC_B
>;
sensor-bindings = <&inc_dec_kp C_VOL_DN C_VOL_UP>;
};
lower_layer {
label = " Lower";
bindings = <
&kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0
&trans &trans &trans &trans &trans &trans &trans &trans &trans &kp QUOT
&kp LSHFT &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp RSHFT
&trans &trans &trans &trans &trans &trans &trans &trans
>;
sensor-bindings = <&inc_dec_kp C_VOL_DN C_VOL_UP>;
};
raise_layer {
label = " Raise";
bindings = <
&kp TAB &trans &trans &trans &trans &kp PG_UP &kp HOME &kp UP &kp END &kp BSLH
&kp CAPS &trans &trans &trans &trans &kp PG_DN &kp LEFT &kp DOWN &kp RIGHT &kp GRAVE
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &mt RSFT TILDE
&trans &trans &trans &trans &trans &trans &kp DEL &trans
>;
sensor-bindings = <&inc_dec_kp C_VOL_DN C_VOL_UP>;
};
adjust_layer {
label = " Adjust";
bindings = <
&kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &trans &trans &trans &trans &trans
&kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &trans &trans &trans &trans &trans
&kp F11 &kp F12 &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_DN C_VOL_UP>;
};
numpad_layer {
label = " NumPad";
bindings = <
&trans &none &none &none &none &kp SLASH &kp N7 &kp N8 &kp N9 &kp MINUS
RGBON RGBTOG RGBHUI RGBSAI RGBBRI &kp ASTRK &kp N4 &kp N5 &kp N6 &kp PLUS
RGBOFF RGBEFF RGBHUD RGBSAD RGBBRD &trans &trans &none &kp N1 &kp N2 &kp N3 &kp EQUAL
&trans &trans &trans &trans &trans &kp N0 &kp DOT &none
>;
sensor-bindings = <&inc_dec_kp C_VOL_DN C_VOL_UP>;
};
ble_layer {
label = " BLE";
bindings = <
&bt BT0 &bt BT1 &bt BT2 &bt BT3 &bt BT4 &bt BT0 &bt BT1 &bt BT2 &bt BT3 &bt BT4
BOOTLDR &sys_reset &trans &trans &trans &trans &trans &trans &sys_reset BOOTLDR
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &bt BT_CLR &trans &trans &trans &trans &bt BT_CLR &trans
>;
sensor-bindings = <&inc_dec_kp C_VOL_DN C_VOL_UP>;
};
};
};

View file

@ -0,0 +1,15 @@
file_format: "1"
id: leeloo_micro
name: Leeloo-Micro
type: shield
url: https://clicketysplit.ca/pages/leeloo-micro
requires: [pro_micro]
exposes: [i2c_oled]
features:
- keys
- display
- encoder
- underglow
siblings:
- leeloo_micro_left
- leeloo_micro_right

View file

@ -0,0 +1,89 @@
/*
* Copyright (c) 2022 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/zmk/matrix_transform.h>
/ {
chosen {
zephyr,display = &oled;
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;
};
default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <10>;
rows = <4>;
//
// | SW1 | SW2 | SW3 | SW4 | SW5 | | SW15 | SW4 | SW3 | SW2 | SW1 |
// | SW6 | SW7 | SW8 | SW9 | SW10 | | SW10 | SW9 | SW8 | SW7 | SW6 |
// | SW11 | SW12 | SW13 | SW14 | SW15 | SW20 | | SW20 | SW15 | SW14 | SW13 | SW12 | SW11 |
// | SW16 | SW17 | SW18 | SW19 | | SW19 | SW18 | SW17 | SW16 |
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(3,4) RC(3,5) 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,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 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: left_encoder {
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 = <2>;
status = "disabled";
};
right_encoder: right_encoder {
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 = <2>;
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>;
};
};

View file

@ -0,0 +1,20 @@
/*
* Copyright (c) 2022 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/
#include "leeloo_micro.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>
;
};
&left_encoder {
status = "okay";
};

View file

@ -0,0 +1,24 @@
/*
* Copyright (c) 2022 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/
#include "leeloo_micro.dtsi"
&default_transform {
col-offset = <5>;
};
&kscan0 {
col-gpios
= <&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";
};