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 <armando.visconti@st.com>
This commit is contained in:
Armando Visconti 2019-11-22 16:59:57 +01:00 committed by Carles Cufí
parent 0ae55c7ce9
commit 3bb513bf2a
2 changed files with 12 additions and 10 deletions

View file

@ -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";
};
};

View file

@ -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");