driver/sensor: lis2dw12: 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
692996dd00
commit
e690fab6b1
5 changed files with 19 additions and 5 deletions
|
@ -376,6 +376,7 @@ const struct lis2dw12_device_config lis2dw12_cfg = {
|
|||
#ifdef CONFIG_LIS2DW12_TRIGGER
|
||||
.int_gpio_port = DT_INST_0_ST_LIS2DW12_IRQ_GPIOS_CONTROLLER,
|
||||
.int_gpio_pin = DT_INST_0_ST_LIS2DW12_IRQ_GPIOS_PIN,
|
||||
.int_gpio_flags = DT_INST_0_ST_LIS2DW12_IRQ_GPIOS_FLAGS,
|
||||
#if defined(CONFIG_LIS2DW12_INT_PIN_1)
|
||||
.int_pin = 1,
|
||||
#elif defined(CONFIG_LIS2DW12_INT_PIN_2)
|
||||
|
|
|
@ -92,6 +92,7 @@ struct lis2dw12_device_config {
|
|||
#ifdef CONFIG_LIS2DW12_TRIGGER
|
||||
const char *int_gpio_port;
|
||||
u8_t int_gpio_pin;
|
||||
u8_t int_gpio_flags;
|
||||
u8_t int_pin;
|
||||
#ifdef CONFIG_LIS2DW12_PULSE
|
||||
u8_t pulse_trigger;
|
||||
|
|
|
@ -183,7 +183,8 @@ static void lis2dw12_handle_interrupt(void *arg)
|
|||
}
|
||||
#endif /* CONFIG_LIS2DW12_PULSE */
|
||||
|
||||
gpio_pin_enable_callback(lis2dw12->gpio, cfg->int_gpio_pin);
|
||||
gpio_pin_interrupt_configure(lis2dw12->gpio, cfg->int_gpio_pin,
|
||||
GPIO_INT_EDGE_TO_ACTIVE);
|
||||
}
|
||||
|
||||
static void lis2dw12_gpio_callback(struct device *dev,
|
||||
|
@ -196,7 +197,8 @@ static void lis2dw12_gpio_callback(struct device *dev,
|
|||
return;
|
||||
}
|
||||
|
||||
gpio_pin_disable_callback(dev, lis2dw12->gpio_pin);
|
||||
gpio_pin_interrupt_configure(dev, lis2dw12->gpio_pin,
|
||||
GPIO_INT_DISABLE);
|
||||
|
||||
#if defined(CONFIG_LIS2DW12_TRIGGER_OWN_THREAD)
|
||||
k_sem_give(&lis2dw12->gpio_sem);
|
||||
|
@ -260,8 +262,7 @@ int lis2dw12_init_interrupt(struct device *dev)
|
|||
lis2dw12->gpio_pin = cfg->int_gpio_pin;
|
||||
|
||||
ret = gpio_pin_configure(lis2dw12->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;
|
||||
|
@ -281,5 +282,6 @@ int lis2dw12_init_interrupt(struct device *dev)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
return gpio_pin_enable_callback(lis2dw12->gpio, cfg->int_gpio_pin);
|
||||
return gpio_pin_interrupt_configure(lis2dw12->gpio, cfg->int_gpio_pin,
|
||||
GPIO_INT_EDGE_TO_ACTIVE);
|
||||
}
|
||||
|
|
|
@ -11,3 +11,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.
|
||||
|
|
|
@ -12,3 +12,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