33
33
#endif
34
34
#endif // LED_BUILTIN
35
35
36
+
37
+ #if DT_NODE_HAS_PROP (DT_PATH (zephyr_user ), digital_pin_gpios )
36
38
/*
37
39
* expand as
38
40
* enum digitalPins { D0, D1, ... };
@@ -42,6 +44,33 @@ enum digitalPins {
42
44
DT_FOREACH_PROP_ELEM_SEP (DT_PATH (zephyr_user ), digital_pin_gpios , ZARD_DN_ENUMS , (, )),
43
45
NUM_OF_DIGITAL_PINS
44
46
};
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_nano_header ))
59
+ #define ZARD_CONNECTOR arduino_nano_header
60
+ #elif DT_NODE_EXISTS (DT_NODELABEL (pico_header ))
61
+ #define ZARD_CONNECTOR pico_header
62
+ #elif DT_NODE_EXISTS (DT_NODELABEL (boosterpack_header ))
63
+ #define ZARD_CONNECTOR boosterpack_header
64
+ #endif
65
+
66
+ #ifdef ZARD_CONNECTOR
67
+ enum digitalPins {
68
+ DT_FOREACH_PROP_ELEM_SEP (DT_NODELABEL (ZARD_CONNECTOR ), gpio_map , ZARD_MKR_HDR_DN_ENUMS , (, )),
69
+ NUM_OF_DIGITAL_PINS
70
+ };
71
+ #endif
72
+
73
+ #endif
45
74
46
75
#ifdef CONFIG_ADC
47
76
#define ZARD_AN_ENUMS (n , p , i ) A##i = ZARD_GLOBAL_GPIO_NUM(n, p, i)
0 commit comments