samples: adxl372: 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
fff2644189
commit
72795c3e6c
1 changed files with 7 additions and 3 deletions
|
@ -48,10 +48,14 @@ void main(void)
|
||||||
int i;
|
int i;
|
||||||
char meter[200];
|
char meter[200];
|
||||||
|
|
||||||
const struct device *dev = device_get_binding(DT_LABEL(DT_INST(0, adi_adxl372)));
|
const struct device *dev = DEVICE_DT_GET_ANY(adi_adxl372);
|
||||||
|
|
||||||
if (dev == NULL) {
|
if (!dev) {
|
||||||
printf("Could not get %s device\n", DT_LABEL(DT_INST(0, adi_adxl372)));
|
printf("Devicetree has no adi,adxl372 node\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!device_is_ready(dev)) {
|
||||||
|
printf("Device %s is not ready\n", dev->name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue