samples: sensor: sm351lt: 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
8f5d247a71
commit
5be2c81222
@ -41,11 +41,10 @@ static void trigger_handler(const struct device *dev,
|
||||
|
||||
void main(void)
|
||||
{
|
||||
const struct device *sensor = device_get_binding(DT_LABEL(DT_INST(0, honeywell_sm351lt)));
|
||||
const struct device *sensor = DEVICE_DT_GET_ONE(honeywell_sm351lt);
|
||||
|
||||
if (sensor == NULL) {
|
||||
printf("Could not get %s device\n",
|
||||
DT_LABEL(DT_INST(0, honeywell_sm351lt)));
|
||||
if (!device_is_ready(sensor)) {
|
||||
printk("Device %s is not ready\n", sensor->name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user