Mercurial > ~darius > hgwebdir.cgi > avr
diff testavr.c @ 17:a58b41b7d15c
Covert to a later version of avr-libc. Stuff like not using inb/outb,
etc..
author | darius |
---|---|
date | Fri, 25 Nov 2005 21:45:51 +1030 |
parents | 026dc24d85e0 |
children | 108a703c39e6 |
line wrap: on
line diff
--- a/testavr.c Sat Sep 17 18:31:19 2005 +0930 +++ b/testavr.c Fri Nov 25 21:45:51 2005 +1030 @@ -59,15 +59,15 @@ cli(); - outp(0xfc, DDRC); - outp(0x00, PORTC); + DDRC = 0xfc; + PORTC = 0x00; DDRA = 0xff; /* Init UART */ - outp(UART_BAUD_SELECT(UART_BAUD_RATE,XTAL_CPU), UBRR); + UBRR = UART_BAUD_SELECT(UART_BAUD_RATE,XTAL_CPU); /* Enable receiver and transmitter. Turn on transmit interrupts */ - outp(BV(RXEN) | BV(TXEN), UCR); + UCR = _BV(RXEN) | _BV(TXEN); uart_putsP(PSTR("\n\r\n\r===============\n\r" "Inited!\n\r\n\r")); @@ -316,7 +316,7 @@ int uart_putc(char c) { loop_until_bit_is_set(USR, UDRE); - outp(c, UDR); + UDR = c; return(0); } @@ -325,7 +325,7 @@ uart_putsP(const char *addr) { char c; - while ((c = PRG_RDB((unsigned short)addr++))) + while ((c = pgm_read_byte_near(addr++))) uart_putc(c); } @@ -356,9 +356,9 @@ int uart_getc(void) { - while (!(inp(USR) & 0x80)) + while (!USR & 0x80) ; - return (inp(UDR)); + return (UDR); }