Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 55bd1d5

Browse files
authoredSep 25, 2024
digitalPinToInterrupt: fix double pin remapping (#10373)
The digitalPinToInterrupt() macro currently remaps the pin number to the GPIO number. This is not necessary, as most users will then use the returned value in attachInterrupt() or other similar API functions, which already perform the same remapping. The first half of the macro (the condition) does indeed require the remapping to ensure the check operates on GPIO numbers. Fixes #10367.
1 parent ae052f4 commit 55bd1d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎cores/esp32/Arduino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
#endif
143143
#define EXTERNAL_NUM_INTERRUPTS NUM_DIGITAL_PINS // All GPIOs
144144
#define analogInputToDigitalPin(p) (((p) < NUM_ANALOG_INPUTS) ? (analogChannelToDigitalPin(p)) : -1)
145-
#define digitalPinToInterrupt(p) ((((uint8_t)digitalPinToGPIONumber(p)) < NUM_DIGITAL_PINS) ? digitalPinToGPIONumber(p) : NOT_AN_INTERRUPT)
145+
#define digitalPinToInterrupt(p) ((((uint8_t)digitalPinToGPIONumber(p)) < NUM_DIGITAL_PINS) ? (p) : NOT_AN_INTERRUPT)
146146
#define digitalPinHasPWM(p) (((uint8_t)digitalPinToGPIONumber(p)) < NUM_DIGITAL_PINS)
147147

148148
typedef bool boolean;

0 commit comments

Comments
 (0)
Please sign in to comment.