Skip to content

Commit 7c7fc5d

Browse files
committed
Fixed CDC_SERIAL_BUFFER_SIZE macros (PeterVH)
1 parent a8d9580 commit 7c7fc5d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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)