Skip to content

Commit ee2ead8

Browse files
authored
Set constant the IRQChannel for the pin as it should never change.
1 parent 7900baf commit ee2ead8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cores/arduino/Interrupts.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void detachInterrupt(pin_size_t pinNumber) {
119119
/* -------------------------------------------------------------------------- */
120120

121121
CIrq *irq_context = nullptr;
122-
int ch = pin2IrqChannel(pinNumber);
122+
const int ch = pin2IrqChannel(pinNumber);
123123

124124
if(ch >= 0 && ch < MAX_IRQ_CHANNEL) {
125125
irq_context = IrqChannel.get(ch,false);
@@ -138,7 +138,7 @@ void attachInterruptParam(pin_size_t pinNumber, voidFuncPtrParam func, PinStatus
138138
/* -------------------------------------------------------------------------- */
139139

140140
CIrq *irq_context = nullptr;
141-
int ch = pin2IrqChannel(pinNumber);
141+
const int ch = pin2IrqChannel(pinNumber);
142142

143143
if(ch >= 0 && ch < MAX_IRQ_CHANNEL) {
144144
irq_context = IrqChannel.get(ch,true);
@@ -195,7 +195,7 @@ void attachInterrupt(pin_size_t pinNumber, voidFuncPtr func, PinStatus mode) {
195195

196196
int attachIrq2Link(uint32_t pinNumber, PinStatus mode) {
197197
CIrq *irq_context = nullptr;
198-
int ch = pin2IrqChannel(pinNumber);
198+
const int ch = pin2IrqChannel(pinNumber);
199199

200200
if(ch >= 0 && ch < MAX_IRQ_CHANNEL) {
201201
irq_context = IrqChannel.get(ch,true);
@@ -249,7 +249,7 @@ int detachIrq2Link(pin_size_t pinNumber) {
249249
/* -------------------------------------------------------------------------- */
250250

251251
CIrq *irq_context = nullptr;
252-
int ch = pin2IrqChannel(pinNumber);
252+
const int ch = pin2IrqChannel(pinNumber);
253253

254254
if(ch >= 0 && ch < MAX_IRQ_CHANNEL) {
255255
irq_context = IrqChannel.get(ch,false);

0 commit comments

Comments
 (0)