Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nano ESP32: add pin numbering option #8565

Merged

Conversation

pillo79
Copy link
Contributor

@pillo79 pillo79 commented Aug 25, 2023

Description of Change

This addresses issues faced by some Arduino customers when trying to use third party libraries designed for ESP32 targets with no pin remapping.

This changeset introduces a Pin Numbering menu option and enables it for the Arduino Nano ESP32 only. The default keeps the current Arduino pin numbered API, but when users select the "By GPIO number" option, the API will revert to the ESP32 common GPIO-based numbering for maximum compatibility with existing projects and libraries.

61d867b also fixes some compile time issues when some specific functions are called while pin remapping is enabled.

Tests scenarios

Tested with the Arduino Nano ESP32. Sketches where pins are used by symbol ("D6") access the same physical pins regardless of menu selection, even if the symbols have different values (Arduino pin number or GPIO number).

Related links

One example of broken library is ESP32Servo which reimplements core functions such as analogWrite() in library files, confusing the pin remapping semantics.

- FunctionalInterrupt.h: prevent macro expansion in declaration
- io_pin_remap.h: fix remaining pin-remapped functions whose API
  allow a variable number of parameters
@pillo79 pillo79 marked this pull request as draft August 25, 2023 16:16
@VojtechBartoska VojtechBartoska added this to the 2.0.12 milestone Aug 28, 2023
@pillo79 pillo79 marked this pull request as ready for review August 29, 2023 12:26
@me-no-dev me-no-dev merged commit 8c7841c into espressif:release/v2.x Aug 29, 2023
42 checks passed
me-no-dev pushed a commit that referenced this pull request Sep 4, 2023
* io_pin_remap: additional bugfixes

- FunctionalInterrupt.h: prevent macro expansion in declaration
- io_pin_remap.h: fix remaining pin-remapped functions whose API
  allow a variable number of parameters

* Nano ESP32: make GPIO matrix reset robust to pin mode choice

* Nano ESP32: add backwards-compatible pin definitions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants