samples: max30101: 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
72795c3e6c
commit
e98f61c191
|
@ -11,12 +11,16 @@
|
|||
void main(void)
|
||||
{
|
||||
struct sensor_value green;
|
||||
const struct device *dev = device_get_binding(DT_LABEL(DT_INST(0, max_max30101)));
|
||||
const struct device *dev = DEVICE_DT_GET_ANY(max_max30101);
|
||||
|
||||
if (dev == NULL) {
|
||||
printf("Could not get max30101 device\n");
|
||||
return;
|
||||
}
|
||||
if (!device_is_ready(dev)) {
|
||||
printf("max30101 device %s is not ready\n", dev->name);
|
||||
return;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
sensor_sample_fetch(dev);
|
||||
|
|
Loading…
Reference in a new issue