driver/sensor: iis3dhhc: 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:
Armando Visconti 2019-12-06 14:34:48 +01:00 committed by Carles Cufí
commit 0ae55c7ce9
5 changed files with 16 additions and 5 deletions

View file

@ -73,7 +73,8 @@ static void iis3dhhc_handle_interrupt(void *arg)
iis3dhhc->handler_drdy(dev, &drdy_trigger);
}
gpio_pin_enable_callback(iis3dhhc->gpio, cfg->int_pin);
gpio_pin_interrupt_configure(iis3dhhc->gpio, cfg->int_pin,
GPIO_INT_EDGE_TO_ACTIVE);
}
static void iis3dhhc_gpio_callback(struct device *dev,
@ -85,7 +86,8 @@ static void iis3dhhc_gpio_callback(struct device *dev,
ARG_UNUSED(pins);
gpio_pin_disable_callback(dev, cfg->int_pin);
gpio_pin_interrupt_configure(iis3dhhc->gpio, cfg->int_pin,
GPIO_INT_DISABLE);
#if defined(CONFIG_IIS3DHHC_TRIGGER_OWN_THREAD)
k_sem_give(&iis3dhhc->gpio_sem);
@ -146,8 +148,7 @@ int iis3dhhc_init_interrupt(struct device *dev)
#endif /* CONFIG_IIS3DHHC_TRIGGER_OWN_THREAD */
ret = gpio_pin_configure(iis3dhhc->gpio, cfg->int_pin,
GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
GPIO_INT_ACTIVE_HIGH | GPIO_INT_DEBOUNCE);
GPIO_INPUT | cfg->int_flags);
if (ret < 0) {
LOG_DBG("Could not configure gpio");
return ret;
@ -167,5 +168,6 @@ int iis3dhhc_init_interrupt(struct device *dev)
return -EIO;
}
return gpio_pin_enable_callback(iis3dhhc->gpio, cfg->int_pin);
return gpio_pin_interrupt_configure(iis3dhhc->gpio, cfg->int_pin,
GPIO_INT_EDGE_TO_ACTIVE);
}