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:
Benjamin Björnsson 2022-06-18 14:58:11 +02:00 committed by Maureen Helm
parent d4f00fe3c4
commit 22fd253fea
1 changed files with 3 additions and 3 deletions

View File

@ -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;
}