diff options
| author | Keith Packard <keithp@keithp.com> | 2009-03-25 00:50:02 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2009-03-25 00:50:02 -0700 | 
| commit | 029963cc94fbb47560118b5de73c537e2c14ed7c (patch) | |
| tree | 6980a1fd573c9183279a1b6196ec23b26b7d763b /target/serial/serial.c | |
| parent | 019456a17d36f8f9f9b72cfbc980492175086d32 (diff) | |
Eliminate array walking
Diffstat (limited to 'target/serial/serial.c')
| -rw-r--r-- | target/serial/serial.c | 19 | 
1 files changed, 11 insertions, 8 deletions
| diff --git a/target/serial/serial.c b/target/serial/serial.c index 1c352831..ebe7e2fc 100644 --- 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_SPB_1_STOP_BIT | +		 UxUCR_SPB_2_STOP_BITS |  		 UxUCR_STOP_HIGH |  		 UxUCR_START_LOW);  } @@ -219,7 +219,15 @@ usart_out_byte(uint8_t byte)  	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 @@ -233,12 +241,8 @@ usart_in_byte(void)  	return b;  } -static char string[] = "hello world\r\n"; -  main ()  { -	uint8_t i; -  	P1DIR |= 2;  	CLKCON = 0;  	while (!(SLEEP & SLEEP_XOSC_STB)) @@ -247,8 +251,7 @@ main ()  	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;  	} | 
