samples: ms5837: 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
5832e588e3
commit
e30cfa42d4
1 changed files with 6 additions and 1 deletions
|
@ -15,12 +15,17 @@ LOG_MODULE_REGISTER(main);
|
|||
void main(void)
|
||||
{
|
||||
struct sensor_value oversampling_rate = { 8192, 0 };
|
||||
const struct device *dev = device_get_binding(DT_LABEL(DT_INST(0, meas_ms5837)));
|
||||
const struct device *dev = DEVICE_DT_GET_ANY(meas_ms5837);
|
||||
|
||||
if (dev == NULL) {
|
||||
LOG_ERR("Could not find MS5837 device, aborting test.");
|
||||
return;
|
||||
}
|
||||
if (!device_is_ready(dev)) {
|
||||
LOG_ERR("MS5837 device %s is not ready, aborting test.",
|
||||
dev->name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sensor_attr_set(dev, SENSOR_CHAN_ALL, SENSOR_ATTR_OVERSAMPLING,
|
||||
&oversampling_rate) != 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue