Skip to content

Commit 725146d

Browse files
authoredSep 5, 2023
Fix pin attachInterrupt(digitalPinToInterrupt(48)) on all S3 based SOCs (#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

+3
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

+1-1
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;

0 commit comments

Comments
 (0)
Please sign in to comment.