Skip to content

Commit cc2a9a6

Browse files
committed
Merge branch 'ide-1.5.x-hwserial-cleanup' of github.com:matthijskooijman/Arduino into matthijskooijman-ide-1.5.x-hwserial-cleanup
2 parents 5d92c1b + b26db20 commit cc2a9a6

File tree

5 files changed

+22
-76
lines changed

5 files changed

+22
-76
lines changed

hardware/arduino/avr/cores/arduino/HardwareSerial.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void HardwareSerial::begin(unsigned long baud, byte config)
117117
baud_setting = (F_CPU / 8 / baud - 1) / 2;
118118
}
119119

120-
// assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register)
120+
// assign the baud_setting, a.k.a. ubrr (USART Baud Rate Register)
121121
*_ubrrh = baud_setting >> 8;
122122
*_ubrrl = baud_setting;
123123

hardware/arduino/avr/cores/arduino/HardwareSerial0.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#elif defined(USART_RXC_vect)
4444
ISR(USART_RXC_vect) // ATmega8
4545
#else
46-
#error "Don't know what the Data Received vector is called for the first UART"
46+
#error "Don't know what the Data Received vector is called for Serial"
4747
#endif
4848
{
4949
Serial._rx_complete_irq();
@@ -58,7 +58,7 @@ ISR(USART0_UDRE_vect)
5858
#elif defined(USART_UDRE_vect)
5959
ISR(USART_UDRE_vect)
6060
#else
61-
#error "Don't know what the Data Register Empty vector is called for the first UART"
61+
#error "Don't know what the Data Register Empty vector is called for Serial"
6262
#endif
6363
{
6464
Serial._tx_udr_empty_irq();

hardware/arduino/avr/cores/arduino/HardwareSerial1.cpp

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,39 +36,29 @@
3636

3737
#if defined(HAVE_HWSERIAL1)
3838

39-
#if defined(USART_RX_vect)
40-
ISR(USART_RX_vect)
39+
#if defined(UART1_RX_vect)
40+
ISR(UART1_RX_vect)
4141
#elif defined(USART1_RX_vect)
42-
ISR(USART1_RX_vect)
43-
#elif defined(USART_RXC_vect)
44-
ISR(USART_RXC_vect) // ATmega8
42+
ISR(USART1_RX_vect)
4543
#else
46-
#error "Don't know what the Data Received vector is called for the first UART"
44+
#error "Don't know what the Data Register Empty vector is called for Serial1"
4745
#endif
48-
{
49-
Serial1._rx_complete_irq();
50-
}
46+
{
47+
Serial1._rx_complete_irq();
48+
}
5149

5250
#if defined(UART1_UDRE_vect)
5351
ISR(UART1_UDRE_vect)
54-
#elif defined(UART_UDRE_vect)
55-
ISR(UART_UDRE_vect)
5652
#elif defined(USART1_UDRE_vect)
5753
ISR(USART1_UDRE_vect)
58-
#elif defined(USART_UDRE_vect)
59-
ISR(USART_UDRE_vect)
6054
#else
61-
#error "Don't know what the Data Register Empty vector is called for the first UART"
55+
#error "Don't know what the Data Register Empty vector is called for Serial1"
6256
#endif
6357
{
6458
Serial1._tx_udr_empty_irq();
6559
}
6660

67-
#if defined(UBRRH) && defined(UBRRL)
68-
HardwareSerial Serial1(&UBRRH, &UBRRL, &UCSRA, &UCSRB, &UCSRC, &UDR);
69-
#else
70-
HardwareSerial Serial1(&UBRR1H, &UBRR1L, &UCSR1A, &UCSR1B, &UCSR1C, &UDR1);
71-
#endif
61+
HardwareSerial Serial1(&UBRR1H, &UBRR1L, &UCSR1A, &UCSR1B, &UCSR1C, &UDR1);
7262

7363
// Function that can be weakly referenced by serialEventRun to prevent
7464
// pulling in this file if it's not otherwise used.

hardware/arduino/avr/cores/arduino/HardwareSerial2.cpp

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -36,39 +36,17 @@
3636

3737
#if defined(HAVE_HWSERIAL2)
3838

39-
#if defined(USART_RX_vect)
40-
ISR(USART_RX_vect)
41-
#elif defined(USART2_RX_vect)
42-
ISR(USART2_RX_vect)
43-
#elif defined(USART_RXC_vect)
44-
ISR(USART_RXC_vect) // ATmega8
45-
#else
46-
#error "Don't know what the Data Received vector is called for the first UART"
47-
#endif
48-
{
49-
Serial2._rx_complete_irq();
50-
}
39+
ISR(USART2_RX_vect)
40+
{
41+
Serial2._rx_complete_irq();
42+
}
5143

52-
#if defined(UART2_UDRE_vect)
53-
ISR(UART2_UDRE_vect)
54-
#elif defined(UART_UDRE_vect)
55-
ISR(UART_UDRE_vect)
56-
#elif defined(USART2_UDRE_vect)
5744
ISR(USART2_UDRE_vect)
58-
#elif defined(USART_UDRE_vect)
59-
ISR(USART_UDRE_vect)
60-
#else
61-
#error "Don't know what the Data Register Empty vector is called for the first UART"
62-
#endif
6345
{
6446
Serial2._tx_udr_empty_irq();
6547
}
6648

67-
#if defined(UBRRH) && defined(UBRRL)
68-
HardwareSerial Serial2(&UBRRH, &UBRRL, &UCSRA, &UCSRB, &UCSRC, &UDR);
69-
#else
70-
HardwareSerial Serial2(&UBRR2H, &UBRR2L, &UCSR2A, &UCSR2B, &UCSR2C, &UDR2);
71-
#endif
49+
HardwareSerial Serial2(&UBRR2H, &UBRR2L, &UCSR2A, &UCSR2B, &UCSR2C, &UDR2);
7250

7351
// Function that can be weakly referenced by serialEventRun to prevent
7452
// pulling in this file if it's not otherwise used.

hardware/arduino/avr/cores/arduino/HardwareSerial3.cpp

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -36,39 +36,17 @@
3636

3737
#if defined(HAVE_HWSERIAL3)
3838

39-
#if defined(USART_RX_vect)
40-
ISR(USART_RX_vect)
41-
#elif defined(USART3_RX_vect)
42-
ISR(USART3_RX_vect)
43-
#elif defined(USART_RXC_vect)
44-
ISR(USART_RXC_vect) // ATmega8
45-
#else
46-
#error "Don't know what the Data Received vector is called for the first UART"
47-
#endif
48-
{
49-
Serial3._rx_complete_irq();
50-
}
39+
ISR(USART3_RX_vect)
40+
{
41+
Serial3._rx_complete_irq();
42+
}
5143

52-
#if defined(UART3_UDRE_vect)
53-
ISR(UART3_UDRE_vect)
54-
#elif defined(UART_UDRE_vect)
55-
ISR(UART_UDRE_vect)
56-
#elif defined(USART3_UDRE_vect)
5744
ISR(USART3_UDRE_vect)
58-
#elif defined(USART_UDRE_vect)
59-
ISR(USART_UDRE_vect)
60-
#else
61-
#error "Don't know what the Data Register Empty vector is called for the first UART"
62-
#endif
6345
{
6446
Serial3._tx_udr_empty_irq();
6547
}
6648

67-
#if defined(UBRRH) && defined(UBRRL)
68-
HardwareSerial Serial3(&UBRRH, &UBRRL, &UCSRA, &UCSRB, &UCSRC, &UDR);
69-
#else
70-
HardwareSerial Serial3(&UBRR3H, &UBRR3L, &UCSR3A, &UCSR3B, &UCSR3C, &UDR3);
71-
#endif
49+
HardwareSerial Serial3(&UBRR3H, &UBRR3L, &UCSR3A, &UCSR3B, &UCSR3C, &UDR3);
7250

7351
// Function that can be weakly referenced by serialEventRun to prevent
7452
// pulling in this file if it's not otherwise used.

0 commit comments

Comments
 (0)