aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTitanMKD2012-06-02 09:47:52 +0200
committerTitanMKD2012-06-02 09:47:52 +0200
commitcb1cd9d9d6eca9b8f4d05a3b1490f9b875265a32 (patch)
treee736904a502e5b8f538c8f300f8b36dd555bc148 /lib
parente7fbc2220b23b1d50fc0285c260a8787694328fe (diff)
parent7011d47c70076f995e8470c59eeaa8f3efcc9f05 (diff)
Merge branch 'master' of git://github.com/libopencm3/libopencm3
Diffstat (limited to 'lib')
-rw-r--r--lib/stm32/f1/gpio.c3
-rw-r--r--lib/stm32/f2/gpio.c3
-rw-r--r--lib/stm32/f4/gpio.c3
3 files changed, 9 insertions, 0 deletions
diff --git a/lib/stm32/f1/gpio.c b/lib/stm32/f1/gpio.c
index 4f7e663..9ef6037 100644
--- a/lib/stm32/f1/gpio.c
+++ b/lib/stm32/f1/gpio.c
@@ -147,5 +147,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. */
}
diff --git a/lib/stm32/f2/gpio.c b/lib/stm32/f2/gpio.c
index 7a38120..fc7a5b6 100644
--- a/lib/stm32/f2/gpio.c
+++ b/lib/stm32/f2/gpio.c
@@ -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. */
}
diff --git a/lib/stm32/f4/gpio.c b/lib/stm32/f4/gpio.c
index dea3720..e721f3f 100644
--- a/lib/stm32/f4/gpio.c
+++ b/lib/stm32/f4/gpio.c
@@ -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. */
}