Skip to content

Commit ffe669e

Browse files
committed
x
1 parent 28b1df9 commit ffe669e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

cores/arduino/Arduino.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#endif
3434
#endif // LED_BUILTIN
3535

36+
37+
#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), digital_pin_gpios)
3638
/*
3739
* expand as
3840
* enum digitalPins { D0, D1, ... };
@@ -42,6 +44,29 @@ enum digitalPins {
4244
DT_FOREACH_PROP_ELEM_SEP(DT_PATH(zephyr_user), digital_pin_gpios, ZARD_DN_ENUMS, (, )),
4345
NUM_OF_DIGITAL_PINS
4446
};
47+
#else
48+
49+
#define ZARD_MKR_HDR_DN_ENUMS(n, p, i) \
50+
D##i = DT_FOREACH_PROP_ELEM_VARGS(DT_PATH(zephyr_user), gpio_ports, ZARD_ACCUM_NGPIOS, \
51+
DT_MAP_PARENT_ARG_BY_IDX(n, p, i)) \
52+
GET_ARG_N(1, DT_MAP_PARENT_SPECIFIER_ARGS_BY_IDX(n, p, i))
53+
54+
#if DT_NODE_EXISTS(DT_NODELABEL(arduino_header))
55+
#define ZARD_CONNECTOR arduino_header
56+
#elif DT_NODE_EXISTS(DT_NODELABEL(arduino_mkr_header))
57+
#define ZARD_CONNECTOR arduino_mkr_header
58+
#elif DT_NODE_EXISTS(DT_NODELABEL(arduino__header))
59+
#define ZARD_CONNECTOR arduino_nano_header
60+
#endif
61+
62+
#ifdef ZARD_CONNECTOR
63+
enum digitalPins {
64+
DT_FOREACH_PROP_ELEM_SEP(DT_NODELABEL(ZARD_CONNECTOR), gpio_map, ZARD_MKR_HDR_DN_ENUMS, (, )),
65+
NUM_OF_DIGITAL_PINS
66+
}
67+
#endif
68+
69+
#endif
4570

4671
#ifdef CONFIG_ADC
4772
#define ZARD_AN_ENUMS(n, p, i) A##i = ZARD_GLOBAL_GPIO_NUM(n, p, i)

0 commit comments

Comments
 (0)