espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.75k stars 7.44k forks source link

digitalPinToInterrupt: fix double pin remapping on 2.x cores #10372

Closed pillo79 closed 2 months ago

pillo79 commented 2 months ago

Description of Change

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.

Related links

Fixes #10367 on 2.x (legacy) cores. See also #10373 for the same fix on 3.x (current) cores.