summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2009-03-25 00:41:49 -0700
committerKeith Packard <keithp@keithp.com>2009-03-25 00:41:49 -0700
commit019456a17d36f8f9f9b72cfbc980492175086d32 (patch)
tree76b0ab0a50f56b46fb1db6c5f6c48d8a1f4ebef2
parentcfaf187e96ba98eb8dd934409a10bc70273fe68a (diff)
Add a per-char delay
-rw-r--r--target/serial/serial.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/target/serial/serial.c b/target/serial/serial.c
index 1050b9a6..1c352831 100644
--- a/target/serial/serial.c
+++ b/target/serial/serial.c
@@ -156,6 +156,7 @@ delay (unsigned char n)
unsigned char i = 0;
unsigned char j = 0;
+ n++;
while (--n != 0)
while (--i != 0)
while (--j != 0)
@@ -215,8 +216,10 @@ void
usart_out_byte(uint8_t byte)
{
U1DBUF = byte;
- while (!UTX1IF);
+ while (!UTX1IF)
+ ;
UTX1IF = 0;
+ delay(1);
}
uint8_t
@@ -230,10 +233,6 @@ usart_in_byte(void)
return b;
}
-#define spi_init() usart_init()
-#define spi_out_byte(b) usart_out_byte(b)
-#define spi_in_byte() usart_in_byte()
-
static char string[] = "hello world\r\n";
main ()
@@ -245,7 +244,7 @@ main ()
while (!(SLEEP & SLEEP_XOSC_STB))
;
- spi_init();
+ usart_init();
for (;;) {
for (i = 0; i < sizeof(string) - 1; i++)