From 090d53a74e1ebe256523608c4b7fd90304d611b9 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 26 Jul 2013 12:50:17 +0200 Subject: Fixed compile problem for Leonardo after 0bd6a2d20fb9664255b20e0db11dd4586ebe9007 --- cores/arduino/USBAPI.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cores/arduino/USBAPI.h') diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h index eb2e593..1a4183b 100644 --- a/cores/arduino/USBAPI.h +++ b/cores/arduino/USBAPI.h @@ -25,6 +25,8 @@ extern USBDevice_ USBDevice; //================================================================================ // Serial over CDC (Serial1 is the physical port) +struct ring_buffer; + class Serial_ : public Stream { private: @@ -193,4 +195,4 @@ void USB_Flush(uint8_t ep); #endif -#endif /* if defined(USBCON) */ \ No newline at end of file +#endif /* if defined(USBCON) */ -- cgit v1.2.3-18-g5258 From 4de497b72504c62cd41b9930db4a53fb2280e6c8 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Sat, 27 Jul 2013 12:06:42 +0200 Subject: Move buffers into USB CDC (look #947 and #1369 for reference) --- cores/arduino/USBAPI.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'cores/arduino/USBAPI.h') diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h index 1a4183b..cabecf3 100644 --- a/cores/arduino/USBAPI.h +++ b/cores/arduino/USBAPI.h @@ -27,10 +27,14 @@ extern USBDevice_ USBDevice; struct ring_buffer; +#if (RAMEND < 1000) +#define SERIAL_BUFFER_SIZE 16 +#else +#define SERIAL_BUFFER_SIZE 64 +#endif + class Serial_ : public Stream { -private: - ring_buffer *_cdc_rx_buffer; public: void begin(uint16_t baud_count); void end(void); @@ -43,6 +47,10 @@ public: virtual size_t write(uint8_t); using Print::write; // pull in write(str) and write(buf, size) from Print operator bool(); + + volatile uint8_t _rx_buffer_head; + volatile uint8_t _rx_buffer_tail; + unsigned char _rx_buffer[SERIAL_BUFFER_SIZE]; }; extern Serial_ Serial; -- cgit v1.2.3-18-g5258