Skip to content

core: Introduce digitalPinTo(PortDevice|PinIndex)#187

Merged
DhruvaG2000 merged 2 commits into
zephyrproject-rtos:nextfrom
soburi:digitalPinToX
Jun 1, 2026
Merged

core: Introduce digitalPinTo(PortDevice|PinIndex)#187
DhruvaG2000 merged 2 commits into
zephyrproject-rtos:nextfrom
soburi:digitalPinToX

Conversation

@soburi

@soburi soburi commented May 6, 2026

Copy link
Copy Markdown
Member

Add digitalPinToPortDevice() and digitalPinToPinIndex(). Also define F_CPU for ARM targets.

Copilot AI review requested due to automatic review settings May 6, 2026 01:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds Arduino-style helpers for mapping a digital pin to its underlying Zephyr GPIO port device and pin index, and introduces an F_CPU definition for ARM builds to improve compatibility with Arduino libraries that expect it.

Changes:

  • Add digitalPinToPortDevice() and digitalPinToPinIndex() APIs to expose Zephyr GPIO mapping for a given Arduino pin.
  • Define F_CPU for __arm__ targets.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
cores/arduino/zephyrCommon.cpp Implements the new digitalPinToPortDevice() / digitalPinToPinIndex() mapping helpers.
cores/arduino/Arduino.h Declares the new mapping APIs and defines F_CPU for ARM targets.

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

Comment thread cores/arduino/zephyrCommon.cpp
Comment thread cores/arduino/Arduino.h
@soburi soburi marked this pull request as draft May 6, 2026 01:54
@soburi soburi force-pushed the digitalPinToX branch 2 times, most recently from b8c50b7 to 5b38871 Compare May 27, 2026 21:11
@soburi soburi force-pushed the digitalPinToX branch 3 times, most recently from a1c7a9e to 9faf453 Compare May 31, 2026 10:07
@soburi soburi requested a review from Copilot May 31, 2026 10:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@soburi soburi marked this pull request as ready for review May 31, 2026 10:12
@soburi soburi requested a review from Copilot May 31, 2026 10:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@soburi soburi requested a review from DhruvaG2000 May 31, 2026 10:34

@DhruvaG2000 DhruvaG2000 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Other than one minor comment good to go.

Comment thread cores/arduino/Arduino.h
#endif

#if defined(__arm__)
#define F_CPU (SystemCoreClock)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please split the F cpu change into its own commit.

facchinm and others added 2 commits June 1, 2026 13:58
Add digitalPinToPortDevice() and digitalPinToPinIndex().

Co-authored-by: Martino Facchin <m.facchin@arduino.cc>
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Add F_CPU definition for retrive CPU frequency.

Co-authored-by: Martino Facchin <m.facchin@arduino.cc>
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
@soburi soburi requested a review from DhruvaG2000 June 1, 2026 05:00
@DhruvaG2000 DhruvaG2000 merged commit eb95065 into zephyrproject-rtos:next Jun 1, 2026
3 checks passed
@soburi soburi deleted the digitalPinToX branch June 1, 2026 05:16
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.

4 participants