aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Ossmann2012-06-04 12:44:41 -0600
committerMichael Ossmann2012-06-04 12:44:41 -0600
commit245e1d6f079897fd9710473a15f056271e68b375 (patch)
treeb2410a300df4562c3ad26090b92d98ff86d6842a
parentb55d006d024fa100b3bba38685e97e292325c780 (diff)
parent154f67598bb06c0c152bf121979c2292f7f10a84 (diff)
Merge remote branch 'upstream/master'
-rw-r--r--lib/stm32/f1/gpio.c3
-rw-r--r--lib/stm32/f2/gpio.c3
-rw-r--r--lib/stm32/f4/gpio.c3
-rw-r--r--lib/stm32/nvic.c2
4 files changed, 10 insertions, 1 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. */
}
diff --git a/lib/stm32/nvic.c b/lib/stm32/nvic.c
index cd823e1..c9cf48b 100644
--- a/lib/stm32/nvic.c
+++ b/lib/stm32/nvic.c
@@ -57,7 +57,7 @@ u8 nvic_get_irq_enabled(u8 irqn)
void nvic_set_priority(u8 irqn, u8 priority)
{
- NVIC_IPR(irqn / 4) |= (priority << ((irqn % 4) * 8));
+ NVIC_IPR(irqn) = priority;
}
void nvic_generate_software_interrupt(u8 irqn)