diff options
author | Zach Eveland <zeveland@blacklabel-development.com> | 2012-01-10 12:02:27 -0500 |
---|---|---|
committer | Zach Eveland <zeveland@blacklabel-development.com> | 2012-01-10 12:02:27 -0500 |
commit | 989f672d345c71478102d9778d551c4637e88ab5 (patch) | |
tree | a194b4c486bf7e66827c6a343206be72df503047 /cores/arduino/wiring_digital.c | |
parent | 28e9e122af24e63e84d5bcd2c619b76c490970fc (diff) | |
parent | dd5bae59df6f1ba63083361ba284f364bc62b401 (diff) |
Merge branch 'master' of github.com:arduino/Arduino into new-extension
Diffstat (limited to 'cores/arduino/wiring_digital.c')
-rw-r--r-- | cores/arduino/wiring_digital.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cores/arduino/wiring_digital.c b/cores/arduino/wiring_digital.c index 75f850e..be323b1 100644 --- a/cores/arduino/wiring_digital.c +++ b/cores/arduino/wiring_digital.c @@ -32,17 +32,25 @@ void pinMode(uint8_t pin, uint8_t mode) { uint8_t bit = digitalPinToBitMask(pin); uint8_t port = digitalPinToPort(pin); - volatile uint8_t *reg; + volatile uint8_t *reg, *out; if (port == NOT_A_PIN) return; // JWS: can I let the optimizer do this? reg = portModeRegister(port); + out = portOutputRegister(port); if (mode == INPUT) { uint8_t oldSREG = SREG; cli(); *reg &= ~bit; + *out &= ~bit; + SREG = oldSREG; + } else if (mode == INPUT_PULLUP) { + uint8_t oldSREG = SREG; + cli(); + *reg &= ~bit; + *out |= bit; SREG = oldSREG; } else { uint8_t oldSREG = SREG; |