Skip to content

Commit

Permalink
Enable RGB
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonimbao committed Nov 14, 2023
1 parent 111ccf6 commit 5279de3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
35 changes: 35 additions & 0 deletions config/boards/arm/mona_w/mona_w.dts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include <dt-bindings/zmk/matrix_transform.h>
#include <dt-bindings/led/led.h>

/ {
model = "mona_w";
Expand All @@ -19,6 +20,7 @@
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;
zmk,battery = &vbatt;
zmk,underglow = &led_strip;
};

kscan0: kscan {
Expand Down Expand Up @@ -68,6 +70,12 @@
>;
};

ext-power {
compatible = "zmk,ext-power-generic";
label = "EXT_POWER";
control-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
};

vbatt: vbatt {
compatible = "zmk,battery-voltage-divider";
label = "BATTERY";
Expand All @@ -92,6 +100,33 @@
status = "okay";
};

&spi1 {
compatible = "nordic,nrf-spim";
status = "okay";
mosi-pin = <5>;
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
sck-pin = <6>;
miso-pin = <8>;

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 = <16>; /* number of LEDs */
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;
color-mapping = <LED_COLOR_ID_GREEN
LED_COLOR_ID_RED
LED_COLOR_ID_BLUE>;
};
};


&flash0 {
/*
* For more information, see:
Expand Down
5 changes: 5 additions & 0 deletions config/boards/arm/mona_w/mona_w_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@ CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

# Enable Underglow
CONFIG_ZMK_RGB_UNDERGLOW=y
CONFIG_WS2812_STRIP=y
CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER=y

CONFIG_BUILD_OUTPUT_UF2=y

0 comments on commit 5279de3

Please sign in to comment.