drivers/sensor: lsm6dso: use gpio_dt_spec oriented macros

Use gpio_pin_configure_dt() and gpio_pin_interrupt_configure_dt()
for drdy_gpio: they result in a more readable code.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
Armando Visconti 2021-05-11 13:02:50 +02:00 committed by Anas Nashif
commit 1f851bc268

View file

@ -206,8 +206,8 @@ static void lsm6dso_handle_interrupt(const struct device *dev)
#endif #endif
} }
gpio_pin_interrupt_configure(cfg->gpio_drdy.port, cfg->gpio_drdy.pin, gpio_pin_interrupt_configure_dt(&cfg->gpio_drdy,
GPIO_INT_EDGE_TO_ACTIVE); GPIO_INT_EDGE_TO_ACTIVE);
} }
static void lsm6dso_gpio_callback(const struct device *dev, static void lsm6dso_gpio_callback(const struct device *dev,
@ -219,8 +219,7 @@ static void lsm6dso_gpio_callback(const struct device *dev,
ARG_UNUSED(pins); ARG_UNUSED(pins);
gpio_pin_interrupt_configure(cfg->gpio_drdy.port, cfg->gpio_drdy.pin, gpio_pin_interrupt_configure_dt(&cfg->gpio_drdy, GPIO_INT_DISABLE);
GPIO_INT_DISABLE);
#if defined(CONFIG_LSM6DSO_TRIGGER_OWN_THREAD) #if defined(CONFIG_LSM6DSO_TRIGGER_OWN_THREAD)
k_sem_give(&lsm6dso->gpio_sem); k_sem_give(&lsm6dso->gpio_sem);
@ -274,8 +273,7 @@ int lsm6dso_init_interrupt(const struct device *dev)
lsm6dso->work.handler = lsm6dso_work_cb; lsm6dso->work.handler = lsm6dso_work_cb;
#endif /* CONFIG_LSM6DSO_TRIGGER_OWN_THREAD */ #endif /* CONFIG_LSM6DSO_TRIGGER_OWN_THREAD */
ret = gpio_pin_configure(cfg->gpio_drdy.port, cfg->gpio_drdy.pin, ret = gpio_pin_configure_dt(&cfg->gpio_drdy, GPIO_INPUT);
GPIO_INPUT | cfg->gpio_drdy.dt_flags);
if (ret < 0) { if (ret < 0) {
LOG_DBG("Could not configure gpio"); LOG_DBG("Could not configure gpio");
return ret; return ret;
@ -296,7 +294,6 @@ int lsm6dso_init_interrupt(const struct device *dev)
return -EIO; return -EIO;
} }
return gpio_pin_interrupt_configure(cfg->gpio_drdy.port, return gpio_pin_interrupt_configure_dt(&cfg->gpio_drdy,
cfg->gpio_drdy.pin, GPIO_INT_EDGE_TO_ACTIVE);
GPIO_INT_EDGE_TO_ACTIVE);
} }