aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/HardwareSerial.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cores/arduino/HardwareSerial.cpp')
-rw-r--r--cores/arduino/HardwareSerial.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/cores/arduino/HardwareSerial.cpp b/cores/arduino/HardwareSerial.cpp
index 3ed8d07..a31b266 100644
--- a/cores/arduino/HardwareSerial.cpp
+++ b/cores/arduino/HardwareSerial.cpp
@@ -50,6 +50,10 @@ struct ring_buffer
volatile int tail;
};
+#if defined(USBCON)
+ ring_buffer rx_buffer = { { 0 }, 0, 0};
+ ring_buffer tx_buffer = { { 0 }, 0, 0};
+#endif
#if defined(UBRRH) || defined(UBRR0H)
ring_buffer rx_buffer = { { 0 }, 0, 0 };
ring_buffer tx_buffer = { { 0 }, 0, 0 };
@@ -81,6 +85,9 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
}
}
+#if !defined(USART0_RX_vect) && defined(USART1_RX_vect)
+// do nothing - on the 32u4 the first USART is USART1
+#else
#if !defined(USART_RX_vect) && !defined(SIG_USART0_RECV) && \
!defined(SIG_UART0_RECV) && !defined(USART0_RX_vect) && \
!defined(SIG_UART_RECV)
@@ -113,6 +120,7 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
serialEvent_flag = 1;
}
#endif
+#endif
#if defined(USART1_RX_vect)
void serialEvent1() __attribute__((weak));
@@ -159,6 +167,11 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
#error SIG_USART3_RECV
#endif
+<<<<<<< HEAD
+#if !defined(USART0_UDRE_vect) && defined(USART1_UDRE_vect)
+// do nothing - on the 32u4 the first USART is USART1
+#else
+=======
void serialEventRun(void)
{
unsigned char flag, oldSREG;
@@ -197,6 +210,7 @@ void serialEventRun(void)
}
+>>>>>>> 0c92f230b5202b241de875a3baff9dfd1cf7a618
#if !defined(UART0_UDRE_vect) && !defined(UART_UDRE_vect) && !defined(USART0_UDRE_vect) && !defined(USART_UDRE_vect)
#error Don't know what the Data Register Empty vector is called for the first UART
#else
@@ -233,6 +247,7 @@ ISR(USART_UDRE_vect)
}
}
#endif
+#endif
#ifdef USART1_UDRE_vect
ISR(USART1_UDRE_vect)
@@ -422,7 +437,7 @@ size_t HardwareSerial::write(uint8_t c)
#elif defined(UBRR0H) && defined(UBRR0L)
HardwareSerial Serial(&rx_buffer, &tx_buffer, &UBRR0H, &UBRR0L, &UCSR0A, &UCSR0B, &UDR0, RXEN0, TXEN0, RXCIE0, UDRIE0, U2X0);
#elif defined(USBCON)
- #warning no serial port defined (port 0)
+ // do nothing - Serial object and buffers are initialized in CDC code
#else
#error no serial port defined (port 0)
#endif