From 6605b6d2297d3f21ce6c0bda4059b62fc9c96f5e Mon Sep 17 00:00:00 2001 From: Ramon Imbao Date: Tue, 14 Nov 2023 14:11:50 +0800 Subject: [PATCH] Enable RGB --- config/boards/arm/mona_w/mona_w.dts | 34 +++++++++++++++++++++++ config/boards/arm/mona_w/mona_w_defconfig | 5 ++++ 2 files changed, 39 insertions(+) diff --git a/config/boards/arm/mona_w/mona_w.dts b/config/boards/arm/mona_w/mona_w.dts index 2901af4..8308fad 100644 --- a/config/boards/arm/mona_w/mona_w.dts +++ b/config/boards/arm/mona_w/mona_w.dts @@ -7,6 +7,7 @@ /dts-v1/; #include #include +#include / { model = "mona_w"; @@ -19,6 +20,7 @@ zmk,kscan = &kscan0; zmk,matrix_transform = &default_transform; zmk,battery = &vbatt; + zmk,underglow = &led_strip; }; kscan0: kscan { @@ -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"; @@ -92,6 +100,32 @@ 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 = ; + }; +}; + &flash0 { /* * For more information, see: diff --git a/config/boards/arm/mona_w/mona_w_defconfig b/config/boards/arm/mona_w/mona_w_defconfig index 99d4fac..13c7b48 100644 --- a/config/boards/arm/mona_w/mona_w_defconfig +++ b/config/boards/arm/mona_w/mona_w_defconfig @@ -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 \ No newline at end of file