Skip to content

Commit

Permalink
Merge branch 'espressif:release/v2.x' into release/v2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 authored Aug 5, 2023
2 parents 4572ccf + 369e974 commit 303fc14
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cores/esp32/io_pin_remap.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int8_t digitalPinFromGPIONumber(int8_t gpioPin);
#define pulseInLong(pin, state, timeout) pulseInLong(digitalPinToGPIONumber(pin), state, timeout)
#define pulseIn(pin, state, timeout) pulseIn(digitalPinToGPIONumber(pin), state, timeout)
#define noTone(_pin) noTone(digitalPinToGPIONumber(_pin))
#define tone(_pin, frequency, duration) tone(digitalPinToGPIONumber(_pin), frequency, duration)
#define tone(_pin, args...) tone(digitalPinToGPIONumber(_pin), args)

// cores/esp32/esp32-hal.h
#define analogGetChannel(pin) analogGetChannel(digitalPinToGPIONumber(pin))
Expand Down
9 changes: 7 additions & 2 deletions tools/platformio-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ def add_tinyuf2_extra_image():
# Target: Build Core Library
#

# Set -DARDUINO_CORE_BUILD only for the core library
corelib_env = env.Clone()
corelib_env.Append(CPPDEFINES=["ARDUINO_CORE_BUILD"])

libs = []

variants_dir = join(FRAMEWORK_DIR, "variants")
Expand All @@ -180,13 +184,14 @@ def add_tinyuf2_extra_image():

if "build.variant" in board_config:
env.Append(CPPPATH=[join(variants_dir, board_config.get("build.variant"))])
env.BuildSources(
corelib_env.Append(CPPPATH=[join(variants_dir, board_config.get("build.variant"))])
corelib_env.BuildSources(
join("$BUILD_DIR", "FrameworkArduinoVariant"),
join(variants_dir, board_config.get("build.variant")),
)

libs.append(
env.BuildLibrary(
corelib_env.BuildLibrary(
join("$BUILD_DIR", "FrameworkArduino"),
join(FRAMEWORK_DIR, "cores", board_config.get("build.core")),
)
Expand Down
18 changes: 17 additions & 1 deletion variants/arduino_nano_nora/io_pin_remap.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
#ifndef BOARD_USES_HW_GPIO_NUMBERS
#if defined(BOARD_HAS_PIN_REMAP) && !defined(ARDUINO_CORE_BUILD)
// -DARDUINO_CORE_BUILD must be set for core files only, to avoid extra
// remapping steps that would create all sorts of issues in the core.
// Removing -DBOARD_HAS_PIN_REMAP at least does correctly restore the
// use of GPIO numbers in the API.
#error This build system is not supported. Please rebuild without BOARD_HAS_PIN_REMAP.
#endif

#if !defined(BOARD_HAS_PIN_REMAP)
// This board uses pin mapping but the build system has disabled it
#warning The build system forces the Arduino API to use GPIO numbers on a board that has custom pin mapping.
#elif defined(BOARD_USES_HW_GPIO_NUMBERS)
// The user has chosen to disable pin mappin.
#warning The Arduino API will use GPIO numbers for this build.
#endif

#if defined(BOARD_HAS_PIN_REMAP) && !defined(BOARD_USES_HW_GPIO_NUMBERS)

#include "Arduino.h"

Expand Down

0 comments on commit 303fc14

Please sign in to comment.