uc: Remove ATmega8 support in serial library

This commit is contained in:
Bart Van Der Meerssche 2010-02-09 12:26:14 +00:00
parent d4862a7798
commit 9f0852e5bb
1 changed files with 0 additions and 27 deletions

View File

@ -37,7 +37,6 @@ int rx_buffer_tail = 0;
void beginSerial(long baud) void beginSerial(long baud)
{ {
#if defined(__AVR_ATmega168__) | defined(__AVR_ATmega88__) | defined(__AVR_ATmega48__)
UBRR0H = ((F_CPU / 16 + baud / 2) / baud - 1) >> 8; UBRR0H = ((F_CPU / 16 + baud / 2) / baud - 1) >> 8;
UBRR0L = ((F_CPU / 16 + baud / 2) / baud - 1); UBRR0L = ((F_CPU / 16 + baud / 2) / baud - 1);
@ -47,34 +46,16 @@ void beginSerial(long baud)
// enable interrupt on complete reception of a byte // enable interrupt on complete reception of a byte
sbi(UCSR0B, RXCIE0); sbi(UCSR0B, RXCIE0);
#else
UBRRH = ((F_CPU / 16 + baud / 2) / baud - 1) >> 8;
UBRRL = ((F_CPU / 16 + baud / 2) / baud - 1);
// enable rx and tx
sbi(UCSRB, RXEN);
sbi(UCSRB, TXEN);
// enable interrupt on complete reception of a byte
sbi(UCSRB, RXCIE);
#endif
// defaults to 8-bit, no parity, 1 stop bit // defaults to 8-bit, no parity, 1 stop bit
} }
void serialWrite(unsigned char c) void serialWrite(unsigned char c)
{ {
#if defined(__AVR_ATmega168__) | defined(__AVR_ATmega88__) | defined(__AVR_ATmega48__)
while (!(UCSR0A & (1 << UDRE0))) while (!(UCSR0A & (1 << UDRE0)))
; ;
UDR0 = c; UDR0 = c;
#else
while (!(UCSRA & (1 << UDRE)))
;
UDR = c;
#endif
} }
int serialAvailable() int serialAvailable()
@ -104,17 +85,9 @@ void serialFlush()
rx_buffer_head = rx_buffer_tail; rx_buffer_head = rx_buffer_tail;
} }
#if defined(__AVR_ATmega168__) | defined(__AVR_ATmega88__) | defined(__AVR_ATmega48__)
SIGNAL(SIG_USART_RECV) SIGNAL(SIG_USART_RECV)
#else
SIGNAL(SIG_UART_RECV)
#endif
{ {
#if defined(__AVR_ATmega168__) | defined(__AVR_ATmega88__) | defined(__AVR_ATmega48__)
unsigned char c = UDR0; unsigned char c = UDR0;
#else
unsigned char c = UDR;
#endif
int i = (rx_buffer_head + 1) % RX_BUFFER_SIZE; int i = (rx_buffer_head + 1) % RX_BUFFER_SIZE;