From 3da4d500df77fe5a2f4cc27bf9dc976acb39b681 Mon Sep 17 00:00:00 2001 From: Nico Date: Mon, 2 Feb 2015 20:27:17 +0100 Subject: [PATCH 1/4] Update USBAPI.h --- hardware/arduino/avr/cores/arduino/USBAPI.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hardware/arduino/avr/cores/arduino/USBAPI.h b/hardware/arduino/avr/cores/arduino/USBAPI.h index 2fab957f930..d4cae0f600f 100644 --- a/hardware/arduino/avr/cores/arduino/USBAPI.h +++ b/hardware/arduino/avr/cores/arduino/USBAPI.h @@ -59,11 +59,13 @@ extern USBDevice_ USBDevice; struct ring_buffer; +#ifndef SERIAL_BUFFER_SIZE #if (RAMEND < 1000) #define SERIAL_BUFFER_SIZE 16 #else #define SERIAL_BUFFER_SIZE 64 #endif +#endif class Serial_ : public Stream { From 996fa141ec7cd37384cce73b04d86bb6c4100b38 Mon Sep 17 00:00:00 2001 From: Nico Date: Mon, 2 Feb 2015 20:29:00 +0100 Subject: [PATCH 2/4] Update HardwareSerial.h --- hardware/arduino/avr/cores/arduino/HardwareSerial.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hardware/arduino/avr/cores/arduino/HardwareSerial.h b/hardware/arduino/avr/cores/arduino/HardwareSerial.h index 7dc2aa98c4e..203008d97a9 100644 --- a/hardware/arduino/avr/cores/arduino/HardwareSerial.h +++ b/hardware/arduino/avr/cores/arduino/HardwareSerial.h @@ -34,12 +34,17 @@ // location from which to read. // NOTE: a "power of 2" buffer size is reccomended to dramatically // optimize all the modulo operations for ring buffers. -#if !(defined(SERIAL_TX_BUFFER_SIZE) && defined(SERIAL_RX_BUFFER_SIZE)) +#if !(defined(SERIAL_TX_BUFFER_SIZE) #if (RAMEND < 1000) #define SERIAL_TX_BUFFER_SIZE 16 -#define SERIAL_RX_BUFFER_SIZE 16 #else #define SERIAL_TX_BUFFER_SIZE 64 +#endif +#endif +#if !defined(SERIAL_RX_BUFFER_SIZE)) +#if (RAMEND < 1000) +#define SERIAL_RX_BUFFER_SIZE 16 +#else #define SERIAL_RX_BUFFER_SIZE 64 #endif #endif From bf044c12aa60547f10870233b9b6e8dc1439ed16 Mon Sep 17 00:00:00 2001 From: Nico Date: Mon, 2 Feb 2015 20:32:55 +0100 Subject: [PATCH 3/4] Update USBAPI.h --- hardware/arduino/avr/cores/arduino/USBAPI.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hardware/arduino/avr/cores/arduino/USBAPI.h b/hardware/arduino/avr/cores/arduino/USBAPI.h index d4cae0f600f..5837b3e1130 100644 --- a/hardware/arduino/avr/cores/arduino/USBAPI.h +++ b/hardware/arduino/avr/cores/arduino/USBAPI.h @@ -66,6 +66,9 @@ struct ring_buffer; #define SERIAL_BUFFER_SIZE 64 #endif #endif +#if (SERIAL_BUFFER_SIZE>256) +#error Please lower the CDC Buffer size +#endif class Serial_ : public Stream { From 3e66e0898288860859fa1048cc7d47fe186c111e Mon Sep 17 00:00:00 2001 From: Nico Date: Mon, 2 Feb 2015 21:31:46 +0100 Subject: [PATCH 4/4] Update HardwareSerial.h --- hardware/arduino/avr/cores/arduino/HardwareSerial.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hardware/arduino/avr/cores/arduino/HardwareSerial.h b/hardware/arduino/avr/cores/arduino/HardwareSerial.h index 203008d97a9..7f4f162d688 100644 --- a/hardware/arduino/avr/cores/arduino/HardwareSerial.h +++ b/hardware/arduino/avr/cores/arduino/HardwareSerial.h @@ -34,14 +34,14 @@ // location from which to read. // NOTE: a "power of 2" buffer size is reccomended to dramatically // optimize all the modulo operations for ring buffers. -#if !(defined(SERIAL_TX_BUFFER_SIZE) +#if !defined(SERIAL_TX_BUFFER_SIZE) #if (RAMEND < 1000) #define SERIAL_TX_BUFFER_SIZE 16 #else #define SERIAL_TX_BUFFER_SIZE 64 #endif #endif -#if !defined(SERIAL_RX_BUFFER_SIZE)) +#if !defined(SERIAL_RX_BUFFER_SIZE) #if (RAMEND < 1000) #define SERIAL_RX_BUFFER_SIZE 16 #else