@@ -148,10 +148,18 @@ const struct pwm_dt_spec arduino_pwm[] = {
148148 DT_FOREACH_PROP_ELEM_SEP (DT_PATH (zephyr_user), pwms, PWM_DT_SPEC, (,))
149149};
150150
151+ #if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), pwm_pin_gpios)
151152/* pwm-pins node provides a mapping digital pin numbers to pwm channels */
152153const pin_size_t arduino_pwm_pins[] = {
153154 DT_FOREACH_PROP_ELEM_SEP (DT_PATH (zephyr_user), pwm_pin_gpios, ZARD_GLOBAL_GPIO_NUM, (,))
154155};
156+ #else
157+ #define ZARD_PWM_CONNECTOR_PINNUM (n, p, i ) DT_MAP_ENTRY_CHILD_SPECIFIER_BY_IDX(n, p, i, 0 )
158+ const pin_size_t arduino_pwm_pins[] = {
159+ DT_FOREACH_MAP_ENTRY_SEP (DT_NODELABEL (ZARD_PWM_CONNECTOR), pwm_map, ZARD_PWM_CONNECTOR_PINNUM, (, )),
160+ };
161+
162+ #endif
155163
156164size_t pwm_pin_index (pin_size_t pinNumber) {
157165 for (size_t i=0 ; i<ARRAY_SIZE (arduino_pwm_pins); i++) {
@@ -179,7 +187,7 @@ const pin_size_t arduino_analog_pins[] = {
179187 DT_FOREACH_PROP_ELEM_SEP (DT_PATH (zephyr_user), adc_pin_gpios, ZARD_GLOBAL_GPIO_NUM, (,))
180188};
181189#else
182- #define ZARD_ADC_CONNECTOR_AN (n, p, i ) UTIL_CAT(A, i )
190+ #define ZARD_ADC_CONNECTOR_AN (n, p, i ) DT_MAP_ENTRY_CHILD_SPECIFIER_BY_IDX(n, p, i, 0 )
183191const pin_size_t arduino_analog_pins[] = {
184192 DT_FOREACH_MAP_ENTRY_SEP (DT_NODELABEL (ZARD_ADC_CONNECTOR), io_channel_map, ZARD_ADC_CONNECTOR_AN, (, )),
185193};
0 commit comments