aboutsummaryrefslogtreecommitdiff
path: root/cores/robot/USBAPI.h
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@bug.st>2013-07-27 12:06:42 +0200
committerCristian Maglie <c.maglie@bug.st>2013-07-27 12:06:42 +0200
commit4de497b72504c62cd41b9930db4a53fb2280e6c8 (patch)
treeb5a2ade5ada34f04be94ca2ccee398eb683d34f4 /cores/robot/USBAPI.h
parentcddc83bb19e760145ea312f187371f44a6a921e8 (diff)
Move buffers into USB CDC (look #947 and #1369 for reference)
Diffstat (limited to 'cores/robot/USBAPI.h')
-rw-r--r--cores/robot/USBAPI.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/cores/robot/USBAPI.h b/cores/robot/USBAPI.h
index 1a4183b..cabecf3 100644
--- a/cores/robot/USBAPI.h
+++ b/cores/robot/USBAPI.h
@@ -27,10 +27,14 @@ extern USBDevice_ USBDevice;
struct ring_buffer;
+#if (RAMEND < 1000)
+#define SERIAL_BUFFER_SIZE 16
+#else
+#define SERIAL_BUFFER_SIZE 64
+#endif
+
class Serial_ : public Stream
{
-private:
- ring_buffer *_cdc_rx_buffer;
public:
void begin(uint16_t baud_count);
void end(void);
@@ -43,6 +47,10 @@ public:
virtual size_t write(uint8_t);
using Print::write; // pull in write(str) and write(buf, size) from Print
operator bool();
+
+ volatile uint8_t _rx_buffer_head;
+ volatile uint8_t _rx_buffer_tail;
+ unsigned char _rx_buffer[SERIAL_BUFFER_SIZE];
};
extern Serial_ Serial;