From bf2fc68070520a350266875075c912e863fcbf7c Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Fri, 5 Nov 2021 16:25:06 -0400 Subject: [PATCH] fix(underglow): Add newly required color-mapping prop. --- app/boards/arm/bdn9/bdn9_rev2.dts | 29 +++++++++-------- app/boards/arm/nice60/nice60.dts | 3 ++ app/boards/arm/nice_nano/nice_nano.dtsi | 2 +- .../shields/chalice/boards/nice_nano.overlay | 4 +++ .../chalice/boards/nice_nano_v2.overlay | 4 +++ .../shields/corne/boards/nice_nano.overlay | 4 +++ .../elephant42/boards/nice_nano_v2.overlay | 4 +++ .../shields/helix/boards/nice_nano.overlay | 4 +++ .../shields/jorne/boards/nice_nano.overlay | 3 ++ .../shields/kyria/boards/nice_nano.overlay | 3 ++ .../shields/kyria/boards/nice_nano_v2.overlay | 32 +++++++++++++++++++ .../shields/kyria/boards/nrfmicro_11.overlay | 3 ++ .../kyria/boards/nrfmicro_11_flipped.overlay | 3 ++ .../shields/kyria/boards/nrfmicro_13.overlay | 3 ++ .../shields/lily58/boards/nice_nano.overlay | 3 ++ .../shields/microdox/boards/nice_nano.overlay | 4 +++ .../shields/murphpad/boards/nice_nano.overlay | 4 +++ .../shields/nibble/boards/nice_nano.overlay | 3 ++ .../shields/redox/boards/nice_nano.overlay | 4 +++ .../reviung41/boards/nice_nano.overlay | 3 ++ .../romac_plus/boards/nice_nano.overlay | 3 ++ .../shields/tg4x/boards/nice_nano.overlay | 3 ++ .../shields/tidbit/boards/nice_nano.overlay | 3 ++ docs/docs/features/underglow.md | 17 ++++++++++ 24 files changed, 133 insertions(+), 15 deletions(-) create mode 100644 app/boards/shields/kyria/boards/nice_nano_v2.overlay diff --git a/app/boards/arm/bdn9/bdn9_rev2.dts b/app/boards/arm/bdn9/bdn9_rev2.dts index c005be17..3ce9758d 100644 --- a/app/boards/arm/bdn9/bdn9_rev2.dts +++ b/app/boards/arm/bdn9/bdn9_rev2.dts @@ -6,6 +6,7 @@ /dts-v1/; #include +#include / { model = "Keeb.io BDN9 rev2"; @@ -18,24 +19,24 @@ zmk,kscan = &kscan; /* TODO: Enable once the GPIO bitbanging driver supports STM32 zmk,underglow = &led_strip; - */ + */ }; - + kscan: kscan { compatible = "zmk,kscan-gpio-direct"; label = "KSCAN"; input-gpios - = <&gpiob 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - , <&gpiob 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - , <&gpiob 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - , <&gpiob 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - , <&gpiob 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - , <&gpiob 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - , <&gpioa 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - , <&gpiof 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - , <&gpiof 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> - ; + = <&gpiob 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpiob 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpiob 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpiob 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpiob 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpiob 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpioa 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpiof 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpiof 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + ; }; /* @@ -47,7 +48,7 @@ chain-length = <9>; }; - */ + */ left_encoder: encoder_left { compatible = "alps,ec11"; @@ -96,7 +97,7 @@ &flash0 { /* * For more information, see: - * http://docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions + * http: //docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions */ partitions { compatible = "fixed-partitions"; diff --git a/app/boards/arm/nice60/nice60.dts b/app/boards/arm/nice60/nice60.dts index 20f2a1a7..ee38c9a5 100644 --- a/app/boards/arm/nice60/nice60.dts +++ b/app/boards/arm/nice60/nice60.dts @@ -6,6 +6,8 @@ /dts-v1/; #include + +#include #include / { @@ -124,6 +126,7 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,5) R chain-length = <12>; /* LED strip length */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + color-mapping = ; }; }; diff --git a/app/boards/arm/nice_nano/nice_nano.dtsi b/app/boards/arm/nice_nano/nice_nano.dtsi index 52b92612..6c9d081c 100644 --- a/app/boards/arm/nice_nano/nice_nano.dtsi +++ b/app/boards/arm/nice_nano/nice_nano.dtsi @@ -67,7 +67,7 @@ &flash0 { /* * For more information, see: - * http: //docs.zephyrproject.org/latest/devices/dts/flash_partitions.html + * http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html */ partitions { compatible = "fixed-partitions"; diff --git a/app/boards/shields/chalice/boards/nice_nano.overlay b/app/boards/shields/chalice/boards/nice_nano.overlay index 21e28515..5a74582a 100644 --- a/app/boards/shields/chalice/boards/nice_nano.overlay +++ b/app/boards/shields/chalice/boards/nice_nano.overlay @@ -1,3 +1,5 @@ +#include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -18,6 +20,8 @@ chain-length = <14>; /* arbitrary; change at will */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + + color-mapping = ; }; }; diff --git a/app/boards/shields/chalice/boards/nice_nano_v2.overlay b/app/boards/shields/chalice/boards/nice_nano_v2.overlay index 21e28515..5a74582a 100644 --- a/app/boards/shields/chalice/boards/nice_nano_v2.overlay +++ b/app/boards/shields/chalice/boards/nice_nano_v2.overlay @@ -1,3 +1,5 @@ +#include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -18,6 +20,8 @@ chain-length = <14>; /* arbitrary; change at will */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + + color-mapping = ; }; }; diff --git a/app/boards/shields/corne/boards/nice_nano.overlay b/app/boards/shields/corne/boards/nice_nano.overlay index 83ebae04..e5f84063 100644 --- a/app/boards/shields/corne/boards/nice_nano.overlay +++ b/app/boards/shields/corne/boards/nice_nano.overlay @@ -1,3 +1,5 @@ +#include + &spi1 { compatible = "nordic,nrf-spim"; /* Cannot be used together with i2c0. */ @@ -19,6 +21,8 @@ chain-length = <6>; /* There are per-key RGB, but the first 6 are underglow */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + + color-mapping = ; }; }; diff --git a/app/boards/shields/elephant42/boards/nice_nano_v2.overlay b/app/boards/shields/elephant42/boards/nice_nano_v2.overlay index 6cd5de8c..87c8da21 100644 --- a/app/boards/shields/elephant42/boards/nice_nano_v2.overlay +++ b/app/boards/shields/elephant42/boards/nice_nano_v2.overlay @@ -1,3 +1,5 @@ +#include + &spi1 { compatible = "nordic,nrf-spim"; /* Cannot be used together with i2c0. */ @@ -18,6 +20,8 @@ chain-length = <27>; /* There are per-key RGB and the LAST 6 are underglow */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + + color-mapping = ; }; }; diff --git a/app/boards/shields/helix/boards/nice_nano.overlay b/app/boards/shields/helix/boards/nice_nano.overlay index 78576d13..da7deed1 100644 --- a/app/boards/shields/helix/boards/nice_nano.overlay +++ b/app/boards/shields/helix/boards/nice_nano.overlay @@ -4,6 +4,8 @@ * SPDX-License-Identifier: MIT */ +#include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -24,6 +26,8 @@ chain-length = <32>; /* number of LEDs */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + + color-mapping = ; }; }; diff --git a/app/boards/shields/jorne/boards/nice_nano.overlay b/app/boards/shields/jorne/boards/nice_nano.overlay index 03b868ce..2864fd60 100644 --- a/app/boards/shields/jorne/boards/nice_nano.overlay +++ b/app/boards/shields/jorne/boards/nice_nano.overlay @@ -1,3 +1,5 @@ +#include + &spi1 { compatible = "nordic,nrf-spim"; /* Cannot be used together with i2c0. */ @@ -19,6 +21,7 @@ chain-length = <6>; /* There are per-key RGB, but the first 6 are underglow */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + color-mapping = ; }; }; diff --git a/app/boards/shields/kyria/boards/nice_nano.overlay b/app/boards/shields/kyria/boards/nice_nano.overlay index 8be964b5..b774b4ba 100644 --- a/app/boards/shields/kyria/boards/nice_nano.overlay +++ b/app/boards/shields/kyria/boards/nice_nano.overlay @@ -1,3 +1,5 @@ +#include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -18,6 +20,7 @@ chain-length = <10>; /* arbitrary; change at will */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + color-mapping = ; }; }; diff --git a/app/boards/shields/kyria/boards/nice_nano_v2.overlay b/app/boards/shields/kyria/boards/nice_nano_v2.overlay new file mode 100644 index 00000000..b1e7fbb5 --- /dev/null +++ b/app/boards/shields/kyria/boards/nice_nano_v2.overlay @@ -0,0 +1,32 @@ +#include + +&spi1 { + compatible = "nordic,nrf-spim"; + 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 = "WS2812"; + + /* SPI */ + reg = <0>; /* ignored, but necessary for SPI bindings */ + spi-max-frequency = <4000000>; + + /* WS2812 */ + chain-length = <10>; /* arbitrary; change at will */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + + color-mapping = ; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/kyria/boards/nrfmicro_11.overlay b/app/boards/shields/kyria/boards/nrfmicro_11.overlay index b88573b6..1cff5f77 100644 --- a/app/boards/shields/kyria/boards/nrfmicro_11.overlay +++ b/app/boards/shields/kyria/boards/nrfmicro_11.overlay @@ -1,3 +1,5 @@ +#include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -18,6 +20,7 @@ chain-length = <10>; /* arbitrary; change at will */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + color-mapping = ; }; }; diff --git a/app/boards/shields/kyria/boards/nrfmicro_11_flipped.overlay b/app/boards/shields/kyria/boards/nrfmicro_11_flipped.overlay index c6a24665..80d0c898 100644 --- a/app/boards/shields/kyria/boards/nrfmicro_11_flipped.overlay +++ b/app/boards/shields/kyria/boards/nrfmicro_11_flipped.overlay @@ -1,3 +1,5 @@ +#include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -18,6 +20,7 @@ chain-length = <10>; /* arbitrary; change at will */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + color-mapping = ; }; }; diff --git a/app/boards/shields/kyria/boards/nrfmicro_13.overlay b/app/boards/shields/kyria/boards/nrfmicro_13.overlay index c6a24665..80d0c898 100644 --- a/app/boards/shields/kyria/boards/nrfmicro_13.overlay +++ b/app/boards/shields/kyria/boards/nrfmicro_13.overlay @@ -1,3 +1,5 @@ +#include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -18,6 +20,7 @@ chain-length = <10>; /* arbitrary; change at will */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + color-mapping = ; }; }; diff --git a/app/boards/shields/lily58/boards/nice_nano.overlay b/app/boards/shields/lily58/boards/nice_nano.overlay index 0d28726d..69bfffa0 100644 --- a/app/boards/shields/lily58/boards/nice_nano.overlay +++ b/app/boards/shields/lily58/boards/nice_nano.overlay @@ -4,6 +4,8 @@ * SPDX-License-Identifier: MIT */ +#include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -24,6 +26,7 @@ chain-length = <5>; /* number of LEDs */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + color-mapping = ; }; }; diff --git a/app/boards/shields/microdox/boards/nice_nano.overlay b/app/boards/shields/microdox/boards/nice_nano.overlay index 1b84b6b5..360e7098 100644 --- a/app/boards/shields/microdox/boards/nice_nano.overlay +++ b/app/boards/shields/microdox/boards/nice_nano.overlay @@ -3,6 +3,9 @@ * * SPDX-License-Identifier: MIT */ + +#include + &spi1 { compatible = "nordic,nrf-spim"; /* Cannot be used together with i2c0. */ @@ -24,6 +27,7 @@ chain-length = <6>; /* There are per-key RGB, but the first 6 are underglow */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + color-mapping = ; }; }; diff --git a/app/boards/shields/murphpad/boards/nice_nano.overlay b/app/boards/shields/murphpad/boards/nice_nano.overlay index b247334e..d7cdcff7 100644 --- a/app/boards/shields/murphpad/boards/nice_nano.overlay +++ b/app/boards/shields/murphpad/boards/nice_nano.overlay @@ -4,6 +4,8 @@ * SPDX-License-Identifier: MIT */ + #include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -24,6 +26,8 @@ chain-length = <8>; /* number of LEDs */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + + color-mapping = ; }; }; diff --git a/app/boards/shields/nibble/boards/nice_nano.overlay b/app/boards/shields/nibble/boards/nice_nano.overlay index 8da95ac1..0a08c770 100644 --- a/app/boards/shields/nibble/boards/nice_nano.overlay +++ b/app/boards/shields/nibble/boards/nice_nano.overlay @@ -4,6 +4,8 @@ * SPDX-License-Identifier: MIT */ +#include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -24,6 +26,7 @@ chain-length = <10>; /* number of LEDs */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + color-mapping = ; }; }; diff --git a/app/boards/shields/redox/boards/nice_nano.overlay b/app/boards/shields/redox/boards/nice_nano.overlay index b81ba195..d67e46f9 100644 --- a/app/boards/shields/redox/boards/nice_nano.overlay +++ b/app/boards/shields/redox/boards/nice_nano.overlay @@ -4,6 +4,8 @@ * SPDX-License-Identifier: MIT */ + #include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -24,6 +26,8 @@ chain-length = <5>; /* number of LEDs */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + + color-mapping = ; }; }; diff --git a/app/boards/shields/reviung41/boards/nice_nano.overlay b/app/boards/shields/reviung41/boards/nice_nano.overlay index b6c89e80..b52faac6 100644 --- a/app/boards/shields/reviung41/boards/nice_nano.overlay +++ b/app/boards/shields/reviung41/boards/nice_nano.overlay @@ -1,3 +1,5 @@ +#include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -18,6 +20,7 @@ chain-length = <11>; /* arbitrary; change at will */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + color-mapping = ; }; }; diff --git a/app/boards/shields/romac_plus/boards/nice_nano.overlay b/app/boards/shields/romac_plus/boards/nice_nano.overlay index 17d11927..dc686af8 100644 --- a/app/boards/shields/romac_plus/boards/nice_nano.overlay +++ b/app/boards/shields/romac_plus/boards/nice_nano.overlay @@ -1,3 +1,5 @@ +#include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -18,6 +20,7 @@ chain-length = <10>; /* arbitrary; change at will */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + color-mapping = ; }; }; diff --git a/app/boards/shields/tg4x/boards/nice_nano.overlay b/app/boards/shields/tg4x/boards/nice_nano.overlay index 60492bec..fe7fbf18 100644 --- a/app/boards/shields/tg4x/boards/nice_nano.overlay +++ b/app/boards/shields/tg4x/boards/nice_nano.overlay @@ -4,6 +4,8 @@ * SPDX-License-Identifier: MIT */ +#include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -24,6 +26,7 @@ chain-length = <7>; /* number of LEDs */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + color-mapping = ; }; }; diff --git a/app/boards/shields/tidbit/boards/nice_nano.overlay b/app/boards/shields/tidbit/boards/nice_nano.overlay index 762a7403..d8a647e9 100644 --- a/app/boards/shields/tidbit/boards/nice_nano.overlay +++ b/app/boards/shields/tidbit/boards/nice_nano.overlay @@ -4,6 +4,8 @@ * SPDX-License-Identifier: MIT */ +#include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -24,6 +26,7 @@ chain-length = <8>; /* number of LEDs */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + color-mapping = ; }; }; diff --git a/docs/docs/features/underglow.md b/docs/docs/features/underglow.md index a093ecac..ac865826 100644 --- a/docs/docs/features/underglow.md +++ b/docs/docs/features/underglow.md @@ -67,6 +67,8 @@ To identify which pin number you need to put in the config you need do to a bit Here's an example on a definition that uses P0.06: ``` +#include + &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; @@ -87,6 +89,9 @@ Here's an example on a definition that uses P0.06: chain-length = <10>; /* number of LEDs */ spi-one-frame = <0x70>; spi-zero-frame = <0x40>; + color-mapping = ; }; }; ``` @@ -98,6 +103,13 @@ Ignoring these restrictions may result in poor wireless performance. You can fin ::: +:::note + +Standard WS2812 LEDs use a wire protocol where the bits for the colors green, red, and blue values are sent in that order. +If your board/shield uses LEDs that require the data sent in a different order, the `color-mapping` property ordering should be changed to match. + +::: + ### Other boards For other boards, you must select an SPI definition that has the `MOSI` pin as your data pin going to your LED strip. @@ -105,6 +117,8 @@ For other boards, you must select an SPI definition that has the `MOSI` pin as y Here's another example for a non-nRF52 board on `spi1`: ``` +#include + &spi1 { led_strip: ws2812@0 { @@ -119,6 +133,9 @@ Here's another example for a non-nRF52 board on `spi1`: chain-length = <10>; /* number of LEDs */ spi-one-frame = <0x70>; /* make sure to configure this properly for your SOC */ spi-zero-frame = <0x40>; /* make sure to configure this properly for your SOC */ + color-mapping = ; }; }; ```