Skip to content

Commit 5b861f1

Browse files
authored
Merge pull request #11 from soburi/copilot/sub-pr-4-please-work
Fix ADC array gating mismatch between adc_pin_gpios and io_channels
2 parents 0556fbf + 042e0a1 commit 5b861f1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

cores/arduino/zephyrCommon.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,14 @@ struct adc_channel_cfg channel_cfg[ARRAY_SIZE(arduino_analog_pins)] = {
329329
#endif
330330
};
331331

332+
#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), io_channels) && \
333+
DT_NODE_HAS_PROP(DT_PATH(zephyr_user), adc_pin_gpios)
334+
#if DT_PROP_LEN(DT_PATH(zephyr_user), io_channels) != \
335+
DT_PROP_LEN(DT_PATH(zephyr_user), adc_pin_gpios)
336+
#error "io_channels and adc_pin_gpios must have the same length"
337+
#endif
338+
#endif
339+
332340
size_t analog_pin_index(pin_size_t pinNumber) {
333341
for(size_t i=0; i<ARRAY_SIZE(arduino_analog_pins); i++) {
334342
if (arduino_analog_pins[i] == pinNumber) {

0 commit comments

Comments
 (0)