Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d0635d0

Browse filesBrowse files
pillo79me-no-dev
authored andcommitted
io_pin_remap fixes for the Arduino Nano ESP32 (espressif#8489)
* io_pin_remap: fix tone() function mapping declaration Since tone() can have either 2 or 3 parameters, pass any argument after the first to the actual function implementation. * io_pin_remap: add sanity checks to the core build Building with BOARD_HAS_PIN_REMAP but without setting ARDUINO_CORE_BUILD on core files is absolutely forbidden, as this would lead to multiple pin remappings being silently applied on the same numbers. Also advise the user when, on a board that has a custom pin mapping, - the core is being built without pin mapping support, or - the user explictly asked to use GPIO pin numbers.
1 parent 55d3aa1 commit d0635d0
Copy full SHA for d0635d0

File tree

2 files changed

+18
-2
lines changed
Filter options

2 files changed

+18
-2
lines changed

‎cores/esp32/io_pin_remap.h

Copy file name to clipboardExpand all lines: cores/esp32/io_pin_remap.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ int8_t digitalPinFromGPIONumber(int8_t gpioPin);
1818
#define pulseInLong(pin, state, timeout) pulseInLong(digitalPinToGPIONumber(pin), state, timeout)
1919
#define pulseIn(pin, state, timeout) pulseIn(digitalPinToGPIONumber(pin), state, timeout)
2020
#define noTone(_pin) noTone(digitalPinToGPIONumber(_pin))
21-
#define tone(_pin, frequency, duration) tone(digitalPinToGPIONumber(_pin), frequency, duration)
21+
#define tone(_pin, args...) tone(digitalPinToGPIONumber(_pin), args)
2222

2323
// cores/esp32/esp32-hal.h
2424
#define analogGetChannel(pin) analogGetChannel(digitalPinToGPIONumber(pin))

‎variants/arduino_nano_nora/io_pin_remap.cpp

Copy file name to clipboardExpand all lines: variants/arduino_nano_nora/io_pin_remap.cpp
+17-1Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
#ifndef BOARD_USES_HW_GPIO_NUMBERS
1+
#if defined(BOARD_HAS_PIN_REMAP) && !defined(ARDUINO_CORE_BUILD)
2+
// -DARDUINO_CORE_BUILD must be set for core files only, to avoid extra
3+
// remapping steps that would create all sorts of issues in the core.
4+
// Removing -DBOARD_HAS_PIN_REMAP at least does correctly restore the
5+
// use of GPIO numbers in the API.
6+
#error This build system is not supported. Please rebuild without BOARD_HAS_PIN_REMAP.
7+
#endif
8+
9+
#if !defined(BOARD_HAS_PIN_REMAP)
10+
// This board uses pin mapping but the build system has disabled it
11+
#warning The build system forces the Arduino API to use GPIO numbers on a board that has custom pin mapping.
12+
#elif defined(BOARD_USES_HW_GPIO_NUMBERS)
13+
// The user has chosen to disable pin mappin.
14+
#warning The Arduino API will use GPIO numbers for this build.
15+
#endif
16+
17+
#if defined(BOARD_HAS_PIN_REMAP) && !defined(BOARD_USES_HW_GPIO_NUMBERS)
218

319
#include "Arduino.h"
420

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.