From b0ced41b690b98213970e23ef0d0c3cfe33d33b9 Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Thu, 28 Nov 2019 16:55:17 +0100 Subject: [PATCH] drivers: sensors: vl53l0x: update to new GPIO API Update to the new GPIO API. Tested on disco_l475_iot1. Signed-off-by: Erwan Gouriou --- boards/arm/disco_l475_iot1/disco_l475_iot1.dts | 2 +- drivers/sensor/vl53l0x/vl53l0x.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/boards/arm/disco_l475_iot1/disco_l475_iot1.dts b/boards/arm/disco_l475_iot1/disco_l475_iot1.dts index 424f1dac6b3..52a3eed3269 100644 --- a/boards/arm/disco_l475_iot1/disco_l475_iot1.dts +++ b/boards/arm/disco_l475_iot1/disco_l475_iot1.dts @@ -101,7 +101,7 @@ compatible = "st,vl53l0x"; reg = <0x29>; label = "VL53L0X"; - xshut-gpios = <&gpioc 6 0>; + xshut-gpios = <&gpioc 6 GPIO_ACTIVE_HIGH>; }; }; diff --git a/drivers/sensor/vl53l0x/vl53l0x.c b/drivers/sensor/vl53l0x/vl53l0x.c index 5cf12304631..80d99f1ea36 100644 --- a/drivers/sensor/vl53l0x/vl53l0x.c +++ b/drivers/sensor/vl53l0x/vl53l0x.c @@ -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