Skip to content

Commit fe5a441

Browse files
committed
Interrupts: remove C prototype and keep only C++ prototypes
attachInterrupt() C prototypes was not usable from C source file (inheritance of former pure C implementation), and causes ambiguity when used with lambda function as callback Fixes #1601 Signed-off-by: Alexandre Bourdiol <[email protected]>
1 parent b192e50 commit fe5a441

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

cores/arduino/WInterrupts.h

+3-10
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,10 @@
2020
#define _WIRING_INTERRUPTS_
2121

2222
#include <stdint.h>
23+
#include <functional>
2324

24-
#ifdef __cplusplus
25-
#include <functional>
26-
27-
typedef std::function<void(void)> callback_function_t;
28-
void attachInterrupt(uint32_t pin, callback_function_t callback, uint32_t mode);
29-
30-
#endif
31-
32-
void attachInterrupt(uint32_t pin, void (*callback)(void), uint32_t mode);
33-
25+
typedef std::function<void(void)> callback_function_t;
26+
void attachInterrupt(uint32_t pin, callback_function_t callback, uint32_t mode);
3427
void detachInterrupt(uint32_t pin);
3528

3629
#endif /* _WIRING_INTERRUPTS_ */

cores/arduino/wiring.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "wiring_pulse.h"
3737
#include "wiring_shift.h"
3838
#include "wiring_time.h"
39-
#include "WInterrupts.h"
4039

4140
#include <board.h>
4241

@@ -47,6 +46,7 @@
4746
#include "WSerial.h"
4847
#include "WMath.h"
4948
#include "WString.h"
49+
#include "WInterrupts.h"
5050
#endif // __cplusplus
5151

5252

0 commit comments

Comments
 (0)