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,33 @@ 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_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
4574
4675#ifdef CONFIG_ADC
4776#define ZARD_AN_ENUMS (n , p , i ) A##i = ZARD_GLOBAL_GPIO_NUM(n, p, i)
0 commit comments