aboutsummaryrefslogtreecommitdiff
path: root/lib/stm32/f2
diff options
context:
space:
mode:
authorNicolas Schodet2012-05-31 00:08:23 +0200
committerNicolas Schodet2012-05-31 00:08:23 +0200
commit12a73ce052477ef9d35244e2986a7e56428754df (patch)
treee06dfda23bda37a69477ec1da67d86674fad7b72 /lib/stm32/f2
parent7011d47c70076f995e8470c59eeaa8f3efcc9f05 (diff)
Use ODR instead of IDR to toggle an output GPIO
IDR represents the level on pin input while ODR is the value requested by the programmer. This makes a difference for example when using the output as open drain.
Diffstat (limited to 'lib/stm32/f2')
-rw-r--r--lib/stm32/f2/gpio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/stm32/f2/gpio.c b/lib/stm32/f2/gpio.c
index fc7a5b6..984cddb 100644
--- a/lib/stm32/f2/gpio.c
+++ b/lib/stm32/f2/gpio.c
@@ -111,7 +111,7 @@ u16 gpio_get(u32 gpioport, u16 gpios)
void gpio_toggle(u32 gpioport, u16 gpios)
{
- GPIO_ODR(gpioport) = GPIO_IDR(gpioport) ^ gpios;
+ GPIO_ODR(gpioport) ^= gpios;
}
u16 gpio_port_read(u32 gpioport)