From 2307486942f246aca947d770849b5d05822d7d17 Mon Sep 17 00:00:00 2001 From: David Madison Date: Fri, 15 Feb 2019 14:27:49 -0500 Subject: Replace Serial with null Allows sketches using Serial to compile but discards all data --- cores/arduino/USBAPI.h | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) (limited to 'cores/arduino/USBAPI.h') diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h index 479ced9..06dd737 100644 --- a/cores/arduino/USBAPI.h +++ b/cores/arduino/USBAPI.h @@ -87,27 +87,21 @@ struct ring_buffer; 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 int peek(void); - virtual int read(void); - virtual int availableForWrite(void); - virtual void flush(void); - virtual size_t write(uint8_t); - virtual size_t write(const uint8_t*, size_t); + Serial_() {}; + void begin(unsigned long) {} + void begin(unsigned long, uint8_t) {} + void end(void) {} + + virtual int available(void) { return -1; } + virtual int peek(void) { return -1; } + virtual int read(void) { return -1; } + virtual int availableForWrite(void) { return 0; } + virtual void flush(void) {} + virtual size_t write(uint8_t) { return 1; } + virtual size_t write(const uint8_t*, size_t n) { return n; } 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]; + operator bool() { return true; } // This method allows processing "SEND_BREAK" requests sent by // the USB host. Those requests indicate that the host wants to @@ -124,17 +118,17 @@ public: // first request is lost. // Note that the value returned is a long, so it can return // 0-0xffff as well as -1. - int32_t readBreak(); + int32_t readBreak() { return -1; }; // These return the settings specified by the USB host for the // serial port. These aren't really used, but are offered here // in case a sketch wants to act on these settings. - uint32_t baud(); - uint8_t stopbits(); - uint8_t paritytype(); - uint8_t numbits(); - bool dtr(); - bool rts(); + uint32_t baud() { return 0; } + uint8_t stopbits() { return 1; } + uint8_t paritytype() { return 0; } + uint8_t numbits() { return 8; } + bool dtr() { return true; } + bool rts() { return true; } enum { ONE_STOP_BIT = 0, ONE_AND_HALF_STOP_BIT = 1, -- cgit v1.2.3-18-g5258 From 3364c6f736a77e60f26273af0bb021f4507dd1b9 Mon Sep 17 00:00:00 2001 From: David Madison Date: Fri, 15 Feb 2019 14:44:45 -0500 Subject: Removed USB CDC Serial This will compile but will NOT enumerate properly without a config descriptor. You've been warned... --- cores/arduino/USBAPI.h | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'cores/arduino/USBAPI.h') diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h index 06dd737..04e3dd9 100644 --- a/cores/arduino/USBAPI.h +++ b/cores/arduino/USBAPI.h @@ -161,23 +161,6 @@ typedef struct uint16_t wLength; } USBSetup; -//================================================================================ -//================================================================================ -// MSC 'Driver' - -int MSC_GetInterface(uint8_t* interfaceNum); -int MSC_GetDescriptor(int i); -bool MSC_Setup(USBSetup& setup); -bool MSC_Data(uint8_t rx,uint8_t tx); - -//================================================================================ -//================================================================================ -// CSC 'Driver' - -int CDC_GetInterface(uint8_t* interfaceNum); -int CDC_GetDescriptor(int i); -bool CDC_Setup(USBSetup& setup); - //================================================================================ //================================================================================ -- cgit v1.2.3-18-g5258 From 60b8a6df837a31bc9783cf34a98bcda9917b7ba6 Mon Sep 17 00:00:00 2001 From: David Madison Date: Sun, 17 Feb 2019 14:18:23 -0500 Subject: Add XInput device and config descriptors --- cores/arduino/USBAPI.h | 1 + 1 file changed, 1 insertion(+) (limited to 'cores/arduino/USBAPI.h') diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h index 04e3dd9..86713dd 100644 --- a/cores/arduino/USBAPI.h +++ b/cores/arduino/USBAPI.h @@ -42,6 +42,7 @@ typedef unsigned long u32; #include "USBDesc.h" #include "USBCore.h" +#include "xinput/USB_XInput_Descriptors.h" //================================================================================ //================================================================================ -- cgit v1.2.3-18-g5258 From a7b370bf9657dccc9038d6611ea289d996b53621 Mon Sep 17 00:00:00 2001 From: David Madison Date: Thu, 21 Feb 2019 10:55:11 -0500 Subject: Add XInput USB API --- cores/arduino/USBAPI.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cores/arduino/USBAPI.h') diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h index 86713dd..0f7d171 100644 --- a/cores/arduino/USBAPI.h +++ b/cores/arduino/USBAPI.h @@ -180,6 +180,8 @@ int USB_Recv(uint8_t ep, void* data, int len); // non-blocking int USB_Recv(uint8_t ep); // non-blocking void USB_Flush(uint8_t ep); +#include "xinput/USB_XInput_API.h" + #endif #endif /* if defined(USBCON) */ -- cgit v1.2.3-18-g5258