Skip to content

Commit b6b6c86

Browse files
ananglgalak
authored andcommitted
boards: degu_evk: Update to use the new GPIO API
In initialization code, pairs of gpio_pin_configure/gpio_pin_write are replaced with calls to gpio_pin_configure that configure a given pin as output with the proper initial state. dts file for the board is also updated with the new GPIO flags. Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 7271666 commit b6b6c86

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

boards/arm/degu_evk/board.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,17 @@ static int board_degu_evk_init(struct device *dev)
1818
* Degu Evaluation Kit has a TPS22916C power switch.
1919
* It is connected to GPIO0_26 so we must enable it.
2020
*/
21-
gpio_pin_configure(gpio0, 26, GPIO_DIR_OUT);
22-
gpio_pin_write(gpio0, 26, 1);
21+
gpio_pin_configure(gpio0, 26, GPIO_OUTPUT_HIGH);
2322

2423
/*
2524
* We must enable GPIO1_2 to use Secure Element.
2625
*/
27-
gpio_pin_configure(gpio1, 2, GPIO_DIR_OUT);
28-
gpio_pin_write(gpio1, 2, 1);
26+
gpio_pin_configure(gpio1, 2, GPIO_OUTPUT_HIGH);
2927

3028
/*
3129
* We must enable GPIO1_6 to read Vin voltage.
3230
*/
33-
gpio_pin_configure(gpio1, 6, GPIO_DIR_OUT);
34-
gpio_pin_write(gpio1, 6, 1);
31+
gpio_pin_configure(gpio1, 6, GPIO_OUTPUT_HIGH);
3532

3633
return 0;
3734
}

boards/arm/degu_evk/degu_evk.dts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,35 @@
2121
leds {
2222
compatible = "gpio-leds";
2323
led0: led_0 {
24-
gpios = <&gpio1 7 GPIO_INT_ACTIVE_LOW>;
24+
gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
2525
label = "LED1";
2626
};
2727
led1: led_1 {
28-
gpios = <&gpio1 5 GPIO_INT_ACTIVE_LOW>;
28+
gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
2929
label = "LED2";
3030
};
3131
led2: led_2 {
32-
gpios = <&gpio1 3 GPIO_INT_ACTIVE_LOW>;
32+
gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
3333
label = "LED3";
3434
};
3535
led3: led_3 {
36-
gpios = <&gpio1 4 GPIO_INT_ACTIVE_LOW>;
36+
gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
3737
label = "LED4";
3838
};
3939
};
4040

4141
buttons {
4242
compatible = "gpio-keys";
4343
button0: button_0 {
44-
gpios = <&gpio1 0 GPIO_PUD_PULL_UP>;
44+
gpios = <&gpio1 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
4545
label = "SW2";
4646
};
4747
button1: button_1 {
48-
gpios = <&gpio1 1 GPIO_PUD_PULL_UP>;
48+
gpios = <&gpio1 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
4949
label = "SW3";
5050
};
5151
button2: button_2 {
52-
gpios = <&gpio1 14 GPIO_PUD_PULL_UP>;
52+
gpios = <&gpio1 14 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
5353
label = "SW4";
5454
};
5555
};

0 commit comments

Comments
 (0)