2424 DT_PHANDLE_BY_IDX(n, p, i)) \
2525 DT_PHA_BY_IDX(n, p, i, pin)
2626
27+ #if DT_NODE_HAS_PROP (DT_PATH (zephyr_user ), digital_pin_gpios )
2728/*
2829 * expand as
2930 * enum digitalPins { D0, D1, ... };
@@ -33,6 +34,33 @@ enum digitalPins {
3334 DT_FOREACH_PROP_ELEM_SEP (DT_PATH (zephyr_user ), digital_pin_gpios , ZARD_DN_ENUMS , (, )),
3435 NUM_OF_DIGITAL_PINS
3536};
37+ #else
38+
39+ #define ZARD_MKR_HDR_DN_ENUMS (n , p , i ) \
40+ D##i = DT_FOREACH_PROP_ELEM_VARGS(DT_PATH(zephyr_user), gpio_ports, ZARD_ACCUM_NGPIOS, \
41+ DT_MAP_PARENT_ARG_BY_IDX(n, p, i)) \
42+ GET_ARG_N(1, DT_MAP_PARENT_SPECIFIER_ARGS_BY_IDX(n, p, i))
43+
44+ #if DT_NODE_EXISTS (DT_NODELABEL (arduino_header ))
45+ #define ZARD_CONNECTOR arduino_header
46+ #elif DT_NODE_EXISTS (DT_NODELABEL (arduino_mkr_header ))
47+ #define ZARD_CONNECTOR arduino_mkr_header
48+ #elif DT_NODE_EXISTS (DT_NODELABEL (arduino_nano_header ))
49+ #define ZARD_CONNECTOR arduino_nano_header
50+ #elif DT_NODE_EXISTS (DT_NODELABEL (pico_header ))
51+ #define ZARD_CONNECTOR pico_header
52+ #elif DT_NODE_EXISTS (DT_NODELABEL (boosterpack_header ))
53+ #define ZARD_CONNECTOR boosterpack_header
54+ #endif
55+
56+ #ifdef ZARD_CONNECTOR
57+ enum digitalPins {
58+ DT_FOREACH_PROP_ELEM_SEP (DT_NODELABEL (ZARD_CONNECTOR ), gpio_map , ZARD_MKR_HDR_DN_ENUMS , (, )),
59+ NUM_OF_DIGITAL_PINS
60+ };
61+ #endif
62+
63+ #endif
3664
3765#ifdef CONFIG_ADC
3866#define ZARD_AN_ENUMS (n , p , i ) A##i = ZARD_GLOBAL_GPIO_NUM(n, p, i)
0 commit comments