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:
Martí Bolívar 2021-04-26 12:54:44 -07:00 committed by Carles Cufí
commit 62a1f4e40a

View file

@ -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);
}
/*