From 12a73ce052477ef9d35244e2986a7e56428754df Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Thu, 31 May 2012 00:08:23 +0200 Subject: 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. --- lib/stm32/f2/gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/stm32/f2') 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) -- cgit v1.2.3