driver/sensor: stts751: 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
a80ab6c4ea
commit
a08aec9999
|
@ -22,7 +22,7 @@
|
|||
stts751@4a {
|
||||
compatible = "st,stts751";
|
||||
reg = <0x4a>;
|
||||
drdy-gpios = <&arduino_header 4 0>; /* A4 */
|
||||
drdy-gpios = <&arduino_header 4 GPIO_ACTIVE_LOW>; /* A4 */
|
||||
label = "STTS751";
|
||||
};
|
||||
|
||||
|
|
|
@ -200,6 +200,7 @@ static const struct stts751_config stts751_config = {
|
|||
#ifdef CONFIG_STTS751_TRIGGER
|
||||
.event_port = DT_INST_0_ST_STTS751_DRDY_GPIOS_CONTROLLER,
|
||||
.event_pin = DT_INST_0_ST_STTS751_DRDY_GPIOS_PIN,
|
||||
.int_flags = DT_INST_0_ST_STTS751_DRDY_GPIOS_FLAGS,
|
||||
#endif
|
||||
#if defined(DT_ST_STTS751_BUS_I2C)
|
||||
.bus_init = stts751_i2c_init,
|
||||
|
|
|
@ -30,6 +30,7 @@ struct stts751_config {
|
|||
#ifdef CONFIG_STTS751_TRIGGER
|
||||
const char *event_port;
|
||||
u8_t event_pin;
|
||||
u8_t int_flags;
|
||||
#endif
|
||||
#ifdef DT_ST_STTS751_BUS_I2C
|
||||
u16_t i2c_slv_addr;
|
||||
|
|
|
@ -70,7 +70,8 @@ static void stts751_handle_interrupt(void *arg)
|
|||
stts751->thsld_handler(dev, &thsld_trigger);
|
||||
}
|
||||
|
||||
gpio_pin_enable_callback(stts751->gpio, cfg->event_pin);
|
||||
gpio_pin_interrupt_configure(stts751->gpio, cfg->event_pin,
|
||||
GPIO_INT_EDGE_TO_ACTIVE);
|
||||
}
|
||||
|
||||
static void stts751_gpio_callback(struct device *dev,
|
||||
|
@ -82,7 +83,7 @@ static void stts751_gpio_callback(struct device *dev,
|
|||
|
||||
ARG_UNUSED(pins);
|
||||
|
||||
gpio_pin_disable_callback(dev, cfg->event_pin);
|
||||
gpio_pin_interrupt_configure(dev, cfg->event_pin, GPIO_INT_DISABLE);
|
||||
|
||||
#if defined(CONFIG_STTS751_TRIGGER_OWN_THREAD)
|
||||
k_sem_give(&stts751->gpio_sem);
|
||||
|
@ -143,8 +144,7 @@ int stts751_init_interrupt(struct device *dev)
|
|||
#endif /* CONFIG_STTS751_TRIGGER_OWN_THREAD */
|
||||
|
||||
ret = gpio_pin_configure(stts751->gpio, cfg->event_pin,
|
||||
GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
|
||||
GPIO_INT_ACTIVE_LOW | GPIO_INT_DEBOUNCE);
|
||||
GPIO_INPUT | cfg->int_flags);
|
||||
if (ret < 0) {
|
||||
LOG_DBG("Could not configure gpio");
|
||||
return ret;
|
||||
|
@ -168,5 +168,6 @@ int stts751_init_interrupt(struct device *dev)
|
|||
stts751_low_temperature_threshold_set(stts751->ctx,
|
||||
stts751_from_celsius_to_lsb(temp_lo));
|
||||
|
||||
return gpio_pin_enable_callback(stts751->gpio, cfg->event_pin);
|
||||
return gpio_pin_interrupt_configure(stts751->gpio, cfg->event_pin,
|
||||
GPIO_INT_EDGE_TO_ACTIVE);
|
||||
}
|
||||
|
|
|
@ -13,3 +13,7 @@ properties:
|
|||
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.
|
||||
|
|
|
@ -6,3 +6,4 @@ CONFIG_GPIO=y
|
|||
CONFIG_SPI=y
|
||||
CONFIG_SENSOR=y
|
||||
CONFIG_LIS2DW12=y
|
||||
CONFIG_STTS751=y
|
||||
|
|
|
@ -7,3 +7,5 @@ CONFIG_SPI=y
|
|||
CONFIG_SENSOR=y
|
||||
CONFIG_LIS2DW12=y
|
||||
CONFIG_LIS2DW12_TRIGGER_OWN_THREAD=y
|
||||
CONFIG_STTS751=y
|
||||
CONFIG_STTS751_TRIGGER_OWN_THREAD=y
|
||||
|
|
Loading…
Reference in New Issue