From e72eaa858a84ed9977ad5a1d822ae3f44b798273 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Sun, 27 Jan 2013 12:49:25 +0100 Subject: [PATCH] Fixed CDC_SERIAL_BUFFER_SIZE macros (PeterVH) --- build/shared/revisions.txt | 1 + hardware/arduino/sam/cores/arduino/USB/CDC.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build/shared/revisions.txt b/build/shared/revisions.txt index aebe95845..6d516b037 100644 --- a/build/shared/revisions.txt +++ b/build/shared/revisions.txt @@ -22,6 +22,7 @@ ARDUINO 1.5.2 BETA - 2012.01.23 * sam: added CANRX1/CANTX1 pins 88/89 (same physical pin for 66/53) * sam: fixed analogWrite when used in very thight write loops (V.Dorrich) * sam: fixed USBSerial.write() while sending big buffers (Bill Dreschel) +* sam: USBSerial receive buffer size is now 512 (PeterVH) [libraries] * sam: Added Servo library diff --git a/hardware/arduino/sam/cores/arduino/USB/CDC.cpp b/hardware/arduino/sam/cores/arduino/USB/CDC.cpp index 3ced20377..6b7749ee2 100644 --- a/hardware/arduino/sam/cores/arduino/USB/CDC.cpp +++ b/hardware/arduino/sam/cores/arduino/USB/CDC.cpp @@ -157,7 +157,7 @@ void Serial_::accept(void) { ring_buffer *buffer = &cdc_rx_buffer; uint32_t c = USBD_Recv(CDC_RX); - uint32_t i = (uint32_t)(buffer->head+1) % SERIAL_BUFFER_SIZE; + uint32_t i = (uint32_t)(buffer->head+1) % CDC_SERIAL_BUFFER_SIZE; // if we should be storing the received character into the location // just before the tail (meaning that the head would advance to the @@ -172,7 +172,7 @@ void Serial_::accept(void) int Serial_::available(void) { ring_buffer *buffer = &cdc_rx_buffer; - return (unsigned int)(SERIAL_BUFFER_SIZE + buffer->head - buffer->tail) % SERIAL_BUFFER_SIZE; + return (unsigned int)(CDC_SERIAL_BUFFER_SIZE + buffer->head - buffer->tail) % CDC_SERIAL_BUFFER_SIZE; } int Serial_::peek(void) @@ -201,7 +201,7 @@ int Serial_::read(void) else { unsigned char c = buffer->buffer[buffer->tail]; - buffer->tail = (unsigned int)(buffer->tail + 1) % SERIAL_BUFFER_SIZE; + buffer->tail = (unsigned int)(buffer->tail + 1) % CDC_SERIAL_BUFFER_SIZE; return c; } }