Add rgb underglow support

This commit is contained in:
Elliot Pahl 2022-05-22 00:54:29 +10:00 committed by Duccio
parent d97948d1a1
commit 60e6890aff
6 changed files with 56 additions and 10 deletions

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/led/led.h>
&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 = <8>;
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

@ -3,3 +3,7 @@
# Uncomment to turn on logging, and set ZMK logging to debug output
# CONFIG_ZMK_USB_LOGGING=y
# Uncomment the following lines to enable RGB underglow
# CONFIG_ZMK_RGB_UNDERGLOW=y
# CONFIG_WS2812_STRIP=y

View file

@ -8,6 +8,7 @@
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/outputs.h>
#include <dt-bindings/zmk/rgb.h>
#define BASE 0
#define ARROW 1
@ -34,11 +35,11 @@
arrow_layer {
bindings = <
&bt BT_SEL 0 &bt BT_SEL 1 &trans &trans &trans &out OUT_USB &out OUT_BLE
&trans &trans &kp UP &trans &trans &trans &trans
&bt BT_CLR &trans &kp LEFT &kp DOWN &kp RIGHT &trans &trans &trans
&reset &trans &trans &trans &trans &trans &trans &trans
&bootloader &trans &trans &trans &trans &trans
&bt BT_SEL 0 &bt BT_SEL 1 &trans &trans &trans &out OUT_USB &out OUT_BLE
&trans &trans &kp UP &trans &rgb_ug RGB_TOG &rgb_ug RGB_HUI &rgb_ug RGB_HUD
&bt BT_CLR &trans &kp LEFT &kp DOWN &kp RIGHT &trans &rgb_ug RGB_BRI &rgb_ug RGB_BRD
&reset &trans &trans &trans &trans &trans &rgb_ug RGB_EFF &rgb_ug RGB_EFR
&bootloader &trans &trans &trans &trans &trans
>;
};

View file

@ -6,3 +6,4 @@ url: https://github.com/duckyb/eternal-keypad
requires: [pro_micro]
features:
- keys
- underglow

View file

@ -8,6 +8,7 @@
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/outputs.h>
#include <dt-bindings/zmk/rgb.h>
#define BASE 0
#define ARROW 1
@ -34,11 +35,11 @@
arrow_layer {
bindings = <
&bt BT_SEL 0 &bt BT_SEL 1 &trans &trans &trans &out OUT_USB &out OUT_BLE
&trans &trans &kp UP &trans &trans &trans &trans
&bt BT_CLR &trans &kp RIGHT &kp DOWN &kp RIGHT &trans &trans &trans
&reset &trans &trans &trans &trans &trans &trans &trans
&bootloader &trans &trans &trans &trans &trans
&bt BT_SEL 0 &bt BT_SEL 1 &trans &trans &trans &out OUT_USB &out OUT_BLE
&trans &trans &kp UP &trans &rgb_ug RGB_TOG &rgb_ug RGB_HUI &rgb_ug RGB_HUD
&bt BT_CLR &trans &kp RIGHT &kp DOWN &kp RIGHT &trans &rgb_ug RGB_BRI &rgb_ug RGB_BRD
&reset &trans &trans &trans &trans &trans &rgb_ug RGB_EFF &rgb_ug RGB_EFR
&bootloader &trans &trans &trans &trans &trans
>;
};

View file

@ -6,3 +6,4 @@ url: https://github.com/duckyb/eternal-keypad
requires: [pro_micro]
features:
- keys
- underglow