Skip to content

Fix PWM_PINS macro compilation without digital-pin-gpios#9

Closed
Copilot wants to merge 7 commits intoconfigure_by_connector_deffrom
copilot/sub-pr-4-yet-again
Closed

Fix PWM_PINS macro compilation without digital-pin-gpios#9
Copilot wants to merge 7 commits intoconfigure_by_connector_deffrom
copilot/sub-pr-4-yet-again

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 10, 2026

The PWM_PINS macro unconditionally uses DIGITAL_PIN_GPIOS_FIND_PIN, which is only defined when /zephyr,user/digital-pin-gpios exists. Boards using global GPIO numbering with pwm-pin-gpios but no digital-pin-gpios fail to compile.

Changes:

  • Add conditional compilation to PWM_PINS macro in cores/arduino/zephyrCommon.cpp:
    • When digital_pin_gpios exists: use DIGITAL_PIN_GPIOS_FIND_PIN (existing behavior)
    • When digital_pin_gpios absent: use ZARD_GLOBAL_GPIO_NUM to compute global GPIO numbers
  • Fix indentation to use tabs per project style

This mirrors the pattern already used for ADC pins in Arduino.h (lines 159-170).

#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), digital_pin_gpios)
#define PWM_PINS(n, p, i) \
	DIGITAL_PIN_GPIOS_FIND_PIN( \
		DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), p, i)), \
		DT_PHA_BY_IDX(DT_PATH(zephyr_user), p, i, pin)),
#else
#define PWM_PINS(n, p, i) \
	ZARD_GLOBAL_GPIO_NUM(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), p, i)) + \
		DT_PHA_BY_IDX(DT_PATH(zephyr_user), p, i, pin),
#endif

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 5 commits February 10, 2026 22:58
Co-authored-by: soburi <458281+soburi@users.noreply.github.com>
Co-authored-by: soburi <458281+soburi@users.noreply.github.com>
Co-authored-by: soburi <458281+soburi@users.noreply.github.com>
Co-authored-by: soburi <458281+soburi@users.noreply.github.com>
Co-authored-by: soburi <458281+soburi@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP address feedback from review on Configure by connector def PR Fix PWM_PINS macro compilation without digital-pin-gpios Feb 10, 2026
Copilot AI requested a review from soburi February 10, 2026 23:02
@soburi soburi closed this Feb 10, 2026
@soburi soburi deleted the copilot/sub-pr-4-yet-again branch February 11, 2026 03:52
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