Skip to content

Commit 5e256b4

Browse files
pabigotcarlescufi
authored andcommitted
drivers: sensor: sx9500: convert to new GPIO API
Use the new pin and interrupt configuration API. Signed-off-by: Peter Bigot <[email protected]>
1 parent 5b3c8ac commit 5e256b4

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

drivers/sensor/sx9500/sx9500_trigger.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ int sx9500_setup_interrupt(struct device *dev)
165165
}
166166

167167
gpio_pin_configure(gpio, DT_INST_0_SEMTECH_SX9500_INT_GPIOS_PIN,
168-
GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
169-
GPIO_INT_ACTIVE_LOW | GPIO_INT_DEBOUNCE);
168+
GPIO_INPUT | DT_INST_0_SEMTECH_SX9500_INT_GPIOS_FLAGS);
170169

171170
gpio_init_callback(&data->gpio_cb,
172171
sx9500_gpio_cb,
173172
BIT(DT_INST_0_SEMTECH_SX9500_INT_GPIOS_PIN));
174173

175174
gpio_add_callback(gpio, &data->gpio_cb);
176-
gpio_pin_enable_callback(gpio, DT_INST_0_SEMTECH_SX9500_INT_GPIOS_PIN);
175+
gpio_pin_interrupt_configure(gpio, DT_INST_0_SEMTECH_SX9500_INT_GPIOS_PIN,
176+
GPIO_INT_EDGE_TO_ACTIVE);
177177

178178
#ifdef CONFIG_SX9500_TRIGGER_OWN_THREAD
179179
k_thread_create(&sx9500_thread, sx9500_thread_stack,

dts/bindings/sensor/semtech,sx9500.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ properties:
1313
int-gpios:
1414
type: phandle-array
1515
required: false
16+
description: |
17+
Connection for the NIRQ signal. This signal is active-low when
18+
produced by the sensor.

samples/sensor/sx9500/boards/frdm_k64f.overlay

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
sx9500@28 {
99
compatible = "semtech,sx9500";
1010
reg = <0x28>;
11-
int-gpios = <&gpioc 6 0>;
11+
int-gpios = <&gpioc 6 GPIO_ACTIVE_LOW>;
1212
label = "SX9500";
1313
};
1414
};

0 commit comments

Comments
 (0)