samples: mcp9808: 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:
parent
e98f61c191
commit
37f0ca0229
1 changed files with 6 additions and 3 deletions
|
@ -106,12 +106,15 @@ static void trigger_handler(const struct device *dev,
|
|||
|
||||
void main(void)
|
||||
{
|
||||
const char *const devname = DT_LABEL(DT_INST(0, microchip_mcp9808));
|
||||
const struct device *dev = device_get_binding(devname);
|
||||
const struct device *dev = DEVICE_DT_GET_ANY(microchip_mcp9808);
|
||||
int rc;
|
||||
|
||||
if (dev == NULL) {
|
||||
printf("Device %s not found.\n", devname);
|
||||
printf("Device not found.\n");
|
||||
return;
|
||||
}
|
||||
if (!device_is_ready(dev)) {
|
||||
printf("Device %s is not ready.\n", dev->name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue