Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boards/shields/x_nucleo_iks01a3/x_nucleo_iks01a3.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};

Expand Down
1 change: 1 addition & 0 deletions drivers/sensor/stts751/stts751.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions drivers/sensor/stts751/stts751.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 6 additions & 5 deletions drivers/sensor/stts751/stts751_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
4 changes: 4 additions & 0 deletions dts/bindings/sensor/st,stts751-i2c.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
1 change: 1 addition & 0 deletions tests/drivers/build_all/sensors_stmemsc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ CONFIG_GPIO=y
CONFIG_SPI=y
CONFIG_SENSOR=y
CONFIG_LIS2DW12=y
CONFIG_STTS751=y
2 changes: 2 additions & 0 deletions tests/drivers/build_all/sensors_stmemsc_trigger.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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