Skip to content

Commit b45b5be

Browse files
committed
shields: devicetree: arduino-header-r3.h constants
Make shield overlays less error prone and easier to maintain by switching to GPIO pin constants defined in arduino-header-r3.h. Signed-off-by: Benjamin Cabé <[email protected]>
1 parent aec4616 commit b45b5be

31 files changed

+135
-98
lines changed

boards/shields/adafruit_2_8_tft_touch_v2/dts/adafruit_2_8_tft_touch_v2.dtsi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
#include <zephyr/dt-bindings/display/ili9xxx.h>
8+
#include <zephyr/dt-bindings/gpio/arduino-header-r3.h>
89

910
/ {
1011
chosen {
@@ -23,7 +24,7 @@
2324
adafruit_2_8_tft_touch_v2_mipi_dbi: adafruit_2_8_tft_touch_v2_mipi_dbi {
2425
compatible = "zephyr,mipi-dbi-spi";
2526
spi-dev = <&arduino_spi>;
26-
dc-gpios = <&arduino_header 15 GPIO_ACTIVE_HIGH>; /* D9 */
27+
dc-gpios = <&arduino_header ARDUINO_HEADER_R3_D9 GPIO_ACTIVE_HIGH>;
2728
write-only;
2829
#address-cells = <1>;
2930
#size-cells = <0>;
@@ -48,8 +49,8 @@
4849

4950
&arduino_spi {
5051
status = "okay";
51-
cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>, /* D10 */
52-
<&arduino_header 10 GPIO_ACTIVE_LOW>; /* D04 */
52+
cs-gpios = <&arduino_header ARDUINO_HEADER_R3_D10 GPIO_ACTIVE_LOW>,
53+
<&arduino_header ARDUINO_HEADER_R3_D4 GPIO_ACTIVE_LOW>;
5354

5455
adafruit_2_8_tft_touch_v2_sdhc: sdhc@1 {
5556
compatible = "zephyr,sdhc-spi-slot";
@@ -69,6 +70,6 @@
6970
compatible = "focaltech,ft5336";
7071
reg = <0x38>;
7172
/* Uncomment if IRQ line is available (requires to solder jumper) */
72-
/* int-gpios = <&arduino_header 13 GPIO_ACTIVE_LOW>; */ /* D7 */
73+
/* int-gpios = <&arduino_header ARDUINO_HEADER_R3_D7 GPIO_ACTIVE_LOW>; */
7374
};
7475
};

boards/shields/adafruit_data_logger/adafruit_data_logger.overlay

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#include <zephyr/dt-bindings/gpio/arduino-header-r3.h>
8+
79
/ {
810
aliases {
911
rtc = &rtc0_adafruit_data_logger;
@@ -16,15 +18,15 @@
1618
* pins "L1" and "Digital I/O 3".
1719
*/
1820
green_led_adafruit_data_logger: led_1__adafruit_data_logger {
19-
gpios = <&arduino_header 9 GPIO_ACTIVE_HIGH>; /* D3 */
21+
gpios = <&arduino_header ARDUINO_HEADER_R3_D3 GPIO_ACTIVE_HIGH>;
2022
label = "User LED1";
2123
};
2224
/*
2325
* LED2 connection must be manually established using a jumper between
2426
* pins "L2" and "Digital I/O 4".
2527
*/
2628
red_led_adafruit_data_logger: led_2_adafruit_data_logger {
27-
gpios = <&arduino_header 10 GPIO_ACTIVE_HIGH>; /* D4 */
29+
gpios = <&arduino_header ARDUINO_HEADER_R3_D4 GPIO_ACTIVE_HIGH>;
2830
label = "User LED2";
2931
};
3032
};
@@ -33,7 +35,7 @@
3335

3436
&arduino_spi {
3537
status = "okay";
36-
cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
38+
cs-gpios = <&arduino_header ARDUINO_HEADER_R3_D10 GPIO_ACTIVE_LOW>;
3739

3840
sdhc0_adafruit_data_logger: sdhc@0 {
3941
compatible = "zephyr,sdhc-spi-slot";
@@ -61,7 +63,7 @@
6163
* Interrupt connection must be manually established using a jumper wire between
6264
* pins "SQ" and "Digital I/O 7".
6365
*/
64-
int1-gpios = <&arduino_header 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* D7 */
66+
int1-gpios = <&arduino_header ARDUINO_HEADER_R3_D7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
6567
status = "okay";
6668
};
6769
};

boards/shields/adafruit_winc1500/adafruit_winc1500.overlay

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#include <zephyr/dt-bindings/gpio/arduino-header-r3.h>
8+
79
&arduino_spi {
810
status = "okay";
9-
cs-gpios = <&arduino_header 16 0>; /* D10 */
11+
cs-gpios = <&arduino_header ARDUINO_HEADER_R3_D10 0>;
1012

1113
winc1500_adafruit_winc1500: winc1500@0 {
1214
status = "ok";
1315
compatible = "atmel,winc1500";
1416
reg = <0x0>;
1517
spi-max-frequency = <4000000>;
16-
irq-gpios = <&arduino_header 13 GPIO_ACTIVE_LOW>; /* D7 */
17-
reset-gpios = <&arduino_header 11 GPIO_ACTIVE_LOW>; /* D5 */
18-
enable-gpios = <&arduino_header 12 0>; /* D6 */
18+
irq-gpios = <&arduino_header ARDUINO_HEADER_R3_D7 GPIO_ACTIVE_LOW>;
19+
reset-gpios = <&arduino_header ARDUINO_HEADER_R3_D5 GPIO_ACTIVE_LOW>;
20+
enable-gpios = <&arduino_header ARDUINO_HEADER_R3_D6 0>;
1921
};
2022
};

boards/shields/amg88xx/amg88xx_eval_kit.overlay

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#include <zephyr/dt-bindings/gpio/arduino-header-r3.h>
8+
79
&arduino_i2c {
810
status = "okay";
911

1012
amg88xx_amg88xx_eval_kit: amg88xx@68 {
1113
compatible = "panasonic,amg88xx";
1214
reg = <0x68>;
13-
/* Pin D6 from Arduino Connector */
14-
int-gpios = <&arduino_header 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
15+
int-gpios = <&arduino_header ARDUINO_HEADER_R3_D6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
1516
status = "okay";
1617
};
1718
};

boards/shields/amg88xx/amg88xx_grid_eye_eval_shield.overlay

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6+
#include <zephyr/dt-bindings/gpio/arduino-header-r3.h>
7+
68
&arduino_i2c {
79
status = "okay";
810
amg88xx_amg88xx_grid_eye_eval_shield: amg88xx@68 {
911
compatible = "panasonic,amg88xx";
1012
reg = <0x68>;
11-
/* Pin D2 from Arduino Connector */
12-
int-gpios = <&arduino_header 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
13+
int-gpios = <&arduino_header ARDUINO_HEADER_R3_D2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
1314
status = "okay";
1415
};
1516
};

boards/shields/arceli_eth_w5500/arceli_eth_w5500.overlay

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
* SPDX-License-Identifier: Apache-2.0
33
*/
44

5+
#include <zephyr/dt-bindings/gpio/arduino-header-r3.h>
6+
57
&arduino_spi {
68
status = "okay";
79

810
eth_w5500_arceli_eth_w5500: eth_w5500@0 {
911
compatible = "wiznet,w5500";
1012
reg = <0x0>;
1113
spi-max-frequency = <80000000>;
12-
int-gpios = <&arduino_header 15 GPIO_ACTIVE_LOW>; /* D9 */
13-
reset-gpios = <&arduino_header 14 GPIO_ACTIVE_LOW>; /* D8 */
14+
int-gpios = <&arduino_header ARDUINO_HEADER_R3_D9 GPIO_ACTIVE_LOW>;
15+
reset-gpios = <&arduino_header ARDUINO_HEADER_R3_D8 GPIO_ACTIVE_LOW>;
1416
};
1517
};

boards/shields/atmel_rf2xx/atmel_rf2xx_arduino.overlay

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#include <zephyr/dt-bindings/gpio/arduino-header-r3.h>
8+
79
/ {
810
chosen {
911
zephyr,ieee802154 = &ieee802154_atmel_rf2xx_arduino;
@@ -13,21 +15,17 @@
1315
&arduino_spi {
1416
status = "okay";
1517

16-
/* D10 */
17-
cs-gpios = <&arduino_header 16
18+
cs-gpios = <&arduino_header ARDUINO_HEADER_R3_D10
1819
(GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
1920

2021
ieee802154_atmel_rf2xx_arduino: rf2xx@0 {
2122
compatible = "atmel,rf2xx";
2223
reg = <0x0>;
2324
spi-max-frequency = <6000000>;
24-
/* D2 */
25-
irq-gpios = <&arduino_header 8
25+
irq-gpios = <&arduino_header ARDUINO_HEADER_R3_D2
2626
(GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
27-
/* D8 */
28-
reset-gpios = <&arduino_header 14 GPIO_ACTIVE_LOW>;
29-
/* D9 */
30-
slptr-gpios = <&arduino_header 15 GPIO_ACTIVE_HIGH>;
27+
reset-gpios = <&arduino_header ARDUINO_HEADER_R3_D8 GPIO_ACTIVE_LOW>;
28+
slptr-gpios = <&arduino_header ARDUINO_HEADER_R3_D9 GPIO_ACTIVE_HIGH>;
3129
status = "okay";
3230
};
3331
};

boards/shields/buydisplay_2_8_tft_touch_arduino/buydisplay_2_8_tft_touch_arduino.overlay

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
#include <zephyr/dt-bindings/display/ili9xxx.h>
8+
#include <zephyr/dt-bindings/gpio/arduino-header-r3.h>
89

910
/ {
1011
chosen {
@@ -22,8 +23,8 @@
2223

2324
buydisplay_2_8_tft_touch_arduino_mipi_dbi {
2425
compatible = "zephyr,mipi-dbi-spi";
25-
dc-gpios = <&arduino_header 13 GPIO_ACTIVE_HIGH>; /* D7 */
26-
reset-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
26+
dc-gpios = <&arduino_header ARDUINO_HEADER_R3_D7 GPIO_ACTIVE_HIGH>;
27+
reset-gpios = <&arduino_header ARDUINO_HEADER_R3_D10 GPIO_ACTIVE_LOW>;
2728
spi-dev = <&arduino_spi>;
2829
write-only;
2930
#address-cells = <1>;
@@ -49,14 +50,14 @@
4950

5051
&arduino_spi {
5152
status = "okay";
52-
cs-gpios = <&arduino_header 15 GPIO_ACTIVE_LOW>; /* D9 */
53+
cs-gpios = <&arduino_header ARDUINO_HEADER_R3_D9 GPIO_ACTIVE_LOW>;
5354
};
5455

5556
&arduino_i2c {
5657
ft5336_buydisplay_2_8_tft_touch_arduino: ft5336@38 {
5758
compatible = "focaltech,ft5336";
5859
reg = <0x38>;
5960
/* Uncomment if IRQ line is available (requires to solder jumper) */
60-
/* int-gpios = <&arduino_header 11 GPIO_ACTIVE_LOW>; */ /* D5 */
61+
/* int-gpios = <&arduino_header ARDUINO_HEADER_R3_D5 GPIO_ACTIVE_LOW>; */
6162
};
6263
};

boards/shields/buydisplay_3_5_tft_touch_arduino/buydisplay_3_5_tft_touch_arduino.overlay

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
#include <zephyr/dt-bindings/display/ili9xxx.h>
8+
#include <zephyr/dt-bindings/gpio/arduino-header-r3.h>
89

910
/ {
1011
chosen {
@@ -22,8 +23,8 @@
2223

2324
buydisplay_3_5_tft_touch_arduino_mipi_dbi {
2425
compatible = "zephyr,mipi-dbi-spi";
25-
dc-gpios = <&arduino_header 13 GPIO_ACTIVE_HIGH>; /* D7 */
26-
reset-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
26+
dc-gpios = <&arduino_header ARDUINO_HEADER_R3_D7 GPIO_ACTIVE_HIGH>;
27+
reset-gpios = <&arduino_header ARDUINO_HEADER_R3_D10 GPIO_ACTIVE_LOW>;
2728
spi-dev = <&arduino_spi>;
2829
write-only;
2930
#address-cells = <1>;
@@ -48,14 +49,14 @@
4849

4950
&arduino_spi {
5051
status = "okay";
51-
cs-gpios = <&arduino_header 15 GPIO_ACTIVE_LOW>; /* D9 */
52+
cs-gpios = <&arduino_header ARDUINO_HEADER_R3_D9 GPIO_ACTIVE_LOW>;
5253
};
5354

5455
&arduino_i2c {
5556
ft5336_buydisplay_3_5_tft_touch_arduino: ft5336@38 {
5657
compatible = "focaltech,ft5336";
5758
reg = <0x38>;
5859
/* Uncomment if IRQ line is available (requires to solder jumper) */
59-
/* int-gpios = <&arduino_header 11 GPIO_ACTIVE_LOW>; */ /* D5 */
60+
/* int-gpios = <&arduino_header ARDUINO_HEADER_R3_D5 GPIO_ACTIVE_LOW>; */
6061
};
6162
};

boards/shields/dac80508_evm/dac80508_evm.overlay

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#include <zephyr/dt-bindings/gpio/arduino-header-r3.h>
8+
79
&arduino_spi {
810
status = "okay";
9-
cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
11+
cs-gpios = <&arduino_header ARDUINO_HEADER_R3_D10 GPIO_ACTIVE_LOW>;
1012

1113
dac80508_dac80508_evm: dac80508@0 {
1214
compatible = "ti,dac80508";

0 commit comments

Comments
 (0)