aboutsummaryrefslogtreecommitdiff
path: root/lib/stm32/f4/gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stm32/f4/gpio.c')
-rw-r--r--lib/stm32/f4/gpio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/stm32/f4/gpio.c b/lib/stm32/f4/gpio.c
index dea3720..1d7739d 100644
--- a/lib/stm32/f4/gpio.c
+++ b/lib/stm32/f4/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)
@@ -135,5 +135,8 @@ void gpio_port_config_lock(u32 gpioport, u16 gpios)
reg32 = GPIO_LCKR(gpioport); /* Read LCKK. */
reg32 = GPIO_LCKR(gpioport); /* Read LCKK again. */
+ /* Tell the compiler the variable is actually used. It will get optimized out anyways. */
+ reg32 = reg32;
+
/* If (reg32 & GPIO_LCKK) is true, the lock is now active. */
}