This commit is contained in:
Eduard Kizmann 2024-09-03 11:28:28 +02:00 committed by GitHub
commit 686bf7af3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 214 additions and 0 deletions

View file

@ -0,0 +1,39 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
if SHIELD_LAGOM
config ZMK_KEYBOARD_NAME
default "Lagom"
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,2 @@
config SHIELD_LAGOM
def_bool $(shields_list_contains,lagom)

View file

@ -0,0 +1,20 @@
# Building ZMK for the Lagom
Some general notes/commands for building standard lagom layout.
## Encoder Notes
If you built your lagom without an encoder, you'll need to change the following in your local lagom config or add them to the end of the file.
```
CONFIG_EC11=n
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=n
```
## OLED Notes
If are not using an OLED screen, you'll need to change the following in your local lagom config or add them to the end of the file.
```
CONFIG_ZMK_DISPLAY=n
```

View file

@ -0,0 +1,9 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
# Enable Display
CONFIG_ZMK_DISPLAY=y
# Enable Encoders
CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y

View file

@ -0,0 +1,49 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
/ {
sensors {
compatible = "zmk,keymap-sensors";
sensors = <&encoder_1 &encoder_2>;
};
keymap {
compatible = "zmk,keymap";
default_layer {
label = "Default";
sensor-bindings = <&inc_dec_kp C_NEXT C_PREV &inc_dec_kp C_VOLUME_UP C_VOLUME_DOWN>;
bindings = <
&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC &kp HOME
&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 RBKT &kp BSLH &kp END &kp C_PLAY_PAUSE
&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 RET &kp PG_UP &kp C_MUTE
&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 UP &kp PG_DN
&kp LCTRL &kp LGUI &kp LALT &kp SPACE &kp RALT &mo 1 &kp LEFT &kp DOWN &kp RIGHT
>;
};
modifier_layer {
label = "Modifier";
sensor-bindings = <&inc_dec_kp C_NEXT C_PREV &inc_dec_kp C_VOLUME_UP C_VOLUME_DOWN>;
bindings = <
&kp TILDE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &none &none &none &none &none
&none &none &none &none &none &none &none &none &none &none &none &none &none &none &none &none
&none &none &none &none &none &none &none &none &none &none &none &none &none &none &none
&none &none &none &none &none &none &none &none &none &none &none &none &none &none
&bt BT_CLR &none &none &bt BT_NXT &none &none &none &none &none
>;
};
};
};

View file

@ -0,0 +1,86 @@
/*
* Copyright (c) 2020 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;
};
encoder_1: encoder_1 {
compatible = "alps,ec11";
label = "Encoder 1";
a-gpios = <&pro_micro 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
resolution = <1>;
status = "okay";
};
encoder_2: encoder_2 {
compatible = "alps,ec11";
label = "Encoder 2";
a-gpios = <&pro_micro 21 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 20 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
resolution = <1>;
status = "okay";
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-demux";
label = "KSCAN";
debounce-period = <4>;
polling-interval-msec = <8>;
input-gpios // B6, B2, B3, B1, F7 - pro micro
= <&pro_micro 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> // B6
, <&pro_micro 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> // B2
, <&pro_micro 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> // B3
, <&pro_micro 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> // B1
, <&pro_micro 18 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> // F7
;
output-gpios // D7, E6, B4, B5 lagom - pro micro
= <&pro_micro 6 GPIO_ACTIVE_HIGH> // D7
, <&pro_micro 7 GPIO_ACTIVE_HIGH> // E6
, <&pro_micro 8 GPIO_ACTIVE_HIGH> // B4
, <&pro_micro 9 GPIO_ACTIVE_HIGH> // B5
;
};
default_transform: matrix_transform {
compatible = "zmk,matrix-transform";
rows = <5>;
columns = <16>;
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(0,12) RC(0,14) RC(0,15)
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(1,12) RC(1,13) RC(1,14) RC(1,15)
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(2,13) RC(2,14) RC(2,15)
RC(3,0) 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(3,12) RC(3,13) RC(3,14)
RC(4,0) RC(4,1) RC(4,2) RC(4,6) RC(4,10) RC(4,11) RC(4,12) RC(4,13) RC(4,14)
>;
};
};
&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>;
com-sequential;
prechargep = <0x22>;
};
};

View file

@ -0,0 +1,9 @@
file_format: "1"
id: lagom
name: Lagom
type: shield
url: https://github.com/mohoyt/lagom
requires: [pro_micro]
features:
- keys
- encoder