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
8 changes: 4 additions & 4 deletions boards/arm/sensortile_box/sensortile_box.dts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
compatible = "st,lps22hh";
reg = <0x5d>;
label = "LPS22HH";
drdy-gpios = <&gpiod 15 GPIO_ACTIVE_LOW>;
drdy-gpios = <&gpiod 15 GPIO_ACTIVE_HIGH>;
};
};

Expand All @@ -87,23 +87,23 @@
compatible = "st,lis2dw12";
spi-max-frequency = <1000000>;
reg = <0>;
irq-gpios = <&gpioc 5 0>;
irq-gpios = <&gpioc 5 GPIO_ACTIVE_HIGH>;
label = "LIS2DW12";
};

lsm6dso@1 {
compatible = "st,lsm6dso";
spi-max-frequency = <1000000>;
reg = <1>;
irq-gpios = <&gpioa 2 0>;
irq-gpios = <&gpioa 2 GPIO_ACTIVE_HIGH>;
label = "LSM6DSO";
};

iis3dhhc@2 {
compatible = "st,iis3dhhc";
spi-max-frequency = <1000000>;
reg = <2>;
irq-gpios = <&gpioc 13 0>, <&gpioe 6 0>;
irq-gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>, <&gpioe 6 GPIO_ACTIVE_HIGH>;
label = "IIS3DHHC";
};
};
Expand Down
6 changes: 3 additions & 3 deletions boards/shields/x_nucleo_iks01a3/x_nucleo_iks01a3.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
lps22hh@5d {
compatible = "st,lps22hh";
reg = <0x5d>;
drdy-gpios = <&arduino_header 12 0>; /* D6 */
drdy-gpios = <&arduino_header 12 GPIO_ACTIVE_HIGH>; /* D6 */
label = "LPS22HH";
};

Expand All @@ -36,14 +36,14 @@
lis2dw12@19 {
compatible = "st,lis2dw12";
reg = <0x19>;
irq-gpios = <&arduino_header 3 0>; /* A3 */
irq-gpios = <&arduino_header 3 GPIO_ACTIVE_HIGH>; /* A3 */
label = "LIS2DW12";
};

lsm6dso@6b {
compatible = "st,lsm6dso";
reg = <0x6b>;
irq-gpios = <&arduino_header 10 0>; /* D4 */
irq-gpios = <&arduino_header 10 GPIO_ACTIVE_HIGH>; /* D4 */
label = "LSM6DSO";
};
};
4 changes: 2 additions & 2 deletions boards/shields/x_nucleo_iks01a3/x_nucleo_iks01a3_shub.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
lis2dw12@19 {
compatible = "st,lis2dw12";
reg = <0x19>;
irq-gpios = <&arduino_header 3 0>; /* A3 */
irq-gpios = <&arduino_header 3 GPIO_ACTIVE_HIGH>; /* A3 */
label = "LIS2DW12";
};

