mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-30 19:52:13 +01:00
RX and TX Serial buffer sizes can now be defined independently
Fixes #2597
This commit is contained in:
parent
40cd971f61
commit
d2595129c5
@ -34,12 +34,17 @@
|
|||||||
// location from which to read.
|
// location from which to read.
|
||||||
// NOTE: a "power of 2" buffer size is reccomended to dramatically
|
// NOTE: a "power of 2" buffer size is reccomended to dramatically
|
||||||
// optimize all the modulo operations for ring buffers.
|
// 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)
|
#if (RAMEND < 1000)
|
||||||
#define SERIAL_TX_BUFFER_SIZE 16
|
#define SERIAL_TX_BUFFER_SIZE 16
|
||||||
#define SERIAL_RX_BUFFER_SIZE 16
|
|
||||||
#else
|
#else
|
||||||
#define SERIAL_TX_BUFFER_SIZE 64
|
#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
|
#define SERIAL_RX_BUFFER_SIZE 64
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -59,11 +59,16 @@ extern USBDevice_ USBDevice;
|
|||||||
|
|
||||||
struct ring_buffer;
|
struct ring_buffer;
|
||||||
|
|
||||||
|
#ifndef SERIAL_BUFFER_SIZE
|
||||||
#if (RAMEND < 1000)
|
#if (RAMEND < 1000)
|
||||||
#define SERIAL_BUFFER_SIZE 16
|
#define SERIAL_BUFFER_SIZE 16
|
||||||
#else
|
#else
|
||||||
#define SERIAL_BUFFER_SIZE 64
|
#define SERIAL_BUFFER_SIZE 64
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#if (SERIAL_BUFFER_SIZE>256)
|
||||||
|
#error Please lower the CDC Buffer size
|
||||||
|
#endif
|
||||||
|
|
||||||
class Serial_ : public Stream
|
class Serial_ : public Stream
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user