diff --git a/cores/arduino/Interrupts.cpp b/cores/arduino/Interrupts.cpp index a5770b70..f00b391f 100644 --- a/cores/arduino/Interrupts.cpp +++ b/cores/arduino/Interrupts.cpp @@ -69,10 +69,16 @@ void attachInterruptParam(pin_size_t interruptNum, voidFuncPtrParam func, PinSta digitalPinToInterruptObj(interruptNum) = irq; // Give a default pullup for the pin, since calling InterruptIn with PinMode is impossible if (digitalPinToGpio(interruptNum) == NULL) { - pinMode(interruptNum, mode == FALLING ? INPUT_PULLUP : INPUT_PULLDOWN); + if (mode == FALLING) { + pinMode(interruptNum, INPUT_PULLUP); + } else if (mode == RISING) { + pinMode(interruptNum, INPUT_PULLDOWN); + } else { + pinMode(interruptNum, INPUT); + } } } void attachInterrupt(pin_size_t interruptNum, voidFuncPtr func, PinStatus mode) { attachInterruptParam(interruptNum, (voidFuncPtrParam)func, mode, NULL); -} \ No newline at end of file +}