aboutsummaryrefslogtreecommitdiffstats
path: root/src/lpc176x
diff options
context:
space:
mode:
Diffstat (limited to 'src/lpc176x')
-rw-r--r--src/lpc176x/gpio.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/lpc176x/gpio.c b/src/lpc176x/gpio.c
index 35a5a226..0b6d0345 100644
--- a/src/lpc176x/gpio.c
+++ b/src/lpc176x/gpio.c
@@ -80,10 +80,7 @@ gpio_out_reset(struct gpio_out g, uint8_t val)
LPC_GPIO_TypeDef *regs = g.regs;
int pin = regs_to_pin(regs, g.bit);
irqstatus_t flag = irq_save();
- if (val)
- regs->FIOSET = g.bit;
- else
- regs->FIOCLR = g.bit;
+ regs->FIOPIN = (regs->FIOSET & ~g.bit) | (val ? g.bit : 0);
regs->FIODIR |= g.bit;
gpio_peripheral(pin, 0, 0);
irq_restore(flag);