samples: sensor: max17262: 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
00e22733a1
commit
76785bb12c
|
@ -20,13 +20,12 @@
|
|||
|
||||
void main(void)
|
||||
{
|
||||
const struct device *dev = device_get_binding(MAX17262_LABEL);
|
||||
const struct device *dev = DEVICE_DT_GET_ONE(maxim_max17262);
|
||||
|
||||
if (dev == NULL) {
|
||||
printk("No device found...\n");
|
||||
if (!device_is_ready(dev)) {
|
||||
printk("sensor: device not ready.\n");
|
||||
return;
|
||||
}
|
||||
printk("Found device %s\n", dev->name);
|
||||
|
||||
while (1) {
|
||||
struct sensor_value voltage, avg_current, temperature;
|
||||
|
|
Loading…
Reference in a new issue