driver/sensor: lsm6dso: update to use new GPIO API
Get rid of all the deprecated functions and definitions replacing them with the new ones. Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
parent
cde71b4f75
commit
f5dc6580a0
5 changed files with 19 additions and 5 deletions
|
@ -774,6 +774,7 @@ static const struct lsm6dso_config lsm6dso_config = {
|
|||
#ifdef CONFIG_LSM6DSO_TRIGGER
|
||||
.int_gpio_port = DT_INST_0_ST_LSM6DSO_IRQ_GPIOS_CONTROLLER,
|
||||
.int_gpio_pin = DT_INST_0_ST_LSM6DSO_IRQ_GPIOS_PIN,
|
||||
.int_gpio_flags = DT_INST_0_ST_LSM6DSO_IRQ_GPIOS_FLAGS,
|
||||
#if defined(CONFIG_LSM6DSO_INT_PIN_1)
|
||||
.int_pin = 1,
|
||||
#elif defined(CONFIG_LSM6DSO_INT_PIN_2)
|
||||
|
|
|
@ -97,6 +97,7 @@ struct lsm6dso_config {
|
|||
#ifdef CONFIG_LSM6DSO_TRIGGER
|
||||
const char *int_gpio_port;
|
||||
u8_t int_gpio_pin;
|
||||
u8_t int_gpio_flags;
|
||||
u8_t int_pin;
|
||||
#endif /* CONFIG_LSM6DSO_TRIGGER */
|
||||
#ifdef DT_ST_LSM6DSO_BUS_I2C
|
||||
|
|
|
@ -198,7 +198,8 @@ static void lsm6dso_handle_interrupt(void *arg)
|
|||
#endif
|
||||
}
|
||||
|
||||
gpio_pin_enable_callback(lsm6dso->gpio, cfg->int_gpio_pin);
|
||||
gpio_pin_interrupt_configure(lsm6dso->gpio, cfg->int_gpio_pin,
|
||||
GPIO_INT_EDGE_TO_ACTIVE);
|
||||
}
|
||||
|
||||
static void lsm6dso_gpio_callback(struct device *dev,
|
||||
|
@ -210,7 +211,8 @@ static void lsm6dso_gpio_callback(struct device *dev,
|
|||
|
||||
ARG_UNUSED(pins);
|
||||
|
||||
gpio_pin_disable_callback(dev, cfg->int_gpio_pin);
|
||||
gpio_pin_interrupt_configure(lsm6dso->gpio, cfg->int_gpio_pin,
|
||||
GPIO_INT_DISABLE);
|
||||
|
||||
#if defined(CONFIG_LSM6DSO_TRIGGER_OWN_THREAD)
|
||||
k_sem_give(&lsm6dso->gpio_sem);
|
||||
|
@ -272,8 +274,7 @@ int lsm6dso_init_interrupt(struct device *dev)
|
|||
#endif /* CONFIG_LSM6DSO_TRIGGER_OWN_THREAD */
|
||||
|
||||
ret = gpio_pin_configure(lsm6dso->gpio, cfg->int_gpio_pin,
|
||||
GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
|
||||
GPIO_INT_ACTIVE_HIGH | GPIO_INT_DEBOUNCE);
|
||||
GPIO_INPUT | cfg->int_gpio_flags);
|
||||
if (ret < 0) {
|
||||
LOG_DBG("Could not configure gpio");
|
||||
return ret;
|
||||
|
@ -295,5 +296,6 @@ int lsm6dso_init_interrupt(struct device *dev)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
return gpio_pin_enable_callback(lsm6dso->gpio, cfg->int_gpio_pin);
|
||||
return gpio_pin_interrupt_configure(lsm6dso->gpio, cfg->int_gpio_pin,
|
||||
GPIO_INT_EDGE_TO_ACTIVE);
|
||||
}
|
||||
|
|
|
@ -13,3 +13,8 @@ properties:
|
|||
irq-gpios:
|
||||
type: phandle-array
|
||||
required: false
|
||||
description: DRDY pin
|
||||
|
||||
This pin defaults to active high when produced by the sensor.
|
||||
The property value should ensure the flags properly describe
|
||||
the signal that is presented to the driver.
|
||||
|
|
|
@ -13,3 +13,8 @@ properties:
|
|||
irq-gpios:
|
||||
type: phandle-array
|
||||
required: false
|
||||
description: DRDY pin
|
||||
|
||||
This pin defaults to active high when produced by the sensor.
|
||||
The property value should ensure the flags properly describe
|
||||
the signal that is presented to the driver.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue