aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32/obldc/led
diff options
context:
space:
mode:
authorUwe Hermann2011-01-03 01:12:07 +0100
committerUwe Hermann2011-01-03 01:12:07 +0100
commitca53311bfc3182212d53386c5f49f0bc57350266 (patch)
tree2a81b20c486717d0fea3d1987549c15d2bb529b2 /examples/stm32/obldc/led
parent05f66cde4cc2d9e57e495f6d8b51619f08191c68 (diff)
Use __asm__("nop") in the loop-based delays.
Since we recently switched from -O0 to -Os, an increase in the loop count as well as the addition of __asm__("nop") is required (so that the loop doesn't get optimized/removed). The real fix is to add a proper timer-based delay function, of course. Also, fix a bunch of cosmetic issues and typos.
Diffstat (limited to 'examples/stm32/obldc/led')
-rw-r--r--examples/stm32/obldc/led/led.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/stm32/obldc/led/led.c b/examples/stm32/obldc/led/led.c
index aad055b..09ae89d 100644
--- a/examples/stm32/obldc/led/led.c
+++ b/examples/stm32/obldc/led/led.c
@@ -54,13 +54,17 @@ int main(void)
/* Blink the LEDs on the board. */
while (1) {
gpio_toggle(GPIOA, GPIO6); /* LED on/off */
- for (i = 0; i < 800000; i++); /* Wait (needs -O0 CFLAGS). */
+ for (i = 0; i < 8000000; i++) /* Wait a bit. */
+ __asm__("nop");
gpio_toggle(GPIOA, GPIO7); /* LED on/off */
- for (i = 0; i < 800000; i++); /* Wait (needs -O0 CFLAGS). */
+ for (i = 0; i < 8000000; i++) /* Wait a bit. */
+ __asm__("nop");
gpio_toggle(GPIOB, GPIO0); /* LED on/off */
- for (i = 0; i < 800000; i++); /* Wait (needs -O0 CFLAGS). */
+ for (i = 0; i < 8000000; i++) /* Wait a bit. */
+ __asm__("nop");
gpio_toggle(GPIOB, GPIO1); /* LED on/off */
- for (i = 0; i < 800000; i++); /* Wait (needs -O0 CFLAGS). */
+ for (i = 0; i < 8000000; i++) /* Wait a bit. */
+ __asm__("nop");
}
return 0;