24 #include <avr/pgmspace.h> 25 #include <avr/eeprom.h> 26 #include <avr/interrupt.h> 27 #include <util/delay.h> 29 typedef unsigned char u8;
30 typedef unsigned short u16;
31 typedef unsigned long u32;
38 #define USB_EP_SIZE 64 50 #define EP_TYPE_CONTROL (0x00) 51 #define EP_TYPE_BULK_IN ((1<<EPTYPE1) | (1<<EPDIR)) 52 #define EP_TYPE_BULK_OUT (1<<EPTYPE1) 53 #define EP_TYPE_INTERRUPT_IN ((1<<EPTYPE1) | (1<<EPTYPE0) | (1<<EPDIR)) 54 #define EP_TYPE_INTERRUPT_OUT ((1<<EPTYPE1) | (1<<EPTYPE0)) 55 #define EP_TYPE_ISOCHRONOUS_IN ((1<<EPTYPE0) | (1<<EPDIR)) 56 #define EP_TYPE_ISOCHRONOUS_OUT (1<<EPTYPE0) 69 extern USBDevice_ USBDevice;
77 #ifndef SERIAL_BUFFER_SIZE 78 #if ((RAMEND - RAMSTART) < 1023) 79 #define SERIAL_BUFFER_SIZE 16 81 #define SERIAL_BUFFER_SIZE 64 84 #if (SERIAL_BUFFER_SIZE>256) 85 #error Please lower the CDC Buffer size 88 class Serial_ :
public Stream 93 Serial_() { peek_buffer = -1; };
94 void begin(
unsigned long);
95 void begin(
unsigned long, uint8_t);
98 virtual int available(
void);
99 virtual int peek(
void);
100 virtual int read(
void);
101 virtual int availableForWrite(
void);
102 virtual void flush(
void);
103 virtual size_t write(uint8_t);
104 virtual size_t write(
const uint8_t*,
size_t);
108 volatile uint8_t _rx_buffer_head;
109 volatile uint8_t _rx_buffer_tail;
110 unsigned char _rx_buffer[SERIAL_BUFFER_SIZE];
134 uint8_t paritytype();
140 ONE_AND_HALF_STOP_BIT = 1,
152 extern Serial_ Serial;
154 #define HAVE_CDCSERIAL 162 uint8_t bmRequestType;
174 int MSC_GetInterface(uint8_t* interfaceNum);
175 int MSC_GetDescriptor(
int i);
176 bool MSC_Setup(USBSetup&
setup);
177 bool MSC_Data(uint8_t rx,uint8_t tx);
183 int CDC_GetInterface(uint8_t* interfaceNum);
184 int CDC_GetDescriptor(
int i);
185 bool CDC_Setup(USBSetup&
setup);
190 #define TRANSFER_PGM 0x80 191 #define TRANSFER_RELEASE 0x40 192 #define TRANSFER_ZERO 0x20 194 int USB_SendControl(uint8_t flags,
const void*
d,
int len);
195 int USB_RecvControl(
void*
d,
int len);
196 int USB_RecvControlLong(
void*
d,
int len);
198 uint8_t USB_Available(uint8_t ep);
199 uint8_t USB_SendSpace(uint8_t ep);
200 int USB_Send(uint8_t ep,
const void*
data,
int len);
201 int USB_Recv(uint8_t ep,
void*
data,
int len);
202 int USB_Recv(uint8_t ep);
203 void USB_Flush(uint8_t ep);
virtual size_t write(uint8_t)=0
EIGEN_STRONG_INLINE iterator begin()
GLint GLenum GLsizei GLint GLsizei const GLvoid * data