aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/wiring_digital.c
diff options
context:
space:
mode:
Diffstat (limited to 'cores/arduino/wiring_digital.c')
-rwxr-xr-xcores/arduino/wiring_digital.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/cores/arduino/wiring_digital.c b/cores/arduino/wiring_digital.c
index 0949da4..dd1b949 100755
--- a/cores/arduino/wiring_digital.c
+++ b/cores/arduino/wiring_digital.c
@@ -136,17 +136,16 @@ void digitalWrite(uint8_t pin, uint8_t val)
out = portOutputRegister(port);
+ uint8_t oldSREG = SREG;
+ cli();
+
if (val == LOW) {
- uint8_t oldSREG = SREG;
- cli();
*out &= ~bit;
- SREG = oldSREG;
} else {
- uint8_t oldSREG = SREG;
- cli();
*out |= bit;
- SREG = oldSREG;
}
+
+ SREG = oldSREG;
}
int digitalRead(uint8_t pin)