Skip to content

Commit d9b33e8

Browse files
committed
samples: led-strip: add ws2812 espressif rmt based driver example
This sample is updated to illustrate the usage of WS2812 led-strip Espressif RMT driver. Signed-off-by: Joel Guittet <joelguittet@gmail.com>
1 parent 69c9c54 commit d9b33e8

File tree

2 files changed

+51
-8
lines changed

2 files changed

+51
-8
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/dt-bindings/led/led.h>
8+
9+
/delete-node/ &rmt_default;
10+
11+
/ {
12+
aliases {
13+
led-strip = &led_strip;
14+
};
15+
};
16+
17+
&pinctrl {
18+
rmt_default: rmt_default {
19+
group1 {
20+
pinmux = <RMT_OUT0_GPIO13>;
21+
};
22+
};
23+
};
24+
25+
&rmt {
26+
status = "okay";
27+
pinctrl-0 = <&rmt_default>;
28+
pinctrl-names = "default";
29+
30+
led_strip: ws2812@0 {
31+
compatible = "worldsemi,ws2812-espressif-rmt";
32+
reg = <0>;
33+
chain-length = <1>;
34+
color-mapping = <LED_COLOR_ID_GREEN
35+
LED_COLOR_ID_RED
36+
LED_COLOR_ID_BLUE>;
37+
reset-delay = <500>;
38+
};
39+
};

samples/drivers/led/led_strip/boards/esp32s3_devkitc_procpu.overlay

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,31 @@
66

77
#include <zephyr/dt-bindings/led/led.h>
88

9+
/delete-node/ &rmt_default;
10+
911
/ {
1012
aliases {
1113
led-strip = &led_strip;
1214
};
1315
};
1416

15-
&i2s0_default {
16-
group1 {
17-
pinmux = <I2S0_O_SD_GPIO48>;
17+
&pinctrl {
18+
rmt_default: rmt_default {
19+
group1 {
20+
pinmux = <RMT_OUT3_GPIO48>;
21+
};
1822
};
1923
};
2024

21-
i2s_led: &i2s0 {
25+
&rmt {
2226
status = "okay";
23-
24-
dmas = <&dma 3>;
27+
pinctrl-0 = <&rmt_default>;
28+
pinctrl-names = "default";
29+
dmas = <&dma 9>;
2530
dma-names = "tx";
2631

2732
led_strip: ws2812@0 {
28-
compatible = "worldsemi,ws2812-i2s";
29-
33+
compatible = "worldsemi,ws2812-espressif-rmt";
3034
reg = <0>;
3135
chain-length = <1>;
3236
color-mapping = <LED_COLOR_ID_GREEN

0 commit comments

Comments
 (0)