aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/USBAPI.h
diff options
context:
space:
mode:
Diffstat (limited to 'cores/arduino/USBAPI.h')
-rw-r--r--cores/arduino/USBAPI.h42
1 files changed, 41 insertions, 1 deletions
diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h
index 5a33002..5837b3e 100644
--- a/cores/arduino/USBAPI.h
+++ b/cores/arduino/USBAPI.h
@@ -1,10 +1,42 @@
+/*
+ USBAPI.h
+ Copyright (c) 2005-2014 Arduino. All right reserved.
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
#ifndef __USBAPI__
#define __USBAPI__
+#include <inttypes.h>
+#include <avr/pgmspace.h>
+#include <avr/eeprom.h>
+#include <avr/interrupt.h>
+#include <util/delay.h>
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+
+#include "Arduino.h"
+
#if defined(USBCON)
+#include "USBDesc.h"
+#include "USBCore.h"
+
//================================================================================
//================================================================================
// USB
@@ -27,25 +59,33 @@ extern USBDevice_ USBDevice;
struct ring_buffer;
+#ifndef SERIAL_BUFFER_SIZE
#if (RAMEND < 1000)
#define SERIAL_BUFFER_SIZE 16
#else
#define SERIAL_BUFFER_SIZE 64
#endif
+#endif
+#if (SERIAL_BUFFER_SIZE>256)
+#error Please lower the CDC Buffer size
+#endif
class Serial_ : public Stream
{
+private:
+ int peek_buffer;
public:
+ Serial_() { peek_buffer = -1; };
void begin(unsigned long);
void begin(unsigned long, uint8_t);
void end(void);
virtual int available(void);
- virtual void accept(void);
virtual int peek(void);
virtual int read(void);
virtual void flush(void);
virtual size_t write(uint8_t);
+ virtual size_t write(const uint8_t*, size_t);
using Print::write; // pull in write(str) and write(buf, size) from Print
operator bool();