Skip to content

Commit ff34965

Browse files
FRASTMnashif
authored andcommitted
samples: drivers led strip ws2812 overlay for stm32 nucleo
The spi node of the led_ws2812 now includes the frame format as defined by the dts bindings spi-device.yaml SPI_FRAME_FORMAT_TI is selected with overlay for target boards. Signed-off-by: Francois Ramu <[email protected]>
1 parent d65a74e commit ff34965

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

samples/drivers/led_ws2812/boards/nucleo_f070rb.overlay

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
/* SPI */
2020
reg = <0>; /* ignored, but necessary for SPI bindings */
2121
spi-max-frequency = <B1414_SPI_FREQ>;
22+
frame-format = <32768>; /* SPI_FRAME_FORMAT_TI */
2223

2324
/* B1414 */
2425
chain-length = <18>; /* arbitrary; change at will */
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2021, STMicroelectronics
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <dt-bindings/led/led.h>
8+
9+
&arduino_spi {
10+
led_strip: ws2812@0 {
11+
compatible = "worldsemi,ws2812-spi";
12+
label = "WS2812";
13+
14+
/* SPI */
15+
reg = <0>; /* ignored, but necessary for SPI bindings */
16+
spi-max-frequency = <4000000>;
17+
frame-format = <32768>; /* SPI_FRAME_FORMAT_TI */
18+
19+
/* WS2812 */
20+
chain-length = <16>; /* arbitrary; change at will */
21+
spi-one-frame = <0x70>;
22+
spi-zero-frame = <0x40>;
23+
color-mapping = <LED_COLOR_ID_GREEN
24+
LED_COLOR_ID_RED
25+
LED_COLOR_ID_BLUE>;
26+
};
27+
};
28+
29+
/ {
30+
aliases {
31+
led-strip = &led_strip;
32+
};
33+
};

samples/drivers/led_ws2812/boards/nucleo_l476rg.overlay

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/* SPI */
1515
reg = <0>; /* ignored, but necessary for SPI bindings */
1616
spi-max-frequency = <4000000>;
17+
frame-format = <32768>; /* SPI_FRAME_FORMAT_TI */
1718

1819
/* WS2812 */
1920
chain-length = <16>; /* arbitrary; change at will */

0 commit comments

Comments
 (0)