samples: led_apa102: drop device_get_binding/DT_INST
Use DEVICE_DT_GET_ANY. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
3c181e0496
commit
62a1f4e40a
1 changed files with 8 additions and 5 deletions
|
@ -56,12 +56,15 @@ void main(void)
|
|||
const struct device *strip;
|
||||
size_t i, time;
|
||||
|
||||
strip = device_get_binding(DT_LABEL(DT_INST(0, apa_apa102)));
|
||||
if (strip) {
|
||||
LOG_INF("Found LED strip device %s", DT_LABEL(DT_INST(0, apa_apa102)));
|
||||
} else {
|
||||
LOG_ERR("LED strip device %s not found", DT_LABEL(DT_INST(0, apa_apa102)));
|
||||
strip = DEVICE_DT_GET_ANY(apa_apa102);
|
||||
if (!strip) {
|
||||
LOG_ERR("LED strip device not found");
|
||||
return;
|
||||
} else if (!device_is_ready(strip)) {
|
||||
LOG_ERR("LED strip device %s is not ready", strip->name);
|
||||
return;
|
||||
} else {
|
||||
LOG_INF("Found LED strip device %s", strip->name);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue