From 3bb513bf2abc436e33a05e8b343cfafd2e5ec34e Mon Sep 17 00:00:00 2001 From: Armando Visconti Date: Fri, 22 Nov 2019 16:59:57 +0100 Subject: [PATCH] sample/board: sensortile_box: update to use new GPIO API Get rid of all the deprecated functions and definitions replacing them with the new ones. Signed-off-by: Armando Visconti --- boards/arm/sensortile_box/sensortile_box.dts | 8 ++++---- samples/boards/sensortile_box/src/main.c | 14 ++++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/boards/arm/sensortile_box/sensortile_box.dts b/boards/arm/sensortile_box/sensortile_box.dts index c6ebf7c2434..e1214bb6bf8 100644 --- a/boards/arm/sensortile_box/sensortile_box.dts +++ b/boards/arm/sensortile_box/sensortile_box.dts @@ -62,7 +62,7 @@ compatible = "st,lps22hh"; reg = <0x5d>; label = "LPS22HH"; - drdy-gpios = <&gpiod 15 GPIO_ACTIVE_LOW>; + drdy-gpios = <&gpiod 15 GPIO_ACTIVE_HIGH>; }; }; @@ -87,7 +87,7 @@ compatible = "st,lis2dw12"; spi-max-frequency = <1000000>; reg = <0>; - irq-gpios = <&gpioc 5 0>; + irq-gpios = <&gpioc 5 GPIO_ACTIVE_HIGH>; label = "LIS2DW12"; }; @@ -95,7 +95,7 @@ compatible = "st,lsm6dso"; spi-max-frequency = <1000000>; reg = <1>; - irq-gpios = <&gpioa 2 0>; + irq-gpios = <&gpioa 2 GPIO_ACTIVE_HIGH>; label = "LSM6DSO"; }; @@ -103,7 +103,7 @@ compatible = "st,iis3dhhc"; spi-max-frequency = <1000000>; reg = <2>; - irq-gpios = <&gpioc 13 0>, <&gpioe 6 0>; + irq-gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>, <&gpioe 6 GPIO_ACTIVE_HIGH>; label = "IIS3DHHC"; }; }; diff --git a/samples/boards/sensortile_box/src/main.c b/samples/boards/sensortile_box/src/main.c index ba0cceeb0fc..3ae30203287 100644 --- a/samples/boards/sensortile_box/src/main.c +++ b/samples/boards/sensortile_box/src/main.c @@ -252,20 +252,22 @@ void main(void) int cnt = 1; led0 = device_get_binding(DT_ALIAS_LED0_GPIOS_CONTROLLER); - gpio_pin_configure(led0, DT_ALIAS_LED0_GPIOS_PIN, GPIO_DIR_OUT); + gpio_pin_configure(led0, DT_ALIAS_LED0_GPIOS_PIN, + GPIO_OUTPUT_ACTIVE | DT_ALIAS_LED0_GPIOS_FLAGS); led1 = device_get_binding(DT_ALIAS_LED1_GPIOS_CONTROLLER); - gpio_pin_configure(led1, DT_ALIAS_LED1_GPIOS_PIN, GPIO_DIR_OUT); + gpio_pin_configure(led1, DT_ALIAS_LED1_GPIOS_PIN, + GPIO_OUTPUT_INACTIVE | DT_ALIAS_LED1_GPIOS_FLAGS); for (i = 0; i < 6; i++) { - gpio_pin_write(led0, DT_ALIAS_LED0_GPIOS_PIN, on); - gpio_pin_write(led1, DT_ALIAS_LED1_GPIOS_PIN, !on); + gpio_pin_set(led0, DT_ALIAS_LED0_GPIOS_PIN, on); + gpio_pin_set(led1, DT_ALIAS_LED1_GPIOS_PIN, !on); k_sleep(K_MSEC(100)); on = (on == 1) ? 0 : 1; } - gpio_pin_write(led0, DT_ALIAS_LED0_GPIOS_PIN, 0); - gpio_pin_write(led1, DT_ALIAS_LED1_GPIOS_PIN, 1); + gpio_pin_set(led0, DT_ALIAS_LED0_GPIOS_PIN, 0); + gpio_pin_set(led1, DT_ALIAS_LED1_GPIOS_PIN, 1); printk("SensorTile.box test!!\n");