Skip to content

Confirm STM32 Arduino pin literals already emit PA_10 format#56

Merged
zcohen-nerd merged 1 commit intomainfrom
copilot/fix-define-values-stm32
Feb 27, 2026
Merged

Confirm STM32 Arduino pin literals already emit PA_10 format#56
zcohen-nerd merged 1 commit intomainfrom
copilot/fix-define-values-stm32

Conversation

Copy link
Contributor

Copilot AI commented Feb 27, 2026

The issue reported incorrect STM32 Arduino #define values (e.g., PA10 becoming 10) where STM32 cores expect PA_10. This review verifies the current emitter already produces MCU-appropriate literals and is covered by regression tests.

  • Emitter behavior

    • _arduino_pin_literal() maps STM32 P<PORT><PIN> to P<PORT>_<PIN> (e.g., PA10 → PA_10), while retaining numeric literals for RP2040/ESP32.
  • Regression coverage

    • Existing tests in tests/test_fixes_46_55.py assert STM32 literals and header output formatting.

Example (current behavior):

_arduino_pin_literal("PA10")  # => "PA_10"
Original prompt

This section details on the original issue you should resolve

<issue_title>Arduino #define values incorrect for STM32 MCU</issue_title>
<issue_description>## Bugemit_arduino.py extracts the numeric part of pin names via
e.search(r'\d+', pin_name) for #define values. For STM32 pins like PA10, this produces #define SDA 10 but STM32 Arduino cores use PA_10 format, not bare numeric pin numbers. Digital pin 10 != PA10.RP2040 and ESP32 are unaffected (GP4->4, GPIO21->21 are correct).## ImpactAll STM32 Arduino headers have wrong pin values firmware won't compile or will map to wrong physical pins.## Fixemit_arduino.py should emit MCU-appropriate pin literals: bare numbers for RP2040/ESP32, PA_10 format for STM32.</issue_description>

<agent_instructions>This might have been fixed in another code update I did where I moved the pin mappings around. Check to see. If it is still an issue, fix it.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


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

@zcohen-nerd zcohen-nerd marked this pull request as ready for review February 27, 2026 00:32
Copilot AI review requested due to automatic review settings February 27, 2026 00:32
Copy link

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.

Copilot wasn't able to review any files in this pull request.

@zcohen-nerd zcohen-nerd merged commit 556fca4 into main Feb 27, 2026
1 of 2 checks passed
Copilot AI changed the title [WIP] Fix #define values for STM32 in emit_arduino.py Confirm STM32 Arduino pin literals already emit PA_10 format Feb 27, 2026
Copilot stopped work on behalf of zcohen-nerd due to an error February 27, 2026 00:32
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.

Arduino #define values incorrect for STM32 MCU

3 participants