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_iks01a1/x_nucleo_iks01a1.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
lis3mdl-magn@1e {
compatible = "st,lis3mdl-magn";
reg = <0x1e>;
irq-gpios = <&arduino_header 4 0>; /* A4 */
irq-gpios = <&arduino_header 4 GPIO_ACTIVE_HIGH>; /* A4 */
label = "LIS3MDL";
};

Expand Down
23 changes: 14 additions & 9 deletions drivers/sensor/lis3mdl/lis3mdl_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ int lis3mdl_trigger_set(struct device *dev,

drv_data->data_ready_trigger = *trig;

gpio_pin_enable_callback(drv_data->gpio,
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN);
gpio_pin_interrupt_configure(drv_data->gpio,
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN,
GPIO_INT_EDGE_TO_ACTIVE);

return 0;
}
Expand All @@ -47,7 +48,9 @@ static void lis3mdl_gpio_callback(struct device *dev,

ARG_UNUSED(pins);

gpio_pin_disable_callback(dev, DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN);
gpio_pin_interrupt_configure(dev,
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN,
GPIO_INT_DISABLE);

#if defined(CONFIG_LIS3MDL_TRIGGER_OWN_THREAD)
k_sem_give(&drv_data->gpio_sem);
Expand All @@ -66,8 +69,9 @@ static void lis3mdl_thread_cb(void *arg)
&drv_data->data_ready_trigger);
}

gpio_pin_enable_callback(drv_data->gpio,
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN);
gpio_pin_interrupt_configure(drv_data->gpio,
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN,
GPIO_INT_EDGE_TO_ACTIVE);
}

#ifdef CONFIG_LIS3MDL_TRIGGER_OWN_THREAD
Expand Down Expand Up @@ -110,8 +114,8 @@ int lis3mdl_init_interrupt(struct device *dev)

gpio_pin_configure(drv_data->gpio,
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN,
GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
GPIO_INT_ACTIVE_HIGH | GPIO_INT_DEBOUNCE);
GPIO_INPUT |
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_FLAGS);

gpio_init_callback(&drv_data->gpio_cb,
lis3mdl_gpio_callback,
Expand Down Expand Up @@ -148,8 +152,9 @@ int lis3mdl_init_interrupt(struct device *dev)
drv_data->dev = dev;
#endif

gpio_pin_enable_callback(drv_data->gpio,
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN);
gpio_pin_interrupt_configure(drv_data->gpio,
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN,
GPIO_INT_EDGE_TO_ACTIVE);

return 0;
}
5 changes: 5 additions & 0 deletions dts/bindings/sensor/st,lis3mdl-magn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ properties:
irq-gpios:
required: false
type: phandle-array
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/dts_fixup.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
#define DT_INST_0_ST_LIS3MDL_MAGN_BASE_ADDRESS 0x19
#define DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN 0
#define DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_CONTROLLER ""
#define DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_FLAGS 0
#endif

#ifndef DT_INST_0_ST_LPS25HB_PRESS_LABEL
Expand Down