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
4 changes: 2 additions & 2 deletions boards/arm/hexiwear_k64/hexiwear_k64.dts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@
compatible = "nxp,fxas21002";
reg = <0x20>;
label = "FXAS21002";
int1-gpios = <&gpiod 1 0>;
int2-gpios = <&gpioc 18 0>;
int1-gpios = <&gpiod 1 GPIO_ACTIVE_LOW>;
int2-gpios = <&gpioc 18 GPIO_ACTIVE_LOW>;
};
};

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/warp7_m4/warp7_m4.dts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
compatible = "nxp,fxas21002";
reg = <0x20>;
label = "FXAS21002";
int1-gpios = <&gpio7 0 0>;
int1-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
};

};
Expand Down
2 changes: 2 additions & 0 deletions drivers/sensor/fxas21002/fxas21002.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,11 @@ static const struct fxas21002_config fxas21002_config = {
#ifdef CONFIG_FXAS21002_DRDY_INT1
.gpio_name = DT_INST_0_NXP_FXAS21002_INT1_GPIOS_CONTROLLER,
.gpio_pin = DT_INST_0_NXP_FXAS21002_INT1_GPIOS_PIN,
.gpio_flags = DT_INST_0_NXP_FXAS21002_INT1_GPIOS_FLAGS,
#else
.gpio_name = DT_INST_0_NXP_FXAS21002_INT2_GPIOS_CONTROLLER,
.gpio_pin = DT_INST_0_NXP_FXAS21002_INT2_GPIOS_PIN,
.gpio_flags = DT_INST_0_NXP_FXAS21002_INT2_GPIOS_FLAGS,
#endif
#endif
};
Expand Down
1 change: 1 addition & 0 deletions drivers/sensor/fxas21002/fxas21002.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ struct fxas21002_config {
#ifdef CONFIG_FXAS21002_TRIGGER
char *gpio_name;
u8_t gpio_pin;
gpio_devicetree_flags_t gpio_flags;
#endif
u8_t i2c_address;
u8_t whoami;
Expand Down
12 changes: 7 additions & 5 deletions drivers/sensor/fxas21002/fxas21002_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ static void fxas21002_gpio_callback(struct device *dev,
return;
}

gpio_pin_disable_callback(dev, data->gpio_pin);
gpio_pin_interrupt_configure(data->gpio, data->gpio_pin,
GPIO_INT_DISABLE);

#if defined(CONFIG_FXAS21002_TRIGGER_OWN_THREAD)
k_sem_give(&data->trig_sem);
Expand Down Expand Up @@ -68,7 +69,8 @@ static void fxas21002_handle_int(void *arg)
fxas21002_handle_drdy_int(dev);
}

gpio_pin_enable_callback(data->gpio, config->gpio_pin);
gpio_pin_interrupt_configure(data->gpio, config->gpio_pin,
GPIO_INT_EDGE_TO_ACTIVE);
}

#ifdef CONFIG_FXAS21002_TRIGGER_OWN_THREAD
Expand Down Expand Up @@ -206,15 +208,15 @@ int fxas21002_trigger_init(struct device *dev)
data->gpio_pin = config->gpio_pin;

gpio_pin_configure(data->gpio, config->gpio_pin,
GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
GPIO_INT_ACTIVE_LOW | GPIO_INT_DEBOUNCE);
GPIO_INPUT | config->gpio_flags);

gpio_init_callback(&data->gpio_cb, fxas21002_gpio_callback,
BIT(config->gpio_pin));

gpio_add_callback(data->gpio, &data->gpio_cb);

gpio_pin_enable_callback(data->gpio, config->gpio_pin);
gpio_pin_interrupt_configure(data->gpio, config->gpio_pin,
GPIO_INT_EDGE_TO_ACTIVE);

return 0;
}
8 changes: 8 additions & 0 deletions dts/bindings/sensor/nxp,fxas21002.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ properties:
int1-gpios:
type: phandle-array
required: false
description: INT1 pin
This pin defaults to active low when produced by the sensor.
The property value should ensure the flags properly describe
the signal that is presented to the driver.

int2-gpios:
type: phandle-array
required: false
description: INT2 pin
This pin defaults to active low when produced by the sensor.
The property value should ensure the flags properly describe
the signal that is presented to the driver.