I'm trying to implement the WS2812 driver in my own project. I'm referencing the sample code stored in zephyr/samples/drivers/led_ws2812. I have copied over all of the correct configuration files, however, I'm getting an error when I try to define the strip device struct. The line shown here is throwing the error:
#define STRIP_NODE DT_ALIAS(led_strip) #define STRIP_NUM_PIXELS DT_PROP(DT_ALIAS(led_strip), chain_length) // I believe this is the problem somehow: static const struct device *strip = DEVICE_DT_GET(STRIP_NODE);
The error I'm getting on compile is:
undefined reference to `__device_dts_ord_61'
I have triple-checked all of my includes, my proj.conf is exactly the same as the sample, and my nrf52dk_nrf52832.overlay has the correct configuration. What am I missing? The sample compiles just fine.
Alternately, how is the *strip definition different than a normal sensor definition? For example, I have initialized my accelerometer as such:
const struct device *sensor = device_get_binding("LIS3DH");
Is there a way to follow that same convention for my LED strip that would prevent this error I am seeing? Calling device_get_binding("WS2812") results in a NULL device. See below for my overlay file:
&i2c1 {
compatible = "nordic,nrf-twim";
status = "okay";
sda-pin = <30>;
scl-pin = <31>;
clock-frequency = <I2C_BITRATE_FAST>;
lis2dh@18 {
compatible = "st,lis2dh";
reg = <0x18>;
label = "LIS3DH";
};
};
#include "../nrf52-bindings.h"
&arduino_spi { /* MOSI on D11 / P0.23 */
compatible = "nordic,nrf-spim";
led_strip: ws2812@0 {
compatible = "worldsemi,ws2812-spi";
label = "WS2812";
/* SPI */
reg = <0>; /* ignored, but necessary for SPI bindings */
spi-max-frequency = <SPI_FREQ>;
/* WS2812 */
chain-length = <10>; /* arbitrary; change at will */
spi-one-frame = <ONE_FRAME>;
spi-zero-frame = <ZERO_FRAME>;
};
};
/ {
aliases {
led-strip = &led_strip;
};
};