Skip to content

Enable connector fallback for ADC/PWM provisioning in Arduino-index mode#12

Closed
Copilot wants to merge 5 commits intoconfigure_by_connector_deffrom
copilot/sub-pr-4-506e1b03-cd24-4d90-a9c9-9c0600cc9be5
Closed

Enable connector fallback for ADC/PWM provisioning in Arduino-index mode#12
Copilot wants to merge 5 commits intoconfigure_by_connector_deffrom
copilot/sub-pr-4-506e1b03-cd24-4d90-a9c9-9c0600cc9be5

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 11, 2026

ADC/PWM provisioning incorrectly skipped connector io-channel-map/pwm-map fallback when /zephyr,user/adc-pin-gpios/pwm-pin-gpios was present with digital_pin_gpios, leaving arrays empty when explicit channel lists were absent. The issue was that the code didn't allow connector fallback within Arduino-index mode.

Changes

Added #elif defined(ZARD_*_CONNECTOR) fallback branches within the digital_pin_gpios conditional blocks for:

  • ADC provisioning (arduino_adc[], channel_cfg[]): Check io-channels → connector io-channel-map
  • PWM provisioning (arduino_pwm[]): Check pwms → connector pwm-map

This enables connector fallback when *-pin-gpios + digital_pin_gpios exist but explicit channel lists are absent, while maintaining BUILD_ASSERT validation that provisioning and association arrays match in size.

Before

const struct adc_dt_spec arduino_adc[] = {
#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), adc_pin_gpios)
  #if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), digital_pin_gpios)
    #if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), io_channels)
      DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), io_channels, ADC_DT_SPEC)
    #endif
    // Falls through to empty when io_channels absent
  #else //global pin rule
    //TODO
  #endif
#elif defined(ZARD_ADC_CONNECTOR)
  DT_FOREACH_MAP_ENTRY(..., io_channel_map, ADC_CONN_CHANNEL_DT)
#endif
};

After

const struct adc_dt_spec arduino_adc[] = {
#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), adc_pin_gpios)
  #if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), digital_pin_gpios)
    #if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), io_channels)
      DT_FOREACH_PROP_ELEM(DT_PATH(zephyr_user), io_channels, ADC_DT_SPEC)
    #elif defined(ZARD_ADC_CONNECTOR)
      DT_FOREACH_MAP_ENTRY(..., io_channel_map, ADC_CONN_CHANNEL_DT)
    #endif
  #else //global pin rule
    //TODO
  #endif
#elif defined(ZARD_ADC_CONNECTOR)
  DT_FOREACH_MAP_ENTRY(..., io_channel_map, ADC_CONN_CHANNEL_DT)
#endif
};

Logic Flow

When *-pin-gpios + digital_pin_gpios exist (Arduino-index mode):

  • Check explicit provisioning (io-channels/pwms) first
  • Fall back to connector maps if absent
  • BUILD_ASSERT validates array size match

When *-pin-gpios exists without digital_pin_gpios (global GPIO mode):

  • Global pin rule (TODO - not yet implemented)

When *-pin-gpios doesn't exist:

  • Use connector maps for both association and provisioning

Aligns with configuration-reference.md: connector maps provision channels when explicit channel lists are absent, while respecting the different rules for Arduino-index vs global GPIO numbering modes.


💡 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] Update connector definition configuration based on feedback Decouple ADC/PWM provisioning from pin association Feb 11, 2026
Copilot AI requested a review from soburi February 11, 2026 00:03
@soburi
Copy link
Copy Markdown
Owner

soburi commented Feb 11, 2026

@copilot digital_pin_gpiosがある場合とない場合でルールが異なります。io-channels の有無は最終的にBUILD_ASSERTでチェックされます。修正を。

Copilot AI and others added 2 commits February 11, 2026 00:07
Co-authored-by: soburi <458281+soburi@users.noreply.github.com>
Co-authored-by: soburi <458281+soburi@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Feb 11, 2026

@copilot digital_pin_gpiosがある場合とない場合でルールが異なります。io-channels の有無は最終的にBUILD_ASSERTでチェックされます。修正を。

Fixed in commit e2cf6d7. Added connector fallback within the digital_pin_gpios check:

  • When *-pin-gpios + digital_pin_gpios exist: tries io-channels/pwms first, then falls back to connector maps
  • When *-pin-gpios exists without digital_pin_gpios: global pin rule (TODO)
  • When *-pin-gpios doesn't exist: connector maps for both

BUILD_ASSERT continues to validate that provisioning and association arrays match in size.

Co-authored-by: soburi <458281+soburi@users.noreply.github.com>
Copilot AI changed the title Decouple ADC/PWM provisioning from pin association Enable connector fallback for ADC/PWM provisioning in Arduino-index mode Feb 11, 2026
@soburi
Copy link
Copy Markdown
Owner

soburi commented Feb 11, 2026

@copilot TODOを実装してください。

@soburi soburi closed this Feb 11, 2026
Copilot stopped work on behalf of soburi due to an error February 11, 2026 00:11
@soburi soburi deleted the copilot/sub-pr-4-506e1b03-cd24-4d90-a9c9-9c0600cc9be5 branch February 11, 2026 03:53
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.

2 participants