Skip to content

Commit b4110d5

Browse files
authored
Update USBAPI.h
1 parent 59d3fba commit b4110d5

File tree

1 file changed

+24
-44
lines changed

1 file changed

+24
-44
lines changed

cores/arduino/USBAPI.h

Lines changed: 24 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ typedef unsigned long u32;
4343
#include "USBDesc.h"
4444
#include "USBCore.h"
4545

46+
#include "ArduinoDS4/ArduinoDS4_USBDesc.h"
47+
4648
//================================================================================
4749
//================================================================================
4850
// USB
@@ -92,24 +94,20 @@ class Serial_ : public Stream
9294
private:
9395
int peek_buffer;
9496
public:
95-
Serial_() { peek_buffer = -1; };
96-
void begin(unsigned long);
97-
void begin(unsigned long, uint8_t);
98-
void end(void);
99-
100-
virtual int available(void);
101-
virtual int peek(void);
102-
virtual int read(void);
103-
virtual int availableForWrite(void);
104-
virtual void flush(void);
105-
virtual size_t write(uint8_t);
106-
virtual size_t write(const uint8_t*, size_t);
97+
Serial_() {};
98+
void begin(unsigned long) {}
99+
void begin(unsigned long, uint8_t) {}
100+
void end(void) {}
101+
102+
virtual int available(void) { return -1; }
103+
virtual int peek(void) { return -1; }
104+
virtual int read(void) { return -1; }
105+
virtual int availableForWrite(void) { return -1; }
106+
virtual void flush(void) {}
107+
virtual size_t write(uint8_t) { return -1; }
108+
virtual size_t write(const uint8_t*, size_t n) { return n; }
107109
using Print::write; // pull in write(str) and write(buf, size) from Print
108-
operator bool();
109-
110-
volatile uint8_t _rx_buffer_head;
111-
volatile uint8_t _rx_buffer_tail;
112-
unsigned char _rx_buffer[SERIAL_BUFFER_SIZE];
110+
operator bool() { return true; }
113111

114112
// This method allows processing "SEND_BREAK" requests sent by
115113
// the USB host. Those requests indicate that the host wants to
@@ -126,17 +124,17 @@ class Serial_ : public Stream
126124
// first request is lost.
127125
// Note that the value returned is a long, so it can return
128126
// 0-0xffff as well as -1.
129-
int32_t readBreak();
127+
int32_t readBreak() { return -1; };
130128

131129
// These return the settings specified by the USB host for the
132130
// serial port. These aren't really used, but are offered here
133131
// in case a sketch wants to act on these settings.
134-
uint32_t baud();
135-
uint8_t stopbits();
136-
uint8_t paritytype();
137-
uint8_t numbits();
138-
bool dtr();
139-
bool rts();
132+
uint32_t baud() { return 0; }
133+
uint8_t stopbits() { return 1; }
134+
uint8_t paritytype() { return 0; }
135+
uint8_t numbits() { return 8; }
136+
bool dtr() { return true; }
137+
bool rts() { return true; }
140138
enum {
141139
ONE_STOP_BIT = 0,
142140
ONE_AND_HALF_STOP_BIT = 1,
@@ -169,26 +167,6 @@ typedef struct
169167
uint16_t wLength;
170168
} USBSetup;
171169

172-
//================================================================================
173-
//================================================================================
174-
// MSC 'Driver'
175-
176-
int MSC_GetInterface(uint8_t* interfaceNum);
177-
int MSC_GetDescriptor(int i);
178-
bool MSC_Setup(USBSetup& setup);
179-
bool MSC_Data(uint8_t rx,uint8_t tx);
180-
181-
//================================================================================
182-
//================================================================================
183-
// CSC 'Driver'
184-
185-
int CDC_GetInterface(uint8_t* interfaceNum);
186-
int CDC_GetDescriptor(int i);
187-
bool CDC_Setup(USBSetup& setup);
188-
189-
//================================================================================
190-
//================================================================================
191-
192170
#define TRANSFER_PGM 0x80
193171
#define TRANSFER_RELEASE 0x40
194172
#define TRANSFER_ZERO 0x20
@@ -204,6 +182,8 @@ int USB_Recv(uint8_t ep, void* data, int len); // non-blocking
204182
int USB_Recv(uint8_t ep); // non-blocking
205183
void USB_Flush(uint8_t ep);
206184

185+
#include "ArduinoDS4_USBAPI.h"
186+
207187
#endif
208188

209189
#endif /* if defined(USBCON) */

0 commit comments

Comments
 (0)