Skip to content

Commit 725146d

Browse files
authored
Fix pin attachInterrupt(digitalPinToInterrupt(48)) on all S3 based SOCs (espressif#8600)
* Test GPIO number in attachInterrupt() * Fixes S3 GPIO48 in digitalPinToInterrupt() * Changes test of GPIO number in attachInterrupt() * Fixes NUM_DIGITAL_PINS in Adafruit board * Fixes GPIO48 in Edgebox-ESP-100 board
1 parent 8e2af4b commit 725146d

File tree

50 files changed

+54
-51
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+54
-51
lines changed

cores/esp32/esp32-hal-gpio.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ extern void __attachInterruptFunctionalArg(uint8_t pin, voidFuncPtrArg userFunc,
167167
{
168168
static bool interrupt_initialized = false;
169169

170+
// makes sure that pin -1 (255) will never work -- this follows Arduino standard
171+
if (pin >= SOC_GPIO_PIN_COUNT) return;
172+
170173
if(!interrupt_initialized) {
171174
esp_err_t err = gpio_install_isr_service((int)ARDUINO_ISR_FLAG);
172175
interrupt_initialized = (err == ESP_OK) || (err == ESP_ERR_INVALID_STATE);

variants/Bee_Data_Logger/pins_arduino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define NUM_ANALOG_INPUTS 7
1515

1616
#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
17-
#define digitalPinToInterrupt(p) (((p)<48)?(p):-1)
17+
#define digitalPinToInterrupt(p) (((p)<49)?(p):-1)
1818
#define digitalPinHasPWM(p) (p < 46)
1919

2020
static const uint8_t TX = 43;

variants/Bee_Motion/pins_arduino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define NUM_ANALOG_INPUTS 12
1515

1616
#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
17-
#define digitalPinToInterrupt(p) (((p)<48)?(p):-1)
17+
#define digitalPinToInterrupt(p) (((p)<49)?(p):-1)
1818
#define digitalPinHasPWM(p) (p < 46)
1919

2020
static const uint8_t TX = 43;

variants/Bee_Motion_S3/pins_arduino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define NUM_ANALOG_INPUTS 11
1515

1616
#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
17-
#define digitalPinToInterrupt(p) (((p)<48)?(p):-1)
17+
#define digitalPinToInterrupt(p) (((p)<49)?(p):-1)
1818
#define digitalPinHasPWM(p) (p < 46)
1919

2020
static const uint8_t TX = 43;

variants/Bee_S3/pins_arduino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define NUM_ANALOG_INPUTS 8
1515

1616
#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
17-
#define digitalPinToInterrupt(p) (((p)<48)?(p):-1)
17+
#define digitalPinToInterrupt(p) (((p)<49)?(p):-1)
1818
#define digitalPinHasPWM(p) (p < 46)
1919

2020
static const uint8_t TX = 43;

variants/Edgebox-ESP-100/pins_arduino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#define NUM_ANALOG_INPUTS 2
99

1010
#define analogInputToDigitalPin(p) (((p)<2)?(analogChannelToDigitalPin(p)):-1)
11-
#define digitalPinToInterrupt(p) (((p)<34)?(p):-1)
11+
#define digitalPinToInterrupt(p) (((p)<49)?(p):-1)
1212
#define digitalPinHasPWM(p) (p < 34)
1313

1414
//Programming and Debugging Port

variants/Nebula_S3/pins_arduino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define NUM_ANALOG_INPUTS 6
1212

1313
#define analogInputToDigitalPin(p) (((p)<6)?(analogChannelToDigitalPin(p)):-1)
14-
#define digitalPinToInterrupt(p) (((p)<20)?(p):-1)
14+
#define digitalPinToInterrupt(p) (((p)<49)?(p):-1)
1515
#define digitalPinHasPWM(p) (p < 20)
1616

1717

variants/XIAO_ESP32S3/pins_arduino.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#define USB_VID 0x2886
88
#define USB_PID 0x0056
99

10-
#define EXTERNAL_NUM_INTERRUPTS 46
11-
#define NUM_DIGITAL_PINS 48
10+
#define EXTERNAL_NUM_INTERRUPTS 49
11+
#define NUM_DIGITAL_PINS 49
1212
#define NUM_ANALOG_INPUTS 20
1313

1414
static const uint8_t LED_BUILTIN = 21;

variants/adafruit_feather_esp32s3/pins_arduino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define NUM_ANALOG_INPUTS 20
1515

1616
#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
17-
#define digitalPinToInterrupt(p) (((p)<48)?(p):-1)
17+
#define digitalPinToInterrupt(p) (((p)<49)?(p):-1)
1818
#define digitalPinHasPWM(p) (p < 46)
1919

2020
#define LED_BUILTIN 13

variants/adafruit_feather_esp32s3_nopsram/pins_arduino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define NUM_ANALOG_INPUTS 20
1515

1616
#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
17-
#define digitalPinToInterrupt(p) (((p)<48)?(p):-1)
17+
#define digitalPinToInterrupt(p) (((p)<49)?(p):-1)
1818
#define digitalPinHasPWM(p) (p < 46)
1919

2020
#define LED_BUILTIN 13

0 commit comments

Comments
 (0)