Skip to content

Commit 715dc68

Browse files
raveiouscarlescufi
authored andcommitted
boards: Enabling neopixel on Adafruit Qt Py RP2040
Using the recently added WS2812 PIO driver, this enables the LED on the QT PY to work with the built in RGB LED examples. Signed-off-by: Ian Wakely <[email protected]>
1 parent 7c42c01 commit 715dc68

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

boards/arm/adafruit_qt_py_rp2040/adafruit_qt_py_rp2040-pinctrl.dtsi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,10 @@
6161

6262
clocks_default: clocks_default {
6363
};
64+
65+
ws2812_pio1_default: ws2812_pio1_default {
66+
ws2812 {
67+
pinmux = <PIO1_P12>;
68+
};
69+
};
6470
};

boards/arm/adafruit_qt_py_rp2040/adafruit_qt_py_rp2040.dts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "adafruit_qt_py_rp2040-pinctrl.dtsi"
1212
#include "seeed_xiao_connector.dtsi"
1313
#include <freq.h>
14+
#include <zephyr/dt-bindings/led/led.h>
1415

1516
/ {
1617
chosen {
@@ -24,6 +25,7 @@
2425

2526
aliases {
2627
watchdog0 = &wdt0;
28+
led-strip = &ws2812;
2729
};
2830
};
2931

@@ -68,6 +70,17 @@
6870

6971
&gpio0 {
7072
status = "okay";
73+
74+
/*
75+
* Unlike some of the other Adafruit boards, the neopixel on this board has
76+
* its positive side hooked up to a GPIO pin rather than a positive voltage
77+
* rail to save on power. This will enable the LED on board initialization.
78+
*/
79+
neopixel-power-enable {
80+
gpio-hog;
81+
gpios = <11 GPIO_ACTIVE_HIGH>;
82+
output-high;
83+
};
7184
};
7285

7386
&i2c0 {
@@ -109,6 +122,33 @@
109122
status = "okay";
110123
};
111124

125+
&pio1 {
126+
status = "okay";
127+
128+
/*
129+
* Need to put this on PIO1 as having this on PIO0 causes the GPIO hog to
130+
* not work.
131+
*/
132+
pio-ws2812 {
133+
compatible = "worldsemi,ws2812-rpi_pico-pio";
134+
status = "okay";
135+
pinctrl-0 = <&ws2812_pio1_default>;
136+
pinctrl-names = "default";
137+
bit-waveform = <3>, <3>, <4>;
138+
139+
ws2812: ws2812 {
140+
status = "okay";
141+
output-pin = <12>;
142+
chain-length = <1>;
143+
color-mapping = <LED_COLOR_ID_GREEN
144+
LED_COLOR_ID_RED
145+
LED_COLOR_ID_BLUE>;
146+
reset-delay = <280>;
147+
frequency = <800000>;
148+
};
149+
};
150+
};
151+
112152
zephyr_udc0: &usbd {
113153
status = "okay";
114154
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CONFIG_WS2812_STRIP_RPI_PICO_PIO=y
2+
CONFIG_GPIO=y
3+
CONFIG_GPIO_HOGS=y

0 commit comments

Comments
 (0)