samples: led_ws2812: drop device_get_binding
Use DEVICE_DT_GET. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
5062a16c64
commit
1dbf6f7827
1 changed files with 6 additions and 6 deletions
|
@ -18,7 +18,7 @@ LOG_MODULE_REGISTER(main);
|
|||
#include <drivers/spi.h>
|
||||
#include <sys/util.h>
|
||||
|
||||
#define STRIP_LABEL DT_LABEL(DT_ALIAS(led_strip))
|
||||
#define STRIP_NODE DT_ALIAS(led_strip)
|
||||
#define STRIP_NUM_PIXELS DT_PROP(DT_ALIAS(led_strip), chain_length)
|
||||
|
||||
#define DELAY_TIME K_MSEC(50)
|
||||
|
@ -33,17 +33,17 @@ static const struct led_rgb colors[] = {
|
|||
|
||||
struct led_rgb pixels[STRIP_NUM_PIXELS];
|
||||
|
||||
static const struct device *strip = DEVICE_DT_GET(STRIP_NODE);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
const struct device *strip;
|
||||
size_t cursor = 0, color = 0;
|
||||
int rc;
|
||||
|
||||
strip = device_get_binding(STRIP_LABEL);
|
||||
if (strip) {
|
||||
LOG_INF("Found LED strip device %s", STRIP_LABEL);
|
||||
if (device_is_ready(strip)) {
|
||||
LOG_INF("Found LED strip device %s", strip->name);
|
||||
} else {
|
||||
LOG_ERR("LED strip device %s not found", STRIP_LABEL);
|
||||
LOG_ERR("LED strip device %s is not ready", strip->name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue