Skip to content

Commit e72eaa8

Browse files
committed
Fixed CDC_SERIAL_BUFFER_SIZE macros (PeterVH)
1 parent 95cadfe commit e72eaa8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

build/shared/revisions.txt

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ ARDUINO 1.5.2 BETA - 2012.01.23
2222
* sam: added CANRX1/CANTX1 pins 88/89 (same physical pin for 66/53)
2323
* sam: fixed analogWrite when used in very thight write loops (V.Dorrich)
2424
* sam: fixed USBSerial.write() while sending big buffers (Bill Dreschel)
25+
* sam: USBSerial receive buffer size is now 512 (PeterVH)
2526

2627
[libraries]
2728
* sam: Added Servo library

hardware/arduino/sam/cores/arduino/USB/CDC.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void Serial_::accept(void)
157157
{
158158
ring_buffer *buffer = &cdc_rx_buffer;
159159
uint32_t c = USBD_Recv(CDC_RX);
160-
uint32_t i = (uint32_t)(buffer->head+1) % SERIAL_BUFFER_SIZE;
160+
uint32_t i = (uint32_t)(buffer->head+1) % CDC_SERIAL_BUFFER_SIZE;
161161

162162
// if we should be storing the received character into the location
163163
// just before the tail (meaning that the head would advance to the
@@ -172,7 +172,7 @@ void Serial_::accept(void)
172172
int Serial_::available(void)
173173
{
174174
ring_buffer *buffer = &cdc_rx_buffer;
175-
return (unsigned int)(SERIAL_BUFFER_SIZE + buffer->head - buffer->tail) % SERIAL_BUFFER_SIZE;
175+
return (unsigned int)(CDC_SERIAL_BUFFER_SIZE + buffer->head - buffer->tail) % CDC_SERIAL_BUFFER_SIZE;
176176
}
177177

178178
int Serial_::peek(void)
@@ -201,7 +201,7 @@ int Serial_::read(void)
201201
else
202202
{
203203
unsigned char c = buffer->buffer[buffer->tail];
204-
buffer->tail = (unsigned int)(buffer->tail + 1) % SERIAL_BUFFER_SIZE;
204+
buffer->tail = (unsigned int)(buffer->tail + 1) % CDC_SERIAL_BUFFER_SIZE;
205205
return c;
206206
}
207207
}

0 commit comments

Comments
 (0)