Encode, OLED, and RGB Nice Nano support added as well as refining default keymap.

This commit is contained in:
Kyle McCreery 2021-03-03 14:29:47 -10:00
parent d78875bfb3
commit 880ac0ea40
6 changed files with 144 additions and 21 deletions

View file

@ -7,3 +7,39 @@ config ZMK_KEYBOARD_NAME
default "MurphPad" default "MurphPad"
endif endif
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

View file

@ -0,0 +1,4 @@
# Enable underglow
CONFIG_ZMK_RGB_UNDERGLOW=y
# Use the STRIP config specific to the LEDs you're using
CONFIG_WS2812_STRIP=y

View file

@ -0,0 +1,34 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
&spi1 {
compatible = "nordic,nrf-spim";
status = "okay";
mosi-pin = <31>;
// 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>;
};
};
/ {
chosen {
zmk,underglow = &led_strip;
};
};

View file

@ -1,6 +1,9 @@
# Turn on logging, and set ZMK logging to debug output # Uncomment to turn on logging, and set ZMK logging to debug output
CONFIG_ZMK_USB_LOGGING=n # CONFIG_ZMK_USB_LOGGING=y
# Uncomment to enable encoder # Uncomment to enable encoder
# CONFIG_EC11=y CONFIG_EC11=y
# CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
# Uncomment to enable OLED
CONFIG_ZMK_DISPLAY=y

View file

@ -11,6 +11,10 @@
#define TIMEOUT 100 #define TIMEOUT 100
&encoder_1 {
status = "okay";
};
/ { / {
combos { combos {
compatible = "zmk,combos"; compatible = "zmk,combos";
@ -35,28 +39,41 @@
bindings = <&bt BT_NXT>; bindings = <&bt BT_NXT>;
}; };
}; };
sensors {
compatible = "zmk,keymap-sensors";
sensors = <&encoder_1>;
};
keymap0: keymap { keymap0: keymap {
compatible = "zmk,keymap"; compatible = "zmk,keymap";
default_layer { default_layer {
label = "default layer";
bindings = < bindings = <
&none &kp F1 &kp F2 &kp F3 &kp F4 &none &kp F1 &kp F2 &kp F3 &kp F4
&none &kp KP_NUM &kp KP_DIVIDE &kp KP_MULTIPLY &kp KP_MINUS &none &kp ESC &kp KP_DIVIDE &kp KP_MULTIPLY &kp KP_MINUS
&none &kp KP_N7 &kp KP_N8 &kp KP_N9 &kp KP_PLUS &none &kp KP_N7 &kp KP_N8 &kp KP_N9 &kp KP_PLUS
&kp C_MUTE &kp KP_N4 &kp KP_N5 &kp KP_N6 &none &kp C_MUTE &kp KP_N4 &kp KP_N5 &kp KP_N6 &none
&mo 1 &kp KP_N1 &kp KP_N2 &kp KP_N3 &kp KP_ENTER &mo 1 &kp KP_N1 &kp KP_N2 &kp KP_N3 &kp KP_ENTER
&kp BSPC &kp KP_N0 &none &kp KP_DOT &none &kp BSPC &kp KP_N0 &none &kp KP_DOT &none
>; >;
sensor-bindings = <&inc_dec_kp C_VOLUME_DOWN C_VOLUME_UP>;
}; };
fn_layer { fn_layer {
label = "fn layer";
bindings = < bindings = <
&none &kp F1 &kp F2 &kp F3 &kp F4 &none &trans &trans &trans &trans
&none &kp KP_NUM &kp KP_DIVIDE &kp KP_MULTIPLY &kp KP_MINUS &none &kp KP_NUM &trans &trans &trans
&none &kp KP_N7 &kp KP_N8 &kp KP_N9 &ext_power EP_OFF &none &trans &trans &trans &ext_power EP_ON
&kp C_MUTE &kp KP_N4 &kp KP_N5 &kp KP_N6 &none &trans &trans &trans &trans &none
&mo 1 &kp KP_N1 &kp KP_N2 &kp KP_N3 &ext_power EP_OFF &trans &trans &trans &trans &ext_power EP_OFF
&kp BSPC &kp KP_N0 &none &kp KP_DOT &none &kp DEL &trans &none &trans &none
>; >;
sensor-bindings = <&inc_dec_kp C_BRI_DN C_BRI_UP>;
}; };
}; };

View file

@ -17,7 +17,7 @@
diode-direction = "col2row"; diode-direction = "col2row";
row-gpios row-gpios
= <&pro_micro_a 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> = <&pro_micro_a 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> , <&pro_micro_d 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> , <&pro_micro_d 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> , <&pro_micro_d 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
@ -33,4 +33,33 @@
; ;
}; };
encoder_1: encoder_1 {
compatible = "alps,ec11";
label = "Encoder 1";
a-gpios = <&pro_micro_d 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro_d 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
resolution = <4>;
status = "disabled";
};
};
&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>;
};
}; };