@@ -293,7 +293,7 @@ size_t pwm_pin_index(pin_size_t pinNumber) {
293293 ())
294294
295295const struct adc_dt_spec arduino_adc[] = {
296- #if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), adc_pin_gpios )
296+ #if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), io_channels )
297297 DT_FOREACH_PROP_ELEM (DT_PATH (zephyr_user), io_channels, ADC_DT_SPEC)
298298#elif defined(ZARD_ADC_CONNECTOR)
299299 DT_FOREACH_MAP_ENTRY (DT_NODELABEL (ZARD_ADC_CONNECTOR), io_channel_map, ADC_CONN_CHANNEL_DT)
@@ -310,13 +310,21 @@ const pin_size_t arduino_analog_pins[] = {
310310};
311311
312312struct adc_channel_cfg channel_cfg[ARRAY_SIZE(arduino_analog_pins)] = {
313- #if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), adc_pin_gpios )
313+ #if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), io_channels )
314314 DT_FOREACH_PROP_ELEM (DT_PATH (zephyr_user), io_channels, ADC_CH_CFG)
315315#elif defined(ZARD_ADC_CONNECTOR)
316316 DT_FOREACH_MAP_ENTRY (DT_NODELABEL (ZARD_ADC_CONNECTOR), io_channel_map, ADC_CONN_CHANNEL_CFG)
317317#endif
318318};
319319
320+ #if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), io_channels) && \
321+ DT_NODE_HAS_PROP (DT_PATH(zephyr_user), adc_pin_gpios)
322+ #if DT_PROP_LEN(DT_PATH(zephyr_user), io_channels) != \
323+ DT_PROP_LEN (DT_PATH(zephyr_user), adc_pin_gpios)
324+ #error "io_channels and adc_pin_gpios must have the same length"
325+ #endif
326+ #endif
327+
320328size_t analog_pin_index (pin_size_t pinNumber) {
321329 for (size_t i=0 ; i<ARRAY_SIZE (arduino_analog_pins); i++) {
322330 if (arduino_analog_pins[i] == pinNumber) {
0 commit comments