fix(underglow): Add newly required color-mapping prop.

This commit is contained in:
Peter Johanson 2021-11-05 16:25:06 -04:00 committed by Pete Johanson
parent 8afe124153
commit bf2fc68070
24 changed files with 133 additions and 15 deletions

View File

@ -6,6 +6,7 @@
/dts-v1/;
#include <st/f0/stm32f072Xb.dtsi>
#include <dt-bindings/led/led.h>
/ {
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";

View File

@ -6,6 +6,8 @@
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include <dt-bindings/led/led.h>
#include <dt-bindings/zmk/matrix_transform.h>
/ {
@ -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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -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";

View File

@ -1,3 +1,5 @@
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -1,3 +1,5 @@
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -1,3 +1,5 @@
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -1,3 +1,5 @@
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -4,6 +4,8 @@
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -1,3 +1,5 @@
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -1,3 +1,5 @@
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -0,0 +1,32 @@
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};
/ {
chosen {
zmk,underglow = &led_strip;
};
};

View File

@ -1,3 +1,5 @@
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -1,3 +1,5 @@
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -1,3 +1,5 @@
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -4,6 +4,8 @@
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -3,6 +3,9 @@
*
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -4,6 +4,8 @@
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -4,6 +4,8 @@
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -4,6 +4,8 @@
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -1,3 +1,5 @@
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -1,3 +1,5 @@
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -4,6 +4,8 @@
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -4,6 +4,8 @@
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

View File

@ -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 <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN
LED_COLOR_ID_RED
LED_COLOR_ID_BLUE>;
};
};
```
@ -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 <dt-bindings/led/led.h>
&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 = <LED_COLOR_ID_GREEN
LED_COLOR_ID_RED
LED_COLOR_ID_BLUE>;
};
};
```