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/xinput/USB_XInput_Descriptors.h | 46 +++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 cores/arduino/xinput/USB_XInput_Descriptors.h (limited to 'cores/arduino/xinput/USB_XInput_Descriptors.h') diff --git a/cores/arduino/xinput/USB_XInput_Descriptors.h b/cores/arduino/xinput/USB_XInput_Descriptors.h new file mode 100644 index 0000000..e8c3c24 --- /dev/null +++ b/cores/arduino/xinput/USB_XInput_Descriptors.h @@ -0,0 +1,46 @@ +/* + * Project Arduino XInput - AVR Core + * @author David Madison + * @link github.com/dmadison/ArduinoXInput_AVR + * @license MIT - Copyright (c) 2019 David Madison + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + */ + +#include "USBAPI.h" + +#ifndef USB_XINPUT_DESCRIPTORS_H +#define USB_XINPUT_DESCRIPTORS_H + +#if defined(USBCON) + +extern const DeviceDescriptor USB_DeviceDescriptor PROGMEM; +extern const u8 USB_ConfigDescriptor[] PROGMEM; +extern const u16 USB_ConfigDescriptorSize PROGMEM; + +#undef USB_VID +#define USB_VID 0x045E + +#undef USB_PID +#define USB_PID 0x028E + +#endif /* if defined(USBCON) */ + +#endif /* ifndef USB_XINPUT_DESCRIPTORS_H */ -- cgit v1.2.3-18-g5258 From a326a6ed8ee990acd8452adb2733a7c5f8a9963c Mon Sep 17 00:00:00 2001 From: David Madison Date: Sun, 17 Feb 2019 17:05:16 -0500 Subject: Add XInput string descriptors --- cores/arduino/xinput/USB_XInput_Descriptors.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cores/arduino/xinput/USB_XInput_Descriptors.h') diff --git a/cores/arduino/xinput/USB_XInput_Descriptors.h b/cores/arduino/xinput/USB_XInput_Descriptors.h index e8c3c24..8cb19df 100644 --- a/cores/arduino/xinput/USB_XInput_Descriptors.h +++ b/cores/arduino/xinput/USB_XInput_Descriptors.h @@ -31,10 +31,19 @@ #if defined(USBCON) +// Device Descriptor extern const DeviceDescriptor USB_DeviceDescriptor PROGMEM; + +// Config Descriptor extern const u8 USB_ConfigDescriptor[] PROGMEM; extern const u16 USB_ConfigDescriptorSize PROGMEM; +// String Descriptors +extern const u8 STRING_SERIAL[] PROGMEM; +extern const u8 STRING_SECURITY[] PROGMEM; + +#define ISECURITY 4 + #undef USB_VID #define USB_VID 0x045E -- cgit v1.2.3-18-g5258 From 697a840e1b23a06f595bc2dbd75bcaacb9a1a8ad Mon Sep 17 00:00:00 2001 From: David Madison Date: Tue, 19 Feb 2019 12:41:46 -0500 Subject: Add XInput endpoint number defines --- cores/arduino/xinput/USB_XInput_Descriptors.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cores/arduino/xinput/USB_XInput_Descriptors.h') diff --git a/cores/arduino/xinput/USB_XInput_Descriptors.h b/cores/arduino/xinput/USB_XInput_Descriptors.h index 8cb19df..21697fb 100644 --- a/cores/arduino/xinput/USB_XInput_Descriptors.h +++ b/cores/arduino/xinput/USB_XInput_Descriptors.h @@ -44,6 +44,10 @@ extern const u8 STRING_SECURITY[] PROGMEM; #define ISECURITY 4 +// Endpoint Numbers +#define XINPUT_TX_ENDPOINT 1 +#define XINPUT_RX_ENDPOINT 2 + #undef USB_VID #define USB_VID 0x045E -- cgit v1.2.3-18-g5258 From 058af1724d130745167f670272630ed2811d1317 Mon Sep 17 00:00:00 2001 From: David Madison Date: Tue, 19 Feb 2019 12:50:10 -0500 Subject: Change VID and PID in boards.txt Better to set these where intended so they can be easily overridden if need be. --- cores/arduino/xinput/USB_XInput_Descriptors.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'cores/arduino/xinput/USB_XInput_Descriptors.h') diff --git a/cores/arduino/xinput/USB_XInput_Descriptors.h b/cores/arduino/xinput/USB_XInput_Descriptors.h index 21697fb..976fe56 100644 --- a/cores/arduino/xinput/USB_XInput_Descriptors.h +++ b/cores/arduino/xinput/USB_XInput_Descriptors.h @@ -48,12 +48,6 @@ extern const u8 STRING_SECURITY[] PROGMEM; #define XINPUT_TX_ENDPOINT 1 #define XINPUT_RX_ENDPOINT 2 -#undef USB_VID -#define USB_VID 0x045E - -#undef USB_PID -#define USB_PID 0x028E - #endif /* if defined(USBCON) */ #endif /* ifndef USB_XINPUT_DESCRIPTORS_H */ -- cgit v1.2.3-18-g5258