projects
/
fw
/
altos
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
019456a
)
Eliminate array walking
author
Keith Packard
<keithp@keithp.com>
Wed, 25 Mar 2009 07:50:02 +0000
(
00:50
-0700)
committer
Keith Packard
<keithp@keithp.com>
Wed, 25 Mar 2009 07:50:02 +0000
(
00:50
-0700)
target/serial/serial.c
patch
|
blob
|
history
diff --git
a/target/serial/serial.c
b/target/serial/serial.c
index 1c352831dfa1d6f9e4b6c1cfe173f75cbf959e7a..ebe7e2fc891b3be7a529c5c8b113db177f166cfb 100644
(file)
--- a/
target/serial/serial.c
+++ b/
target/serial/serial.c
@@
-207,7
+207,7
@@
usart_init(void)
UxUCR_D9_ODD_PARITY |
UxUCR_BIT9_8_BITS |
UxUCR_PARITY_DISABLE |
UxUCR_D9_ODD_PARITY |
UxUCR_BIT9_8_BITS |
UxUCR_PARITY_DISABLE |
- UxUCR_SPB_
1_STOP_BIT
|
+ UxUCR_SPB_
2_STOP_BITS
|
UxUCR_STOP_HIGH |
UxUCR_START_LOW);
}
UxUCR_STOP_HIGH |
UxUCR_START_LOW);
}
@@
-219,7
+219,15
@@
usart_out_byte(uint8_t byte)
while (!UTX1IF)
;
UTX1IF = 0;
while (!UTX1IF)
;
UTX1IF = 0;
- delay(1);
+}
+
+void
+usart_out_string(uint8_t *string)
+{
+ uint8_t b;
+
+ while (b = *string++)
+ usart_out_byte(b);
}
uint8_t
}
uint8_t
@@
-233,12
+241,8
@@
usart_in_byte(void)
return b;
}
return b;
}
-static char string[] = "hello world\r\n";
-
main ()
{
main ()
{
- uint8_t i;
-
P1DIR |= 2;
CLKCON = 0;
while (!(SLEEP & SLEEP_XOSC_STB))
P1DIR |= 2;
CLKCON = 0;
while (!(SLEEP & SLEEP_XOSC_STB))
@@
-247,8
+251,7
@@
main ()
usart_init();
for (;;) {
usart_init();
for (;;) {
- for (i = 0; i < sizeof(string) - 1; i++)
- usart_out_byte(string[i]);
+ usart_out_string("hello world\r\n");
delay(5);
P1 ^= 2;
}
delay(5);
P1 ^= 2;
}