aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/wiring_digital.c
diff options
context:
space:
mode:
authoramcewen <amcewen@bcs.org.uk>2011-06-11 21:27:18 +0100
committeramcewen <amcewen@bcs.org.uk>2011-06-11 21:27:18 +0100
commit58aaa903f8aaaf7735ca2df803ec028b420a754b (patch)
treed2548a6d793dd615c47cec573f331aeb23314833 /cores/arduino/wiring_digital.c
parentedee02eaf19c4d13324959e6db881dc327342561 (diff)
parenta239d2c541094ef5445159360ae5d2d6a93dbf00 (diff)
Merge remote branch 'upstream/new-extension'
Moved my fork to the Arduino 1.0 codebase
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)