Replace switch with if-else

Fixes #386
This commit is contained in:
Connor Gibson
2025-08-02 19:12:12 -07:00
parent 82aa8920a7
commit 1c23447a7b

View File

@@ -2300,10 +2300,10 @@ int digitalRead (int pin)
} }
if (ISRP1MODEL) { if (ISRP1MODEL) {
switch(gpio[2*pin] & RP1_STATUS_LEVEL_MASK) { if ((gpio[2*pin] & RP1_STATUS_LEVEL_MASK) == RP1_STATUS_LEVEL_HIGH) {
default: // 11 or 00 not allowed, give LOW! return HIGH;
case RP1_STATUS_LEVEL_LOW: return LOW ; } else { // 11 or 00 not allowed, give LOW!
case RP1_STATUS_LEVEL_HIGH: return HIGH ; return LOW;
} }
} else { } else {
if ((*(gpio + gpioToGPLEV [pin]) & (1 << (pin & 31))) != 0) if ((*(gpio + gpioToGPLEV [pin]) & (1 << (pin & 31))) != 0)