drivers: sensor: examplesensor: use gpio_pin_get_dt
Use the recently introduced GPIO API that allows obtaining pin state using the gpio_dt_spec struct. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
4520f6a75e
commit
bf4392f1a1
|
@ -26,7 +26,7 @@ static int examplesensor_sample_fetch(const struct device *dev,
|
||||||
const struct examplesensor_config *config = dev->config;
|
const struct examplesensor_config *config = dev->config;
|
||||||
struct examplesensor_data *data = dev->data;
|
struct examplesensor_data *data = dev->data;
|
||||||
|
|
||||||
data->state = gpio_pin_get(config->input.port, config->input.pin);
|
data->state = gpio_pin_get_dt(&config->input);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue