Skip to content

Cleanup cores/arduino/commonZephyr.cpp, cores/arduino/Arduino.h#168

Merged
soburi merged 4 commits intozephyrproject-rtos:nextfrom
soburi:cleanup_common
Mar 2, 2026
Merged

Cleanup cores/arduino/commonZephyr.cpp, cores/arduino/Arduino.h#168
soburi merged 4 commits intozephyrproject-rtos:nextfrom
soburi:cleanup_common

Conversation

@soburi
Copy link
Copy Markdown
Member

@soburi soburi commented Mar 1, 2026

Merge following fix from https://github.com/arduino/ArduinoCore-zephyr/.

  • Add condition branching when digital_pins_gpios has no entry
  • Fix edge case macro expansion failure
  • Add pin find helper macro
  • Fix warnings in zephyrCommon.cpp

@soburi soburi marked this pull request as ready for review March 1, 2026 01:58
Copilot AI review requested due to automatic review settings March 1, 2026 01:58
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 PR ports upstream “common” cleanup fixes into the Zephyr-based Arduino core, aiming to make devicetree-driven digital pin handling more robust and to address build warnings.

Changes:

  • Adds conditional compilation around devicetree-derived pin/port computations when digital_pin_gpios is empty/missing.
  • Refactors devicetree pin-matching macros to avoid macro-expansion edge cases and adds a helper macro for pin lookup.
  • Silences an unused-parameter warning in the GPIO callback.

Reviewed changes

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

File Description
cores/arduino/zephyrCommon.cpp Adds digital_pin_gpios length gating for compile-time port/pin calculations; suppresses unused port warning.
cores/arduino/Arduino.h Updates/extends devicetree macros for pin matching and makes digitalPins enum generation conditional.

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

Comment thread cores/arduino/Arduino.h
Comment thread cores/arduino/zephyrCommon.cpp
Comment thread cores/arduino/zephyrCommon.cpp
Comment thread cores/arduino/Arduino.h
@soburi soburi changed the title Cleanup common Cleanup cores/arduino/commonZephyr.cpp, cores/arduino/Arduino.h Mar 1, 2026
facchinm and others added 4 commits March 1, 2026 23:39
Added a condition that the length of digital_pin_gpios is 0 or more.

-------------------------------------------------------------------

Pick: arduino@d20ef628

Co-Authored-by:    Martino Facchin <m.facchin@arduino.cc>
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
…sues

The DIGITAL_PIN_EXISTS macro (used e.g. by LED_BUILTIN) was not working
properly because the inline comments in devicetree_generated.h were
confusing the preprocessor: one internal macro tried to create an
unsigned constant by pasting a '*/' comment end marker with the 'U'
character.

Splitting that macro into two parts, so that the DT_REG_ADDR macro is
invoked with an expanded argument, fixes the issue.

-------------------------------------------------------------------

Pick: arduino@84651c2c

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Add `DIGITAL_PIN_GPIOS_FIND_NODE` helper macro.

-------------------------------------------------------------------

Pick: arduino@a60cd82a

Co-Authored-by: Sebastian Romero <s.romero@arduino.cc>
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Silence a number of trivial compiler warnings in the Arduino core:
- unused arguments
- "constexpr const"

------------------------------------------------------------------

Pick: arduino@67251fb

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
@soburi soburi merged commit 3693469 into zephyrproject-rtos:next Mar 2, 2026
3 checks passed
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.

6 participants