From ca53311bfc3182212d53386c5f49f0bc57350266 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Mon, 3 Jan 2011 01:12:07 +0100 Subject: 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. --- examples/stm32/stm32-h103/usart/usart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'examples/stm32/stm32-h103/usart/usart.c') diff --git a/examples/stm32/stm32-h103/usart/usart.c b/examples/stm32/stm32-h103/usart/usart.c index c3d24ca..487ee84 100644 --- a/examples/stm32/stm32-h103/usart/usart.c +++ b/examples/stm32/stm32-h103/usart/usart.c @@ -69,13 +69,14 @@ int main(void) /* Blink the LED (PC12) on the board with every transmitted byte. */ while (1) { gpio_toggle(GPIOC, GPIO12); /* LED on/off */ - usart_send_blocking(USART3, c + '0'); /* Send one byte on USART3. */ + usart_send_blocking(USART3, c + '0'); /* USART3: Send byte. */ c = (c == 9) ? 0 : c + 1; /* Increment c. */ if ((j++ % 80) == 0) { /* Newline after line full. */ usart_send_blocking(USART3, '\r'); usart_send_blocking(USART3, '\n'); } - for (i = 0; i < 80000; i++); /* Wait (needs -O0 CFLAGS). */ + for (i = 0; i < 800000; i++) /* Wait a bit. */ + __asm__("NOP"); } return 0; -- cgit v1.2.3