Skip to content

Commit 29693a0

Browse files
committed
"Fix" interrupts
need a better structure, a destructor on detachInterrupt() and a linked list of allocated irqs
1 parent 6c3412b commit 29693a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cores/arduino/Interrupts.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
#include "Arduino.h"
2020

2121
void attachInterruptParam(pin_size_t interruptNum, voidFuncPtrParam func, PinStatus mode, void* param) {
22-
// need to check if destructor also destroys the callback object
22+
InterruptIn* irq = new InterruptIn((PinName)interruptNum);
2323
if (mode == FALLING) {
24-
InterruptIn((PinName)interruptNum).fall(callback(func, param));
24+
irq->fall(callback(func, param));
2525
} else {
26-
InterruptIn((PinName)interruptNum).rise(callback(func, param));
26+
irq->rise(callback(func, param));
2727
}
2828
}
2929

0 commit comments

Comments
 (0)