Skip to content

Commit 7779a63

Browse files
committed
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 <[email protected]>
1 parent 9870b9e commit 7779a63

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

boards/arm/sensortile_box/sensortile_box.dts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
compatible = "st,lps22hh";
6363
reg = <0x5d>;
6464
label = "LPS22HH";
65-
drdy-gpios = <&gpiod 15 GPIO_ACTIVE_LOW>;
65+
drdy-gpios = <&gpiod 15 GPIO_ACTIVE_HIGH>;
6666
};
6767
};
6868

@@ -87,23 +87,23 @@
8787
compatible = "st,lis2dw12";
8888
spi-max-frequency = <1000000>;
8989
reg = <0>;
90-
irq-gpios = <&gpioc 5 0>;
90+
irq-gpios = <&gpioc 5 GPIO_ACTIVE_HIGH>;
9191
label = "LIS2DW12";
9292
};
9393

9494
lsm6dso@1 {
9595
compatible = "st,lsm6dso";
9696
spi-max-frequency = <1000000>;
9797
reg = <1>;
98-
irq-gpios = <&gpioa 2 0>;
98+
irq-gpios = <&gpioa 2 GPIO_ACTIVE_HIGH>;
9999
label = "LSM6DSO";
100100
};
101101

102102
iis3dhhc@2 {
103103
compatible = "st,iis3dhhc";
104104
spi-max-frequency = <1000000>;
105105
reg = <2>;
106-
irq-gpios = <&gpioc 13 0>, <&gpioe 6 0>;
106+
irq-gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>, <&gpioe 6 GPIO_ACTIVE_HIGH>;
107107
label = "IIS3DHHC";
108108
};
109109
};

samples/boards/sensortile_box/src/main.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,20 +252,22 @@ void main(void)
252252
int cnt = 1;
253253

254254
led0 = device_get_binding(DT_ALIAS_LED0_GPIOS_CONTROLLER);
255-
gpio_pin_configure(led0, DT_ALIAS_LED0_GPIOS_PIN, GPIO_DIR_OUT);
255+
gpio_pin_configure(led0, DT_ALIAS_LED0_GPIOS_PIN,
256+
GPIO_OUTPUT_ACTIVE | DT_ALIAS_LED0_GPIOS_FLAGS);
256257

257258
led1 = device_get_binding(DT_ALIAS_LED1_GPIOS_CONTROLLER);
258-
gpio_pin_configure(led1, DT_ALIAS_LED1_GPIOS_PIN, GPIO_DIR_OUT);
259+
gpio_pin_configure(led1, DT_ALIAS_LED1_GPIOS_PIN,
260+
GPIO_OUTPUT_INACTIVE | DT_ALIAS_LED1_GPIOS_FLAGS);
259261

260262
for (i = 0; i < 6; i++) {
261-
gpio_pin_write(led0, DT_ALIAS_LED0_GPIOS_PIN, on);
262-
gpio_pin_write(led1, DT_ALIAS_LED1_GPIOS_PIN, !on);
263+
gpio_pin_set(led0, DT_ALIAS_LED0_GPIOS_PIN, on);
264+
gpio_pin_set(led1, DT_ALIAS_LED1_GPIOS_PIN, !on);
263265
k_sleep(K_MSEC(100));
264266
on = (on == 1) ? 0 : 1;
265267
}
266268

267-
gpio_pin_write(led0, DT_ALIAS_LED0_GPIOS_PIN, 0);
268-
gpio_pin_write(led1, DT_ALIAS_LED1_GPIOS_PIN, 1);
269+
gpio_pin_set(led0, DT_ALIAS_LED0_GPIOS_PIN, 0);
270+
gpio_pin_set(led1, DT_ALIAS_LED1_GPIOS_PIN, 1);
269271

270272
printk("SensorTile.box test!!\n");
271273

0 commit comments

Comments
 (0)