From ef3eb339ede6568c96c095648d2e0f20715e2549 Mon Sep 17 00:00:00 2001 From: Kurtis Lew Date: Wed, 22 Jun 2022 15:07:05 -0700 Subject: [PATCH] feat(shields): Add RGB support to 2% Milk Co-Authored-By: treezoob <98245530+treezoob@users.noreply.github.com> --- .../two_percent_milk/boards/nice_nano.overlay | 31 ++++++++++++++++++ .../boards/nice_nano_v2.overlay | 31 ++++++++++++++++++ .../boards/nrfmicro_11.overlay | 32 +++++++++++++++++++ .../boards/nrfmicro_11_flipped.overlay | 31 ++++++++++++++++++ .../boards/nrfmicro_13.overlay | 31 ++++++++++++++++++ .../two_percent_milk/two_percent_milk.conf | 7 ++++ 6 files changed, 163 insertions(+) create mode 100644 app/boards/shields/two_percent_milk/boards/nice_nano.overlay create mode 100644 app/boards/shields/two_percent_milk/boards/nice_nano_v2.overlay create mode 100644 app/boards/shields/two_percent_milk/boards/nrfmicro_11.overlay create mode 100644 app/boards/shields/two_percent_milk/boards/nrfmicro_11_flipped.overlay create mode 100644 app/boards/shields/two_percent_milk/boards/nrfmicro_13.overlay diff --git a/app/boards/shields/two_percent_milk/boards/nice_nano.overlay b/app/boards/shields/two_percent_milk/boards/nice_nano.overlay new file mode 100644 index 00000000..dd7e34c4 --- /dev/null +++ b/app/boards/shields/two_percent_milk/boards/nice_nano.overlay @@ -0,0 +1,31 @@ +#include + +&spi1 { + compatible = "nordic,nrf-spim"; + status = "okay"; + mosi-pin = <9>; + // 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 = <2>; + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + color-mapping = ; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/two_percent_milk/boards/nice_nano_v2.overlay b/app/boards/shields/two_percent_milk/boards/nice_nano_v2.overlay new file mode 100644 index 00000000..dd7e34c4 --- /dev/null +++ b/app/boards/shields/two_percent_milk/boards/nice_nano_v2.overlay @@ -0,0 +1,31 @@ +#include + +&spi1 { + compatible = "nordic,nrf-spim"; + status = "okay"; + mosi-pin = <9>; + // 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 = <2>; + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + color-mapping = ; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/two_percent_milk/boards/nrfmicro_11.overlay b/app/boards/shields/two_percent_milk/boards/nrfmicro_11.overlay new file mode 100644 index 00000000..c2dab5a6 --- /dev/null +++ b/app/boards/shields/two_percent_milk/boards/nrfmicro_11.overlay @@ -0,0 +1,32 @@ +#include + +&spi1 { + compatible = "nordic,nrf-spim"; + status = "okay"; + mosi-pin = <43>; + // Unused pins, needed for SPI definition, but not used by the ws2812 driver itself. + sck-pin = <12>; // 0.12 is not broken out on the nRFMicro + miso-pin = <22>; // 0.22 is not broken out on the nRFMicro + + 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 = <2>; + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + color-mapping = ; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; + diff --git a/app/boards/shields/two_percent_milk/boards/nrfmicro_11_flipped.overlay b/app/boards/shields/two_percent_milk/boards/nrfmicro_11_flipped.overlay new file mode 100644 index 00000000..e53b149a --- /dev/null +++ b/app/boards/shields/two_percent_milk/boards/nrfmicro_11_flipped.overlay @@ -0,0 +1,31 @@ +#include + +&spi1 { + compatible = "nordic,nrf-spim"; + status = "okay"; + mosi-pin = <38>; + // Unused pins, needed for SPI definition, but not used by the ws2812 driver itself. + sck-pin = <12>; // 0.12 is not broken out on the nRFMicro + miso-pin = <22>; // 0.22 is not broken out on the nRFMicro + + 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 = <2>; + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + color-mapping = ; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/two_percent_milk/boards/nrfmicro_13.overlay b/app/boards/shields/two_percent_milk/boards/nrfmicro_13.overlay new file mode 100644 index 00000000..252329b4 --- /dev/null +++ b/app/boards/shields/two_percent_milk/boards/nrfmicro_13.overlay @@ -0,0 +1,31 @@ +#include + +&spi1 { + compatible = "nordic,nrf-spim"; + status = "okay"; + mosi-pin = <43>; + // Unused pins, needed for SPI definition, but not used by the ws2812 driver itself. + sck-pin = <12>; // 0.12 is not broken out on the nRFMicro + miso-pin = <22>; // 0.22 is not broken out on the nRFMicro + + 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 = <2>; + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + color-mapping = ; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/two_percent_milk/two_percent_milk.conf b/app/boards/shields/two_percent_milk/two_percent_milk.conf index fb23f20c..4baccacf 100644 --- a/app/boards/shields/two_percent_milk/two_percent_milk.conf +++ b/app/boards/shields/two_percent_milk/two_percent_milk.conf @@ -1,2 +1,9 @@ # Copyright (c) 2022 The ZMK Contributors # SPDX-License-Identifier: MIT + +# Uncomment the following lines to enable RGB Underglow +# CONFIG_ZMK_RGB_UNDERGLOW=y +# CONFIG_WS2812_STRIP=y + +# Uncomment the following line to turn on logging, and set ZMK logging to debug output +# CONFIG_ZMK_USB_LOGGING=y \ No newline at end of file