lsm6dso@6b {
compatible = "st,lsm6dso";
reg = <0x6b>;
irq-gpios = <&arduino_header 10 0>; /* D4 */
irq-gpios = <&arduino_header 10 GPIO_ACTIVE_HIGH>; /* D4 */
label = "LSM6DSO";
};
};
2 changes: 2 additions & 0 deletions drivers/sensor/iis3dhhc/iis3dhhc.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,11 @@ static const struct iis3dhhc_config iis3dhhc_config = {
#ifdef CONFIG_IIS3DHHC_DRDY_INT1
.int_port = DT_INST_0_ST_IIS3DHHC_IRQ_GPIOS_CONTROLLER_0,
.int_pin = DT_INST_0_ST_IIS3DHHC_IRQ_GPIOS_PIN_0,
.int_flags = DT_INST_0_ST_IIS3DHHC_IRQ_GPIOS_FLAGS_0,
#else
.int_port = DT_INST_0_ST_IIS3DHHC_IRQ_GPIOS_CONTROLLER_1,
.int_pin = DT_INST_0_ST_IIS3DHHC_IRQ_GPIOS_PIN_1,
.int_flags = DT_INST_0_ST_IIS3DHHC_IRQ_GPIOS_FLAGS_1,
#endif /* CONFIG_IIS3DHHC_DRDY_INT1 */
#endif /* CONFIG_IIS3DHHC_TRIGGER */
#if defined(DT_ST_IIS3DHHC_BUS_SPI)
Expand Down
1 change: 1 addition & 0 deletions drivers/sensor/iis3dhhc/iis3dhhc.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct iis3dhhc_config {
#ifdef CONFIG_IIS3DHHC_TRIGGER
const char *int_port;
u8_t int_pin;
u8_t int_flags;
#endif
#ifdef DT_ST_IIS3DHHC_BUS_SPI
struct spi_config spi_conf;
Expand Down
12 changes: 7 additions & 5 deletions drivers/sensor/iis3dhhc/iis3dhhc_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
1 change: 1 addition & 0 deletions drivers/sensor/lis2dw12/lis2dw12.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions drivers/sensor/lis2dw12/lis2dw12.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 7 additions & 5 deletions drivers/sensor/lis2dw12/lis2dw12_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
1 change: 1 addition & 0 deletions drivers/sensor/lps22hh/lps22hh.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ static const struct lps22hh_config lps22hh_config = {
#ifdef CONFIG_LPS22HH_TRIGGER
.drdy_port = DT_INST_0_ST_LPS22HH_DRDY_GPIOS_CONTROLLER,
.drdy_pin = DT_INST_0_ST_LPS22HH_DRDY_GPIOS_PIN,
.drdy_flags = DT_INST_0_ST_LPS22HH_DRDY_GPIOS_FLAGS,
#endif
#if defined(DT_ST_LPS22HH_BUS_SPI)
.bus_init = lps22hh_spi_init,
Expand Down
1 change: 1 addition & 0 deletions drivers/sensor/lps22hh/lps22hh.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct lps22hh_config {
#ifdef CONFIG_LPS22HH_TRIGGER
const char *drdy_port;
u8_t drdy_pin;
u8_t drdy_flags;
#endif
#ifdef DT_ST_LPS22HH_BUS_I2C
u16_t i2c_slv_addr;
Expand Down
17 changes: 7 additions & 10 deletions drivers/sensor/lps22hh/lps22hh_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ static void lps22hh_handle_interrupt(void *arg)
lps22hh->handler_drdy(dev, &drdy_trigger);
}

gpio_pin_enable_callback(lps22hh->gpio, cfg->drdy_pin);
gpio_pin_interrupt_configure(lps22hh->gpio, cfg->drdy_pin,
GPIO_INT_EDGE_TO_ACTIVE);
}

static void lps22hh_gpio_callback(struct device *dev,
Expand All @@ -90,7 +91,8 @@ static void lps22hh_gpio_callback(struct device *dev,

ARG_UNUSED(pins);

gpio_pin_disable_callback(dev, cfg->drdy_pin);
gpio_pin_interrupt_configure(lps22hh->gpio, cfg->drdy_pin,
GPIO_INT_DISABLE);

#if defined(CONFIG_LPS22HH_TRIGGER_OWN_THREAD)
k_sem_give(&lps22hh->gpio_sem);
Expand Down Expand Up @@ -151,8 +153,7 @@ int lps22hh_init_interrupt(struct device *dev)
#endif /* CONFIG_LPS22HH_TRIGGER_OWN_THREAD */

ret = gpio_pin_configure(lps22hh->gpio, cfg->drdy_pin,
GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
GPIO_INT_ACTIVE_HIGH | GPIO_INT_DEBOUNCE);
GPIO_INPUT | cfg->drdy_flags);
if (ret < 0) {
LOG_DBG("Could not configure gpio");
return ret;
Expand All @@ -166,16 +167,12 @@ int lps22hh_init_interrupt(struct device *dev)
return -EIO;
}

/* configure interrupt active high */
if (lps22hh_pin_polarity_set(lps22hh->ctx, LPS22HH_ACTIVE_HIGH) < 0) {
return -EIO;
}

/* enable interrupt in pulse mode */
if (lps22hh_int_notification_set(lps22hh->ctx,
LPS22HH_INT_PULSED) < 0) {
return -EIO;
}

return gpio_pin_enable_callback(lps22hh->gpio, cfg->drdy_pin);
return gpio_pin_interrupt_configure(lps22hh->gpio, cfg->drdy_pin,
GPIO_INT_EDGE_TO_ACTIVE);
}
1 change: 1 addition & 0 deletions drivers/sensor/lsm6dso/lsm6dso.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions drivers/sensor/lsm6dso/lsm6dso.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions drivers/sensor/lsm6dso/lsm6dso_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
4 changes: 4 additions & 0 deletions dts/bindings/sensor/st,iis3dhhc-spi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,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.
5 changes: 5 additions & 0 deletions dts/bindings/sensor/st,lis2dw12-i2c.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,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.
5 changes: 5 additions & 0 deletions dts/bindings/sensor/st,lis2dw12-spi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ properties:
irq-gpios:
type: phandle-array
required: false
description: DRDY pin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs this inserted:

      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.
4 changes: 4 additions & 0 deletions dts/bindings/sensor/st,lps22hh-i2c.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ properties:
type: phandle-array
required: false
description: DRDY pin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here (insert description keyword)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this should have been on lis2dw12-i2c.yaml.

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.
4 changes: 4 additions & 0 deletions dts/bindings/sensor/st,lps22hh-spi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,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.
5 changes: 5 additions & 0 deletions dts/bindings/sensor/st,lsm6dso-i2c.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,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.
5 changes: 5 additions & 0 deletions dts/bindings/sensor/st,lsm6dso-spi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,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.
14 changes: 8 additions & 6 deletions samples/boards/sensortile_box/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,20 +252,22 @@ void main(void)
int cnt = 1;

led0 = device_get_binding(DT_ALIAS_LED0_GPIOS_CONTROLLER);
gpio_pin_configure(led0, DT_ALIAS_LED0_GPIOS_PIN, GPIO_DIR_OUT);
gpio_pin_configure(led0, DT_ALIAS_LED0_GPIOS_PIN,
GPIO_OUTPUT_ACTIVE | DT_ALIAS_LED0_GPIOS_FLAGS);

led1 = device_get_binding(DT_ALIAS_LED1_GPIOS_CONTROLLER);
gpio_pin_configure(led1, DT_ALIAS_LED1_GPIOS_PIN, GPIO_DIR_OUT);
gpio_pin_configure(led1, DT_ALIAS_LED1_GPIOS_PIN,
GPIO_OUTPUT_INACTIVE | DT_ALIAS_LED1_GPIOS_FLAGS);

for (i = 0; i < 6; i++) {
gpio_pin_write(led0, DT_ALIAS_LED0_GPIOS_PIN, on);
gpio_pin_write(led1, DT_ALIAS_LED1_GPIOS_PIN, !on);
gpio_pin_set(led0, DT_ALIAS_LED0_GPIOS_PIN, on);
gpio_pin_set(led1, DT_ALIAS_LED1_GPIOS_PIN, !on);
k_sleep(K_MSEC(100));
on = (on == 1) ? 0 : 1;
}

gpio_pin_write(led0, DT_ALIAS_LED0_GPIOS_PIN, 0);
gpio_pin_write(led1, DT_ALIAS_LED1_GPIOS_PIN, 1);
gpio_pin_set(led0, DT_ALIAS_LED0_GPIOS_PIN, 0);
gpio_pin_set(led1, DT_ALIAS_LED1_GPIOS_PIN, 1);

printk("SensorTile.box test!!\n");

Expand Down
Loading