aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/USBAPI.h
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@bug.st>2013-07-30 10:45:44 +0200
committerCristian Maglie <c.maglie@bug.st>2013-07-30 10:45:44 +0200
commitacb3df6d4398e1df2e350cd5e8f1d742bee97316 (patch)
treee5e17a3863fbc97e6d4d93254670a9924df67c86 /cores/arduino/USBAPI.h
parent1895d696b1fd11488e469fb17549263c24548d0d (diff)
parent99bb4a573fa71a4e6c30cad144284d12b3f7edd0 (diff)
Merge branch 'ide-1.5.x' into dev-ide-1.5.x-discovery
Conflicts: hardware/arduino/avr/cores/arduino/USBCore.cpp
Diffstat (limited to 'cores/arduino/USBAPI.h')
-rw-r--r--cores/arduino/USBAPI.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h
index eb2e593..cabecf3 100644
--- a/cores/arduino/USBAPI.h
+++ b/cores/arduino/USBAPI.h
@@ -25,10 +25,16 @@ extern USBDevice_ USBDevice;
//================================================================================
// Serial over CDC (Serial1 is the physical port)
+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);
@@ -41,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;
@@ -193,4 +203,4 @@ void USB_Flush(uint8_t ep);
#endif
-#endif /* if defined(USBCON) */ \ No newline at end of file
+#endif /* if defined(USBCON) */