diff --git a/samples/sensor/ccs811/src/main.c b/samples/sensor/ccs811/src/main.c index 74e579a2b8f..6862c67c569 100644 --- a/samples/sensor/ccs811/src/main.c +++ b/samples/sensor/ccs811/src/main.c @@ -113,12 +113,12 @@ static void do_main(const struct device *dev) void main(void) { - const struct device *dev = device_get_binding(DT_LABEL(DT_INST(0, ams_ccs811))); + const struct device *dev = DEVICE_DT_GET_ONE(ams_ccs811); struct ccs811_configver_type cfgver; int rc; - if (!dev) { - printk("Failed to get device binding"); + if (!device_is_ready(dev)) { + printk("Device %s is not ready\n", dev->name); return; }