102 PID = udd->idProduct;
105 goto FailUnknownDevice;
122 #ifdef DEBUG_USB_HOST 124 D_PrintHex<uint8_t > (rcode, 0x80);
130 D_PrintHex<uint8_t > (
bAddress, 0x80);
146 goto FailSetDevTblEntry;
148 num_of_conf = udd->bNumConfigurations;
153 for(uint8_t i = 0; i < num_of_conf; i++) {
157 goto FailGetConfDescr;
163 goto FailUnknownDevice;
167 goto FailSetDevTblEntry;
173 goto FailSetConfDescr;
175 #ifdef DEBUG_USB_HOST 176 Notify(
PSTR(
"\r\nXbox One Controller Connected\r\n"), 0x80);
189 rcode = XboxCommand(writeBuf, 5);
200 #ifdef DEBUG_USB_HOST 206 #ifdef DEBUG_USB_HOST 212 #ifdef DEBUG_USB_HOST 218 #ifdef DEBUG_USB_HOST 224 #ifdef DEBUG_USB_HOST 230 #ifdef DEBUG_USB_HOST 231 Notify(
PSTR(
"\r\nXbox One Init Failed, error code: "), 0x80);
240 uint8_t iface __attribute__((unused)),
241 uint8_t alt __attribute__((unused)),
242 uint8_t proto __attribute__((unused)),
260 if(pollInterval < pep->bInterval)
266 __attribute__((unused)))
269 Notify(
PSTR(
"\r\nEndpoint descriptor:"), 0x80);
271 D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
273 D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
275 D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
277 D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
279 D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
281 D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
294 #ifdef DEBUG_USB_HOST 295 Notify(
PSTR(
"\r\nXbox One Controller Disconnected\r\n"), 0x80);
312 #ifdef PRINTREPORT // Uncomment "#define PRINTREPORT" to print the report send by the Xbox ONE Controller 313 for(uint8_t i = 0; i < length; i++) {
314 D_PrintHex<uint8_t > (readBuf[i], 0x80);
320 #ifdef DEBUG_USB_HOST 321 else if(rcode !=
hrNAK) {
322 Notify(
PSTR(
"\r\nXbox One Poll Failed, error code: "), 0x80);
330 void XBOXONE::readReport() {
331 if(readBuf[0] == 0x07) {
338 if(ButtonState != OldButtonState) {
339 ButtonClickState = ButtonState & ~OldButtonState;
340 OldButtonState = ButtonState;
343 if(readBuf[0] != 0x20) {
346 D_PrintHex<uint8_t > (readBuf[0], 0x80);
353 ButtonState = xbox | (((uint16_t)readBuf[5] & 0xF) << 8) | (readBuf[4] & 0xF0) | (((uint16_t)readBuf[4] & 0x0C) << 10) | ((readBuf[4] & 0x01) << 3) | (((uint16_t)readBuf[5] & 0xC0) << 8) | ((readBuf[5] & 0x30) >> 4);
355 triggerValue[0] = (uint16_t)(((uint16_t)readBuf[7] << 8) | readBuf[6]);
356 triggerValue[1] = (uint16_t)(((uint16_t)readBuf[9] << 8) | readBuf[8]);
358 hatValue[
LeftHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
359 hatValue[
LeftHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
360 hatValue[
RightHatX] = (int16_t)(((uint16_t)readBuf[15] << 8) | readBuf[14]);
361 hatValue[
RightHatY] = (int16_t)(((uint16_t)readBuf[17] << 8) | readBuf[16]);
366 if(ButtonState != OldButtonState) {
367 ButtonClickState = ButtonState & ~OldButtonState;
368 OldButtonState = ButtonState;
372 if(triggerValue[0] != 0 && triggerValueOld[0] == 0)
374 triggerValueOld[0] = triggerValue[0];
375 if(triggerValue[1] != 0 && triggerValueOld[1] == 0)
377 triggerValueOld[1] = triggerValue[1];
382 return triggerValue[0];
384 return triggerValue[1];
403 bool click = (ButtonClickState & button);
404 ButtonClickState &= ~button;
413 uint8_t XBOXONE::XboxCommand(uint8_t* data, uint16_t nbytes) {
414 data[2] = cmdCounter++;
416 #ifdef DEBUG_USB_HOST 417 Notify(
PSTR(
"\r\nXboxCommand, Return: "), 0x80);
418 D_PrintHex<uint8_t > (rcode, 0x80);
424 void XBOXONE::onInit() {
426 uint8_t writeBuf[13];
444 XboxCommand(writeBuf, 13);
451 uint8_t writeBuf[13];
469 XboxCommand(writeBuf, 13);
473 uint8_t writeBuf[13];
484 writeBuf[6] = leftTrigger;
485 writeBuf[7] = rightTrigger;
486 writeBuf[8] = leftMotor;
487 writeBuf[9] = rightMotor;
491 XboxCommand(writeBuf, 13);
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
@@ -76,11 +76,11 @@ $(function() {
#define pgm_read_word(addr)
-
+
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
-
+
#define USB_TRANSFER_TYPE_INTERRUPT
#define NotifyFailGetDevDescr(...)
@@ -88,7 +88,7 @@ $(function() {
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
virtual void FreeAddress(uint8_t addr)=0
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
-
+
@@ -97,7 +97,7 @@ $(function() {
#define NotifyFailGetConfDescr(...)
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
-
+
#define XBOX_ONE_MAX_ENDPOINTS
#define NotifyFailUnknownDevice(...)
@@ -113,14 +113,14 @@ $(function() {
uint16_t getButtonPress(ButtonEnum b)
-
+
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
#define XBOX_ONE_INPUT_PIPE
-
EpInfo epInfo[XBOX_ONE_MAX_ENDPOINTS]
+
EpInfo epInfo[XBOX_ONE_MAX_ENDPOINTS]
bool getButtonClick(ButtonEnum b)
@@ -143,7 +143,7 @@ $(function() {
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
#define NotifyFailSetConfDescr(...)
-
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
+
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
#define NotifyFailSetDevTblEntry(...)
void setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor)
diff --git a/_x_b_o_x_o_n_e_8h.html b/_x_b_o_x_o_n_e_8h.html
index 2322184b..9a8b1d65 100644
--- a/_x_b_o_x_o_n_e_8h.html
+++ b/_x_b_o_x_o_n_e_8h.html
@@ -118,6 +118,8 @@ Macros
|
#define | XBOX_ONE_PID13 0x0B0A |
|
+
#define | XBOX_ONE_PID14 0x0B12 |
+
|
#define | XBOX_VID2 0x0738 |
|
#define | XBOX_VID3 0x0E6F |
@@ -320,6 +322,22 @@ Macros
Definition at line 47 of file XBOXONE.h.
+