uc: Remove ATmega8 support in serial library
This commit is contained in:
parent
d4862a7798
commit
9f0852e5bb
|
@ -37,7 +37,6 @@ int rx_buffer_tail = 0;
|
|||
|
||||
void beginSerial(long baud)
|
||||
{
|
||||
#if defined(__AVR_ATmega168__) | defined(__AVR_ATmega88__) | defined(__AVR_ATmega48__)
|
||||
UBRR0H = ((F_CPU / 16 + baud / 2) / baud - 1) >> 8;
|
||||
UBRR0L = ((F_CPU / 16 + baud / 2) / baud - 1);
|
||||
|
||||
|
@ -47,34 +46,16 @@ void beginSerial(long baud)
|
|||
|
||||
// enable interrupt on complete reception of a byte
|
||||
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
|
||||
}
|
||||
|
||||
void serialWrite(unsigned char c)
|
||||
{
|
||||
#if defined(__AVR_ATmega168__) | defined(__AVR_ATmega88__) | defined(__AVR_ATmega48__)
|
||||
while (!(UCSR0A & (1 << UDRE0)))
|
||||
;
|
||||
|
||||
UDR0 = c;
|
||||
#else
|
||||
while (!(UCSRA & (1 << UDRE)))
|
||||
;
|
||||
|
||||
UDR = c;
|
||||
#endif
|
||||
}
|
||||
|
||||
int serialAvailable()
|
||||
|
@ -104,17 +85,9 @@ void serialFlush()
|
|||
rx_buffer_head = rx_buffer_tail;
|
||||
}
|
||||
|
||||
#if defined(__AVR_ATmega168__) | defined(__AVR_ATmega88__) | defined(__AVR_ATmega48__)
|
||||
SIGNAL(SIG_USART_RECV)
|
||||
#else
|
||||
SIGNAL(SIG_UART_RECV)
|
||||
#endif
|
||||
{
|
||||
#if defined(__AVR_ATmega168__) | defined(__AVR_ATmega88__) | defined(__AVR_ATmega48__)
|
||||
unsigned char c = UDR0;
|
||||
#else
|
||||
unsigned char c = UDR;
|
||||
#endif
|
||||
|
||||
int i = (rx_buffer_head + 1) % RX_BUFFER_SIZE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue