Skip to content

Commit 61d867b

Browse files
committed
io_pin_remap: additional bugfixes
- FunctionalInterrupt.h: prevent macro expansion in declaration - io_pin_remap.h: fix remaining pin-remapped functions whose API allow a variable number of parameters
1 parent 7d607bf commit 61d867b

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Diff for: cores/esp32/FunctionalInterrupt.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
#include <stdint.h>
1313

1414
struct InterruptArgStructure {
15-
std::function<void(void)> interruptFunction;
15+
std::function<void(void)> interruptFunction;
1616
};
1717

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

2122
#endif /* CORE_CORE_FUNCTIONALINTERRUPT_H_ */

Diff for: cores/esp32/io_pin_remap.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77

88
// Pin remapping functions
99
int8_t digitalPinToGPIONumber(int8_t digitalPin);
10-
int8_t digitalPinFromGPIONumber(int8_t gpioPin);
10+
int8_t digitalPinFromGPIONumber(int8_t gpioNumber);
1111

1212
// Apply pin remapping to API only when building libraries and user sketch
1313
#ifndef ARDUINO_CORE_BUILD
1414

1515
// Override APIs requiring pin remapping
1616

1717
// cores/esp32/Arduino.h
18-
#define pulseInLong(pin, state, timeout) pulseInLong(digitalPinToGPIONumber(pin), state, timeout)
19-
#define pulseIn(pin, state, timeout) pulseIn(digitalPinToGPIONumber(pin), state, timeout)
20-
#define noTone(_pin) noTone(digitalPinToGPIONumber(_pin))
21-
#define tone(_pin, args...) tone(digitalPinToGPIONumber(_pin), args)
18+
#define pulseInLong(pin, args...) pulseInLong(digitalPinToGPIONumber(pin), args)
19+
#define pulseIn(pin, args...) pulseIn(digitalPinToGPIONumber(pin), args)
20+
#define noTone(_pin) noTone(digitalPinToGPIONumber(_pin))
21+
#define tone(_pin, args...) tone(digitalPinToGPIONumber(_pin), args)
2222

2323
// cores/esp32/esp32-hal.h
2424
#define analogGetChannel(pin) analogGetChannel(digitalPinToGPIONumber(pin))

0 commit comments

Comments
 (0)