drivers: sensors: vl53l0x: update to new GPIO API

Update to the new GPIO API.
Tested on disco_l475_iot1.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2019-11-28 16:55:17 +01:00 committed by Carles Cufí
commit b0ced41b69
2 changed files with 3 additions and 3 deletions

View file

@ -101,7 +101,7 @@
compatible = "st,vl53l0x";
reg = <0x29>;
label = "VL53L0X";
xshut-gpios = <&gpioc 6 0>;
xshut-gpios = <&gpioc 6 GPIO_ACTIVE_HIGH>;
};
};

View file

@ -215,14 +215,14 @@ static int vl53l0x_init(struct device *dev)
if (gpio_pin_configure(gpio,
DT_INST_0_ST_VL53L0X_XSHUT_GPIOS_PIN,
GPIO_DIR_OUT | GPIO_PUD_PULL_UP) < 0) {
GPIO_OUTPUT | GPIO_PULL_UP) < 0) {
LOG_ERR("Could not configure GPIO %s %d).",
DT_INST_0_ST_VL53L0X_XSHUT_GPIOS_CONTROLLER,
DT_INST_0_ST_VL53L0X_XSHUT_GPIOS_PIN);
return -EINVAL;
}
gpio_pin_write(gpio, DT_INST_0_ST_VL53L0X_XSHUT_GPIOS_PIN, 1);
gpio_pin_set(gpio, DT_INST_0_ST_VL53L0X_XSHUT_GPIOS_PIN, 1);
k_sleep(K_MSEC(100));
#endif