summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schodet2013-04-13 00:18:00 +0200
committerNicolas Schodet2013-04-13 00:20:18 +0200
commit4b6a226434e402e16111de13531ef3d4be81d9e1 (patch)
tree2b4170bad45d75cba2258c9fd8333001c03855cf
parentd483a484bc24831efe06cef1dcd6f9195170c610 (diff)
digital/dev2/src/common/gpio: disable pull-up for inputs
When switching to input, an old PORTD content could activate pull-up.
-rw-r--r--digital/dev2/src/common/gpio.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/digital/dev2/src/common/gpio.c b/digital/dev2/src/common/gpio.c
index b40b5ad7..5733b86f 100644
--- a/digital/dev2/src/common/gpio.c
+++ b/digital/dev2/src/common/gpio.c
@@ -127,12 +127,16 @@ gpio_bin_accept (uint8_t c)
break;
case GPIO_OP_DIR:
DDRD = ctx.args[0];
+ /* Also disable pull up. */
+ PORTD &= ctx.args[0];
break;
case GPIO_OP_DIR_OUT:
DDRD |= ctx.args[0];
break;
case GPIO_OP_DIR_IN:
DDRD &= ~ctx.args[0];
+ /* Also disable pull up. */
+ PORTD &= ~ctx.args[0];
break;
case GPIO_OP_OUT:
PORTD = ctx.args[0];