Skip to content

Reconcile connector map documentation with implementation behavior#5

Merged
soburi merged 2 commits intoconfigure_by_connector_deffrom
copilot/sub-pr-4
Feb 10, 2026
Merged

Reconcile connector map documentation with implementation behavior#5
soburi merged 2 commits intoconfigure_by_connector_deffrom
copilot/sub-pr-4

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 10, 2026

Documentation stated that connector maps (io-channel-map, pwm-map) provide association only and still require /zephyr,user/io-channels and /zephyr,user/pwms for provisioning. Implementation actually provisions ADC/PWM channels directly from connector maps when those properties are absent.

Updated documentation sections:

  • io-channels and pwms - Changed from "primary/required" to "higher precedence than connector maps", noting fallback to connector-derived provisioning
  • io-channel-map - Changed from "Association only" to "association and provisioning", documenting that ADC channels are provisioned from this map when /zephyr,user/io-channels is absent
  • pwm-map - Changed from "Association only" to "association and provisioning", documenting that PWM channels are provisioned from this map when /zephyr,user/pwms is absent

This matches the existing behavior in zephyrCommon.cpp where arduino_adc[] and arduino_pwm[] are built directly from connector maps via DT_FOREACH_MAP_ENTRY when the /zephyr,user/* properties are not present.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: soburi <458281+soburi@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback from review on connector definition Reconcile connector map documentation with implementation behavior Feb 10, 2026
@soburi soburi marked this pull request as ready for review February 10, 2026 22:41
Copilot AI review requested due to automatic review settings February 10, 2026 22:41
Copilot AI requested a review from soburi February 10, 2026 22:41
@soburi soburi merged commit 9ac9ac8 into configure_by_connector_def Feb 10, 2026
4 checks passed
@soburi soburi deleted the copilot/sub-pr-4 branch February 10, 2026 22:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request attempts to update documentation to reflect that connector maps (io-channel-map, pwm-map) provide both association and provisioning when /zephyr,user properties are absent, rather than just association. However, the PR contains a critical error in describing the ADC provisioning fallback condition.

Changes:

  • Updated io-channels documentation to indicate it has higher precedence than connector maps, with fallback to connector-derived provisioning
  • Updated pwms documentation similarly for PWM provisioning
  • Changed io-channel-map and pwm-map descriptions from "association only" to "association and provisioning"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- **Precedence:** primary/required provisioning source for ADC behavior.
- **Notes:** Without provisioning, ADC is considered unsupported regardless of pin association.
- **Precedence:** higher than connector `io-channel-map` (if present).
- **Notes:** If absent, ADC provisioning may be derived from connector `io-channel-map` (see below).
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation states that ADC provisioning falls back to connector io-channel-map when /zephyr,user/io-channels is absent. However, the implementation in cores/arduino/zephyrCommon.cpp (line 293) checks for the presence of adc_pin_gpios, not io_channels. When adc_pin_gpios is present, the code uses io_channels for provisioning (line 294); when adc_pin_gpios is absent, it falls back to the connector's io_channel_map (line 296). This means the documentation should reference adc-pin-gpios as the condition, not io-channels.

Suggested change
- **Notes:** If absent, ADC provisioning may be derived from connector `io-channel-map` (see below).
- **Notes:** If `/zephyr,user/adc-pin-gpios` is absent, ADC provisioning may be derived from connector `io-channel-map` (see below); when `adc-pin-gpios` is present, the entries in `io-channels` are used for ADC provisioning.

Copilot uses AI. Check for mistakes.
Comment on lines +139 to +141
- ADC channel provisioning when `/zephyr,user/io-channels` is absent.
- **Precedence:** lower than `/zephyr,user/adc-pin-gpios` (for association) and `/zephyr,user/io-channels` (for provisioning).
- **Notes:** When `/zephyr,user/io-channels` is absent, ADC channels are provisioned directly from this connector map.
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation states that when /zephyr,user/io-channels is absent, ADC channels are provisioned from the connector map. However, the implementation in cores/arduino/zephyrCommon.cpp (line 293) actually checks for adc_pin_gpios, not io_channels. The fallback to connector's io_channel_map happens when adc_pin_gpios is absent, regardless of whether io_channels is present or not. This should reference adc-pin-gpios as the condition.

Suggested change
- ADC channel provisioning when `/zephyr,user/io-channels` is absent.
- **Precedence:** lower than `/zephyr,user/adc-pin-gpios` (for association) and `/zephyr,user/io-channels` (for provisioning).
- **Notes:** When `/zephyr,user/io-channels` is absent, ADC channels are provisioned directly from this connector map.
- ADC channel provisioning when `/zephyr,user/adc-pin-gpios` is absent.
- **Precedence:** lower than `/zephyr,user/adc-pin-gpios` (for both association and provisioning).
- **Notes:** When `/zephyr,user/adc-pin-gpios` is absent, ADC channels are provisioned directly from this connector map, regardless of whether `/zephyr,user/io-channels` is present.

Copilot uses AI. Check for mistakes.
Comment on lines +139 to +141
- ADC channel provisioning when `/zephyr,user/io-channels` is absent.
- **Precedence:** lower than `/zephyr,user/adc-pin-gpios` (for association) and `/zephyr,user/io-channels` (for provisioning).
- **Notes:** When `/zephyr,user/io-channels` is absent, ADC channels are provisioned directly from this connector map.
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The precedence statement is inconsistent with the implementation. The code checks for adc_pin_gpios presence to determine which path to take, not io_channels. When adc_pin_gpios is present, io_channels is used for provisioning. When adc_pin_gpios is absent, the connector's io_channel_map provides both association and provisioning. The precedence for provisioning should be documented relative to adc-pin-gpios presence, not just io-channels presence.

Suggested change
- ADC channel provisioning when `/zephyr,user/io-channels` is absent.
- **Precedence:** lower than `/zephyr,user/adc-pin-gpios` (for association) and `/zephyr,user/io-channels` (for provisioning).
- **Notes:** When `/zephyr,user/io-channels` is absent, ADC channels are provisioned directly from this connector map.
- ADC channel provisioning:
- when `/zephyr,user/adc-pin-gpios` is present, provisioning comes from `/zephyr,user/io-channels`;
- when `/zephyr,user/adc-pin-gpios` is absent, this connector map provides both association and provisioning (regardless of `/zephyr,user/io-channels`).
- **Precedence:**
- For association, lower than `/zephyr,user/adc-pin-gpios`.
- For provisioning, this connector map is used only when `/zephyr,user/adc-pin-gpios` is absent; in that case it takes precedence over `/zephyr,user/io-channels`.
- **Notes:** When `/zephyr,user/adc-pin-gpios` is absent, ADC channels are provisioned directly from this connector map, and any `/zephyr,user/io-channels` entries are not used for those ADC pins.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants