samples: sensor: ccs811: Convert sample to use DEVICE_DT_GET_ONE
Move to use DEVICE_DT_GET_ONE instead of device_get_binding as we work on phasing out use of DTS 'label' property. Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
This commit is contained in:
parent
d4f00fe3c4
commit
22fd253fea
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue