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

feat(esp32-s3): Add support for auto-baudrate-detection on S3 #7782

Closed
wants to merge 100 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
18c0a6c
Update toolchains and openocd for ESP-IDF v4.4.4
me-no-dev Feb 8, 2023
0ee74ee
Update get.py to support Apple ARM64
me-no-dev Feb 8, 2023
e531341
Update package version
me-no-dev Feb 8, 2023
1376ee0
Update ESP-IDF libs to v4.4.4
me-no-dev Feb 8, 2023
997542c
Fix compilation issue caused by ESP-Insights
me-no-dev Feb 9, 2023
3324aff
Update esptool to v4.4
me-no-dev Feb 9, 2023
8a458d1
Update esptool to v4.5
me-no-dev Feb 13, 2023
1ca741e
Merge branch 'master' into release/v2.x
me-no-dev Feb 15, 2023
0da8ecb
Merge branch 'master' into release/v2.x
me-no-dev Feb 20, 2023
213f976
Merge branch 'master' into release/v2.x
me-no-dev Feb 20, 2023
d6a850b
Update package_esp32_index.template.json
me-no-dev Feb 20, 2023
50269f6
Update esptool to v4.5.1
me-no-dev Mar 1, 2023
a069764
Add setMode function HardwareSerial.c to set the esp32 uart mode for …
jamesarm97 Mar 31, 2023
93903fc
Fix the F_CPU frequency definition for the ESP32-S3 in esp32-hal.h (#…
devrim-oguz Mar 31, 2023
e7d3a2f
Merge branch 'master' into release/v2.x
me-no-dev Mar 31, 2023
540ab86
Merge branch 'master' into release/v2.x
me-no-dev Apr 7, 2023
8fca365
Add support for esp-elf-gdb
me-no-dev Apr 7, 2023
2d7218b
WFG Crashfix (#8043)
mrengineer7777 Apr 10, 2023
2ff2b43
Update RainMaker and components
me-no-dev Apr 10, 2023
788a4ca
Merge branch 'master' into release/v2.x
me-no-dev Apr 10, 2023
483bebf
WiFiUDF Low memory fix (#8065)
mrengineer7777 Apr 11, 2023
bdbfc45
Merge branch 'master' into release/v2.x
me-no-dev Apr 18, 2023
16cee61
Enable DFU
me-no-dev Apr 19, 2023
a115594
Add required callbacks for TinyUSB DFU
me-no-dev Apr 19, 2023
71113c3
Merge branch 'master' into release/v2.x
me-no-dev Apr 19, 2023
d3254f7
Update version to 2.0.8
me-no-dev Apr 20, 2023
f42cba9
Merge branch 'master' into release/v2.x
me-no-dev May 3, 2023
f89df42
BugFix FlashStringHelper Macros (#8143)
mrengineer7777 May 3, 2023
362a81b
Merge branch 'master' into release/v2.x
me-no-dev May 3, 2023
3670e2b
Update version to 2.0.9
me-no-dev May 3, 2023
447f6db
Merge branch 'master' into release/v2.x
me-no-dev May 31, 2023
be40b3b
Update ESP-IDF to v4.4.5
me-no-dev Jun 12, 2023
cc3590c
Remove insights component since it's provided by RainMaker
me-no-dev Jun 12, 2023
ac814ee
Update core version to 2.0.10
me-no-dev Jun 12, 2023
0f51c88
Merge branch 'master' into release/v2.x
me-no-dev Jun 29, 2023
1577701
Merge branch 'master' into release/v2.x
me-no-dev Jul 17, 2023
9b4622d
Add Arduino Nano ESP32 target (#8417)
facchinm Jul 17, 2023
4c27949
Fix escaping issues in 2.0.10 (#8433)
pillo79 Jul 20, 2023
e814feb
Merge branch 'master' into release/v2.x
me-no-dev Jul 24, 2023
ae9dae4
Update version to 2.0.11
me-no-dev Jul 24, 2023
ebb4123
Merge branch 'master' into release/v2.x
me-no-dev Aug 4, 2023
369e974
io_pin_remap fixes for the Arduino Nano ESP32 (#8489)
pillo79 Aug 4, 2023
bd40349
fix attach pin for S3
P-R-O-C-H-Y Aug 11, 2023
7d607bf
Merge pull request #8512 from P-R-O-C-H-Y/SPI_SPI-pins_fix
me-no-dev Aug 12, 2023
9e8b5ac
I2S - Revert espressif/esp-idf@73ca054 to fix I2S crackling (#8583)
lucasssvaz Aug 29, 2023
8c7841c
Nano ESP32: add pin numbering option (#8565)
pillo79 Aug 29, 2023
43b700a
Nano ESP32 file system option (#8566)
pillo79 Aug 29, 2023
738be45
Nano ESP32: add debug support (#8567)
pillo79 Aug 30, 2023
9817b09
Nano ESP32: fix digital, analog and GPIO pin counts (#8586)
pillo79 Aug 30, 2023
165595b
Update toolchains and openocd for ESP-IDF v4.4.4
me-no-dev Feb 8, 2023
91420a3
Update get.py to support Apple ARM64
me-no-dev Feb 8, 2023
e8906a2
Update package version
me-no-dev Feb 8, 2023
a86c752
Update ESP-IDF libs to v4.4.4
me-no-dev Feb 8, 2023
7032aea
Fix compilation issue caused by ESP-Insights
me-no-dev Feb 9, 2023
790aeca
Update esptool to v4.4
me-no-dev Feb 9, 2023
ccbd88a
Update esptool to v4.5
me-no-dev Feb 13, 2023
8c78f47
Update package_esp32_index.template.json
me-no-dev Feb 20, 2023
a5b0839
Update esptool to v4.5.1
me-no-dev Mar 1, 2023
aa1f60e
Add setMode function HardwareSerial.c to set the esp32 uart mode for …
jamesarm97 Mar 31, 2023
13f15e9
Add support for esp-elf-gdb
me-no-dev Apr 7, 2023
32f38f0
WFG Crashfix (#8043)
mrengineer7777 Apr 10, 2023
5ebe01f
Update RainMaker and components
me-no-dev Apr 10, 2023
3bf1e07
WiFiUDF Low memory fix (#8065)
mrengineer7777 Apr 11, 2023
8ab01f5
Enable DFU
me-no-dev Apr 19, 2023
d56406b
Add required callbacks for TinyUSB DFU
me-no-dev Apr 19, 2023
91974e8
Update version to 2.0.8
me-no-dev Apr 20, 2023
6b2dbad
BugFix FlashStringHelper Macros (#8143)
mrengineer7777 May 3, 2023
0ce7408
Update version to 2.0.9
me-no-dev May 3, 2023
45546e7
Update ESP-IDF to v4.4.5
me-no-dev Jun 12, 2023
9fc32dc
Remove insights component since it's provided by RainMaker
me-no-dev Jun 12, 2023
88dc590
Update core version to 2.0.10
me-no-dev Jun 12, 2023
8105c75
Add Arduino Nano ESP32 target (#8417)
facchinm Jul 17, 2023
9fdcb6e
Fix escaping issues in 2.0.10 (#8433)
pillo79 Jul 20, 2023
55d3aa1
Update version to 2.0.11
me-no-dev Jul 24, 2023
d0635d0
io_pin_remap fixes for the Arduino Nano ESP32 (#8489)
pillo79 Aug 4, 2023
1a209a0
fix attach pin for S3
P-R-O-C-H-Y Aug 11, 2023
754635a
I2S - Revert espressif/esp-idf@73ca054 to fix I2S crackling (#8583)
lucasssvaz Aug 29, 2023
fd30949
Nano ESP32: add pin numbering option (#8565)
pillo79 Aug 29, 2023
58761be
Nano ESP32 file system option (#8566)
pillo79 Aug 29, 2023
7d1dd85
Nano ESP32: add debug support (#8567)
pillo79 Aug 30, 2023
8e2af4b
Nano ESP32: fix digital, analog and GPIO pin counts (#8586)
pillo79 Aug 30, 2023
725146d
Fix pin attachInterrupt(digitalPinToInterrupt(48)) on all S3 based SO…
SuGlider Sep 5, 2023
fe70e9b
Merge branch 'release/v2.x' of https://github.com/espressif/arduino-e…
P-R-O-C-H-Y Sep 5, 2023
d048e21
Uart detach 2.0.13 (#8629)
SuGlider Sep 13, 2023
fff900d
Disable Ethernet library if CONFIG_ETH_ENABLED not defined in sdkconf…
arkhipenko Sep 13, 2023
fc26b5b
Set ref to 2.0.13 (#8615)
SuGlider Sep 13, 2023
b65d1c7
Merge branch 'master' into release/v2.x
me-no-dev Sep 13, 2023
6dfcdef
HTTPClient - Fix case sensitiveness for header keys (#8632)
lucasssvaz Sep 15, 2023
e3cbd23
Merge branch 'master' into release/v2.x
me-no-dev Sep 15, 2023
16668c7
Merge branch 'master' into release/v2.x
me-no-dev Sep 15, 2023
d943db6
Update ESP-IDF to v4.4.6 (with I2S Rollback) (#8701)
me-no-dev Oct 4, 2023
d8706e6
Update core version to 2.0.14
me-no-dev Oct 4, 2023
93d8ad2
Merge branch 'master' into release/v2.x
me-no-dev Oct 4, 2023
44da992
Merge branch 'master' into release/v2.x
me-no-dev Oct 4, 2023
302f676
feat(esp32-s3): Add support for auto-baudrate-detection on S3 variant…
imwhocodes Feb 1, 2023
0f17f7d
Merge commit '44da992b' (tagged version 2.0.14) into S3-autobaud
imwhocodes Feb 9, 2024
3d82a64
WIP, need cleaning
imwhocodes Feb 9, 2024
612149e
stress/fuzzing testing
imwhocodes Feb 9, 2024
29288a0
searching for failure of detection on 3686400 bauds
imwhocodes Feb 10, 2024
bf39067
avoid buffer overflow in debug
imwhocodes Feb 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
33 changes: 30 additions & 3 deletions .github/scripts/on-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ echo "Event: $GITHUB_EVENT_NAME, Repo: $GITHUB_REPOSITORY, Path: $GITHUB_WORKSPA
echo "Action: $action, Branch: $RELEASE_BRANCH, ID: $RELEASE_ID"
echo "Tag: $RELEASE_TAG, Draft: $draft, Pre-Release: $RELEASE_PRE"

# Try extracting something like a JSON with a "boards" array/element and "vendor" fields
BOARDS=`echo $RELEASE_BODY | grep -Pzo '(?s){.*}' | jq -r '.boards[]? // .boards? // empty' | xargs echo -n 2>/dev/null`
VENDOR=`echo $RELEASE_BODY | grep -Pzo '(?s){.*}' | jq -r '.vendor? // empty' | xargs echo -n 2>/dev/null`
if ! [ -z "${BOARDS}" ]; then echo "Releasing board(s): $BOARDS" ; fi
if ! [ -z "${VENDOR}" ]; then echo "Setting packager: $VENDOR" ; fi

function get_file_size(){
local file="$1"
if [[ "$OSTYPE" == "darwin"* ]]; then
Expand Down Expand Up @@ -171,12 +177,26 @@ mkdir -p "$PKG_DIR/tools"

# Copy all core files to the package folder
echo "Copying files for packaging ..."
cp -f "$GITHUB_WORKSPACE/boards.txt" "$PKG_DIR/"
if [ -z "${BOARDS}" ]; then
# Copy all variants
cp -f "$GITHUB_WORKSPACE/boards.txt" "$PKG_DIR/"
cp -Rf "$GITHUB_WORKSPACE/variants" "$PKG_DIR/"
else
# Remove all entries not starting with any board code or "menu." from boards.txt
cat "$GITHUB_WORKSPACE/boards.txt" | grep "^menu\." > "$PKG_DIR/boards.txt"
for board in ${BOARDS} ; do
cat "$GITHUB_WORKSPACE/boards.txt" | grep "^${board}\." >> "$PKG_DIR/boards.txt"
done
# Copy only relevant variant files
mkdir "$PKG_DIR/variants/"
for variant in `cat ${PKG_DIR}/boards.txt | grep "\.variant=" | cut -d= -f2` ; do
cp -Rf "$GITHUB_WORKSPACE/variants/${variant}" "$PKG_DIR/variants/"
done
fi
cp -f "$GITHUB_WORKSPACE/package.json" "$PKG_DIR/"
cp -f "$GITHUB_WORKSPACE/programmers.txt" "$PKG_DIR/"
cp -Rf "$GITHUB_WORKSPACE/cores" "$PKG_DIR/"
cp -Rf "$GITHUB_WORKSPACE/libraries" "$PKG_DIR/"
cp -Rf "$GITHUB_WORKSPACE/variants" "$PKG_DIR/"
cp -f "$GITHUB_WORKSPACE/tools/espota.exe" "$PKG_DIR/tools/"
cp -f "$GITHUB_WORKSPACE/tools/espota.py" "$PKG_DIR/tools/"
cp -f "$GITHUB_WORKSPACE/tools/gen_esp32part.py" "$PKG_DIR/tools/"
Expand All @@ -196,17 +216,24 @@ find "$PKG_DIR" -name '*.git*' -type f -delete
# Replace tools locations in platform.txt
echo "Generating platform.txt..."
cat "$GITHUB_WORKSPACE/platform.txt" | \
sed "s/version=.*/version=$ver$extent/g" | \
sed "s/version=.*/version=$RELEASE_TAG/g" | \
sed 's/tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32-elf/tools.xtensa-esp32-elf-gcc.path=\{runtime.tools.xtensa-esp32-elf-gcc.path\}/g' | \
sed 's/tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s2-elf/tools.xtensa-esp32s2-elf-gcc.path=\{runtime.tools.xtensa-esp32s2-elf-gcc.path\}/g' | \
sed 's/tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s3-elf/tools.xtensa-esp32s3-elf-gcc.path=\{runtime.tools.xtensa-esp32s3-elf-gcc.path\}/g' | \
sed 's/tools.xtensa-esp-elf-gdb.path={runtime.platform.path}\/tools\/xtensa-esp-elf-gdb/tools.xtensa-esp-elf-gdb.path=\{runtime.tools.xtensa-esp-elf-gdb.path\}/g' | \
sed 's/tools.riscv32-esp-elf-gcc.path={runtime.platform.path}\/tools\/riscv32-esp-elf/tools.riscv32-esp-elf-gcc.path=\{runtime.tools.riscv32-esp-elf-gcc.path\}/g' | \
sed 's/tools.riscv32-esp-elf-gdb.path={runtime.platform.path}\/tools\/riscv32-esp-elf-gdb/tools.riscv32-esp-elf-gdb.path=\{runtime.tools.riscv32-esp-elf-gdb.path\}/g' | \
sed 's/tools.esptool_py.path={runtime.platform.path}\/tools\/esptool/tools.esptool_py.path=\{runtime.tools.esptool_py.path\}/g' | \
sed 's/debug.server.openocd.path={runtime.platform.path}\/tools\/openocd-esp32\/bin\/openocd/debug.server.openocd.path=\{runtime.tools.openocd-esp32.path\}\/bin\/openocd/g' | \
sed 's/debug.server.openocd.scripts_dir={runtime.platform.path}\/tools\/openocd-esp32\/share\/openocd\/scripts\//debug.server.openocd.scripts_dir=\{runtime.tools.openocd-esp32.path\}\/share\/openocd\/scripts\//g' | \
sed 's/debug.server.openocd.scripts_dir.windows={runtime.platform.path}\\tools\\openocd-esp32\\share\\openocd\\scripts\\/debug.server.openocd.scripts_dir.windows=\{runtime.tools.openocd-esp32.path\}\\share\\openocd\\scripts\\/g' \
> "$PKG_DIR/platform.txt"

if ! [ -z ${VENDOR} ]; then
# Append vendor name to platform.txt to create a separate section
sed -i "/^name=.*/s/$/ ($VENDOR)/" "$PKG_DIR/platform.txt"
fi

# Add header with version information
echo "Generating core_version.h ..."
ver_define=`echo $RELEASE_TAG | tr "[:lower:].\055" "[:upper:]_"`
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
tools/xtensa-esp32-elf
tools/xtensa-esp32s2-elf
tools/xtensa-esp32s3-elf
tools/xtensa-esp-elf-gdb
tools/riscv32-esp-elf
tools/riscv32-esp-elf-gdb
tools/dist
tools/esptool
tools/esptool.exe
tools/mkspiffs
tools/mklittlefs
tools/mkfatfs.exe
tools/openocd-esp32
tools/esp32-arduino-libs

# Ignore editor backup files and macOS system metadata
.DS_Store
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ endfunction()

maybe_add_component(esp-dsp)

if(CONFIG_ESP_INSIGHTS_ENABLED)
maybe_add_component(esp_insights)
endif()
if(CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK)
maybe_add_component(esp_rainmaker)
maybe_add_component(qrcode)
Expand Down
69 changes: 69 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ menu.EventsCore=Events Run On
menu.MemoryType=Memory Type
menu.EraseFlash=Erase All Flash Before Sketch Upload
menu.JTAGAdapter=JTAG Adapter
menu.PinNumbers=Pin Numbering

# Custom options
menu.Revision=Board Revision
Expand Down Expand Up @@ -25986,6 +25987,74 @@ namino_arancio.menu.EraseFlash.all.upload.erase_cmd=-e

##############################################################

nano_nora.name=Arduino Nano ESP32
nano_nora.vid.0=0x2341
nano_nora.pid.0=0x0070
nano_nora.upload_port.0.vid=0x2341
nano_nora.upload_port.0.pid=0x0070

nano_nora.bootloader.tool=esptool_py
nano_nora.bootloader.tool.default=esptool_py

nano_nora.upload.tool=dfu-util
nano_nora.upload.tool.default=dfu-util
nano_nora.upload.tool.network=esp_ota
nano_nora.upload.protocol=serial
nano_nora.upload.maximum_size=3145728
nano_nora.upload.maximum_data_size=327680
nano_nora.upload.use_1200bps_touch=false
nano_nora.upload.wait_for_upload_port=false

nano_nora.serial.disableDTR=false
nano_nora.serial.disableRTS=false

nano_nora.build.tarch=xtensa
nano_nora.build.bootloader_addr=0x0
nano_nora.build.target=esp32s3
nano_nora.build.mcu=esp32s3
nano_nora.build.core=esp32
nano_nora.build.variant=arduino_nano_nora
nano_nora.build.board=NANO_ESP32
nano_nora.build.code_debug=0

nano_nora.build.usb_mode=0
nano_nora.build.cdc_on_boot=1
nano_nora.build.msc_on_boot=0
nano_nora.build.dfu_on_boot=1
nano_nora.build.f_cpu=240000000L
nano_nora.build.flash_size=16MB
nano_nora.build.flash_freq=80m
nano_nora.build.flash_mode=dio
nano_nora.build.boot=qio
nano_nora.build.boot_freq=80m
nano_nora.build.partitions=app3M_fat9M_fact512k_16MB
nano_nora.build.defines=-DBOARD_HAS_PIN_REMAP {build.disable_pin_remap} -DBOARD_HAS_PSRAM '-DUSB_MANUFACTURER="Arduino"' '-DUSB_PRODUCT="Nano ESP32"'
nano_nora.build.loop_core=-DARDUINO_RUNNING_CORE=1
nano_nora.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1
nano_nora.build.psram_type=opi
nano_nora.build.memory_type={build.boot}_{build.psram_type}
nano_nora.build.disable_pin_remap=

nano_nora.tools.esptool_py.program.pattern_args=--chip {build.mcu} --port "{serial.port}" --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size {build.flash_size} {build.bootloader_addr} "{build.path}/{build.project_name}.bootloader.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0xf70000 "{build.variant.path}/extra/nora_recovery/nora_recovery.ino.bin" 0x10000 "{build.path}/{build.project_name}.bin"
nano_nora.tools.esptool_py.erase.pattern_args=--chip {build.mcu} --port "{serial.port}" --before default_reset --after hard_reset erase_flash

nano_nora.menu.PartitionScheme.default=With FAT partition (default)
nano_nora.menu.PartitionScheme.spiffs=With SPIFFS partition (advanced)
nano_nora.menu.PartitionScheme.spiffs.build.partitions=app3M_spiffs9M_fact512k_16MB

nano_nora.menu.PinNumbers.default=By Arduino pin (default)
nano_nora.menu.PinNumbers.byGPIONumber=By GPIO number (legacy)
nano_nora.menu.PinNumbers.byGPIONumber.build.disable_pin_remap=-DBOARD_USES_HW_GPIO_NUMBERS

nano_nora.menu.USBMode.default=Normal mode (TinyUSB)
nano_nora.menu.USBMode.hwcdc=Debug mode (Hardware CDC)
nano_nora.menu.USBMode.hwcdc.build.usb_mode=1
nano_nora.menu.USBMode.hwcdc.build.copy_jtag_files=1
nano_nora.menu.USBMode.hwcdc.build.openocdscript=esp32s3-builtin.cfg
nano_nora.menu.USBMode.hwcdc.build.debugconfig=esp32s3-arduino.json

##############################################################

ioxesp32.name=IOXESP32

ioxesp32.bootloader.tool=esptool_py
Expand Down
7 changes: 4 additions & 3 deletions cores/esp32/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@
#define analogInPinToBit(P) (P)
#if SOC_GPIO_PIN_COUNT <= 32
#define digitalPinToPort(pin) (0)
#define digitalPinToBitMask(pin) (1UL << (pin))
#define digitalPinToBitMask(pin) (1UL << digitalPinToGPIONumber(pin))
#define portOutputRegister(port) ((volatile uint32_t*)GPIO_OUT_REG)
#define portInputRegister(port) ((volatile uint32_t*)GPIO_IN_REG)
#define portModeRegister(port) ((volatile uint32_t*)GPIO_ENABLE_REG)
#elif SOC_GPIO_PIN_COUNT <= 64
#define digitalPinToPort(pin) (((pin)>31)?1:0)
#define digitalPinToBitMask(pin) (1UL << (((pin)>31)?((pin)-32):(pin)))
#define digitalPinToPort(pin) ((digitalPinToGPIONumber(pin)>31)?1:0)
#define digitalPinToBitMask(pin) (1UL << (digitalPinToGPIONumber(pin)&31))
#define portOutputRegister(port) ((volatile uint32_t*)((port)?GPIO_OUT1_REG:GPIO_OUT_REG))
#define portInputRegister(port) ((volatile uint32_t*)((port)?GPIO_IN1_REG:GPIO_IN_REG))
#define portModeRegister(port) ((volatile uint32_t*)((port)?GPIO_ENABLE1_REG:GPIO_ENABLE_REG))
Expand Down Expand Up @@ -220,5 +220,6 @@ void noTone(uint8_t _pin);
#endif /* __cplusplus */

#include "pins_arduino.h"
#include "io_pin_remap.h"

#endif /* _ESP32_CORE_ARDUINO_H_ */
2 changes: 1 addition & 1 deletion cores/esp32/FunctionalInterrupt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void ARDUINO_ISR_ATTR interruptFunctional(void* arg)
void attachInterrupt(uint8_t pin, std::function<void(void)> intRoutine, int mode)
{
// use the local interrupt routine which takes the ArgStructure as argument
__attachInterruptFunctionalArg (pin, (voidFuncPtrArg)interruptFunctional, new InterruptArgStructure{intRoutine}, mode, true);
__attachInterruptFunctionalArg (digitalPinToGPIONumber(pin), (voidFuncPtrArg)interruptFunctional, new InterruptArgStructure{intRoutine}, mode, true);
}

extern "C"
Expand Down
7 changes: 4 additions & 3 deletions cores/esp32/FunctionalInterrupt.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
#include <stdint.h>

struct InterruptArgStructure {
std::function<void(void)> interruptFunction;
std::function<void(void)> interruptFunction;
};

void attachInterrupt(uint8_t pin, std::function<void(void)> intRoutine, int mode);

// The extra set of parentheses here prevents macros defined
// in io_pin_remap.h from applying to this declaration.
void (attachInterrupt)(uint8_t pin, std::function<void(void)> intRoutine, int mode);

#endif /* CORE_CORE_FUNCTIONALINTERRUPT_H_ */
Loading