Skip to content
This repository was archived by the owner on Apr 16, 2021. It is now read-only.

Commit 73e8e01

Browse files
Set default pinMode for CHANGE (#84)
1 parent e7b3d64 commit 73e8e01

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cores/arduino/Interrupts.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,16 @@ void attachInterruptParam(pin_size_t interruptNum, voidFuncPtrParam func, PinSta
6969
digitalPinToInterruptObj(interruptNum) = irq;
7070
// Give a default pullup for the pin, since calling InterruptIn with PinMode is impossible
7171
if (digitalPinToGpio(interruptNum) == NULL) {
72-
pinMode(interruptNum, mode == FALLING ? INPUT_PULLUP : INPUT_PULLDOWN);
72+
if (mode == FALLING) {
73+
pinMode(interruptNum, INPUT_PULLUP);
74+
} else if (mode == RISING) {
75+
pinMode(interruptNum, INPUT_PULLDOWN);
76+
} else {
77+
pinMode(interruptNum, INPUT);
78+
}
7379
}
7480
}
7581

7682
void attachInterrupt(pin_size_t interruptNum, voidFuncPtr func, PinStatus mode) {
7783
attachInterruptParam(interruptNum, (voidFuncPtrParam)func, mode, NULL);
78-
}
84+
}

0 commit comments

Comments
 (0)