From ec0f008d7489334727dcd2c94394f2d439a3c399 Mon Sep 17 00:00:00 2001 From: Lauszus Date: Sun, 2 May 2021 14:19:40 +0000 Subject: [PATCH] deploy: e94343a49e322bb10b985158388e963dfa5a5552 --- _x_b_o_x_o_n_e_8cpp_source.html | 158 ++++++++++++++++---------------- _x_b_o_x_o_n_e_8h_source.html | 4 +- class_x_b_o_x_o_n_e.html | 4 +- 3 files changed, 84 insertions(+), 82 deletions(-) diff --git a/_x_b_o_x_o_n_e_8cpp_source.html b/_x_b_o_x_o_n_e_8cpp_source.html index ed9655ad..980a520a 100644 --- a/_x_b_o_x_o_n_e_8cpp_source.html +++ b/_x_b_o_x_o_n_e_8cpp_source.html @@ -484,89 +484,91 @@ $(function() {
416  data[2] = cmdCounter++; // Increment the output command counter
417  uint8_t rcode = pUsb->outTransfer(bAddress, epInfo[ XBOX_ONE_OUTPUT_PIPE ].epAddr, nbytes, data);
418 #ifdef DEBUG_USB_HOST
-
419  Notify(PSTR("\r\nXboxCommand, Return: "), 0x80);
-
420  D_PrintHex<uint8_t > (rcode, 0x80);
-
421 #endif
-
422  return rcode;
-
423 }
-
424 
-
425 // The Xbox One packets are described at: https://github.com/quantus/xbox-one-controller-protocol
-
426 void XBOXONE::onInit() {
-
427  // A short buzz to show the controller is active
-
428  uint8_t writeBuf[13];
-
429 
-
430  // Activate rumble
-
431  writeBuf[0] = 0x09;
-
432  writeBuf[1] = 0x00;
-
433  // Byte 2 is set in "XboxCommand"
-
434 
-
435  // Single rumble effect
-
436  writeBuf[3] = 0x09; // Substructure (what substructure rest of this packet has)
-
437  writeBuf[4] = 0x00; // Mode
-
438  writeBuf[5] = 0x0F; // Rumble mask (what motors are activated) (0000 lT rT L R)
-
439  writeBuf[6] = 0x04; // lT force
-
440  writeBuf[7] = 0x04; // rT force
-
441  writeBuf[8] = 0x20; // L force
-
442  writeBuf[9] = 0x20; // R force
-
443  writeBuf[10] = 0x80; // Length of pulse
-
444  writeBuf[11] = 0x00; // Off period
-
445  writeBuf[12] = 0x00; // Repeat count
-
446  XboxCommand(writeBuf, 13);
-
447 
-
448  if(pFuncOnInit)
-
449  pFuncOnInit(); // Call the user function
-
450 }
-
451 
-
452 void XBOXONE::setRumbleOff() {
-
453  uint8_t writeBuf[13];
-
454 
-
455  // Activate rumble
-
456  writeBuf[0] = 0x09;
-
457  writeBuf[1] = 0x00;
-
458  // Byte 2 is set in "XboxCommand"
-
459 
-
460  // Continuous rumble effect
-
461  writeBuf[3] = 0x09; // Substructure (what substructure rest of this packet has)
-
462  writeBuf[4] = 0x00; // Mode
-
463  writeBuf[5] = 0x0F; // Rumble mask (what motors are activated) (0000 lT rT L R)
-
464  writeBuf[6] = 0x00; // lT force
-
465  writeBuf[7] = 0x00; // rT force
-
466  writeBuf[8] = 0x00; // L force
-
467  writeBuf[9] = 0x00; // R force
-
468  writeBuf[10] = 0x00; // On period
-
469  writeBuf[11] = 0x00; // Off period
-
470  writeBuf[12] = 0x00; // Repeat count
-
471  XboxCommand(writeBuf, 13);
-
472 }
-
473 
-
474 void XBOXONE::setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor) {
-
475  uint8_t writeBuf[13];
-
476 
-
477  // Activate rumble
-
478  writeBuf[0] = 0x09;
-
479  writeBuf[1] = 0x00;
-
480  // Byte 2 is set in "XboxCommand"
-
481 
-
482  // Continuous rumble effect
-
483  writeBuf[3] = 0x09; // Substructure (what substructure rest of this packet has)
-
484  writeBuf[4] = 0x00; // Mode
-
485  writeBuf[5] = 0x0F; // Rumble mask (what motors are activated) (0000 lT rT L R)
-
486  writeBuf[6] = leftTrigger; // lT force
-
487  writeBuf[7] = rightTrigger; // rT force
-
488  writeBuf[8] = leftMotor; // L force
-
489  writeBuf[9] = rightMotor; // R force
-
490  writeBuf[10] = 0xFF; // On period
-
491  writeBuf[11] = 0x00; // Off period
-
492  writeBuf[12] = 0xFF; // Repeat count
-
493  XboxCommand(writeBuf, 13);
-
494 }
+
419  if(rcode) {
+
420  Notify(PSTR("\r\nXboxCommand failed. Return: "), 0x80);
+
421  D_PrintHex<uint8_t > (rcode, 0x80);
+
422  }
+
423 #endif
+
424  return rcode;
+
425 }
+
426 
+
427 // The Xbox One packets are described at: https://github.com/quantus/xbox-one-controller-protocol
+
428 void XBOXONE::onInit() {
+
429  // A short buzz to show the controller is active
+
430  uint8_t writeBuf[13];
+
431 
+
432  // Activate rumble
+
433  writeBuf[0] = 0x09;
+
434  writeBuf[1] = 0x00;
+
435  // Byte 2 is set in "XboxCommand"
+
436 
+
437  // Single rumble effect
+
438  writeBuf[3] = 0x09; // Substructure (what substructure rest of this packet has)
+
439  writeBuf[4] = 0x00; // Mode
+
440  writeBuf[5] = 0x0F; // Rumble mask (what motors are activated) (0000 lT rT L R)
+
441  writeBuf[6] = 0x04; // lT force
+
442  writeBuf[7] = 0x04; // rT force
+
443  writeBuf[8] = 0x20; // L force
+
444  writeBuf[9] = 0x20; // R force
+
445  writeBuf[10] = 0x80; // Length of pulse
+
446  writeBuf[11] = 0x00; // Off period
+
447  writeBuf[12] = 0x00; // Repeat count
+
448  XboxCommand(writeBuf, 13);
+
449 
+
450  if(pFuncOnInit)
+
451  pFuncOnInit(); // Call the user function
+
452 }
+
453 
+
454 void XBOXONE::setRumbleOff() {
+
455  uint8_t writeBuf[13];
+
456 
+
457  // Activate rumble
+
458  writeBuf[0] = 0x09;
+
459  writeBuf[1] = 0x00;
+
460  // Byte 2 is set in "XboxCommand"
+
461 
+
462  // Continuous rumble effect
+
463  writeBuf[3] = 0x09; // Substructure (what substructure rest of this packet has)
+
464  writeBuf[4] = 0x00; // Mode
+
465  writeBuf[5] = 0x0F; // Rumble mask (what motors are activated) (0000 lT rT L R)
+
466  writeBuf[6] = 0x00; // lT force
+
467  writeBuf[7] = 0x00; // rT force
+
468  writeBuf[8] = 0x00; // L force
+
469  writeBuf[9] = 0x00; // R force
+
470  writeBuf[10] = 0x00; // On period
+
471  writeBuf[11] = 0x00; // Off period
+
472  writeBuf[12] = 0x00; // Repeat count
+
473  XboxCommand(writeBuf, 13);
+
474 }
+
475 
+
476 void XBOXONE::setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor) {
+
477  uint8_t writeBuf[13];
+
478 
+
479  // Activate rumble
+
480  writeBuf[0] = 0x09;
+
481  writeBuf[1] = 0x00;
+
482  // Byte 2 is set in "XboxCommand"
+
483 
+
484  // Continuous rumble effect
+
485  writeBuf[3] = 0x09; // Substructure (what substructure rest of this packet has)
+
486  writeBuf[4] = 0x00; // Mode
+
487  writeBuf[5] = 0x0F; // Rumble mask (what motors are activated) (0000 lT rT L R)
+
488  writeBuf[6] = leftTrigger; // lT force
+
489  writeBuf[7] = rightTrigger; // rT force
+
490  writeBuf[8] = leftMotor; // L force
+
491  writeBuf[9] = rightMotor; // R force
+
492  writeBuf[10] = 0xFF; // On period
+
493  writeBuf[11] = 0x00; // Off period
+
494  writeBuf[12] = 0xFF; // Repeat count
+
495  XboxCommand(writeBuf, 13);
+
496 }
EpInfo epInfo[XBOX_ONE_MAX_ENDPOINTS]
Definition: XBOXONE.h:185
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:303
#define hrNAK
Definition: max3421e.h:218
uint8_t bInterval
Definition: usb_ch9.h:154
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
-
void setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor)
Definition: XBOXONE.cpp:474
+
void setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor)
Definition: XBOXONE.cpp:476
Definition: address.h:90
uint8_t bmSndToggle
Definition: address.h:47
int16_t getAnalogHat(AnalogHatEnum a)
Definition: XBOXONE.cpp:410
@@ -596,7 +598,7 @@ $(function() {
Definition: usb_ch9.h:105
uint8_t bmNakPower
Definition: address.h:49
#define XBOX_ONE_MAX_ENDPOINTS
Definition: XBOXONE.h:37
-
void setRumbleOff()
Definition: XBOXONE.cpp:452
+
void setRumbleOff()
Definition: XBOXONE.cpp:454
bool getButtonClick(ButtonEnum b)
Definition: XBOXONE.cpp:389
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:801
#define USB_NAK_MAX_POWER
Definition: address.h:34
diff --git a/_x_b_o_x_o_n_e_8h_source.html b/_x_b_o_x_o_n_e_8h_source.html index 944c8ecf..b728d665 100644 --- a/_x_b_o_x_o_n_e_8h_source.html +++ b/_x_b_o_x_o_n_e_8h_source.html @@ -213,7 +213,7 @@ $(function() {
242 #endif
EpInfo epInfo[XBOX_ONE_MAX_ENDPOINTS]
Definition: XBOXONE.h:185
-
void setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor)
Definition: XBOXONE.cpp:474
+
void setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor)
Definition: XBOXONE.cpp:476
Definition: UsbCore.h:134
int16_t getAnalogHat(AnalogHatEnum a)
Definition: XBOXONE.cpp:410
void attachOnInit(void(*funcOnInit)(void))
Definition: XBOXONE.h:159
@@ -240,7 +240,7 @@ $(function() {
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
Definition: XBOXONE.cpp:265
Definition: XBOXONE.h:67
#define XBOX_ONE_MAX_ENDPOINTS
Definition: XBOXONE.h:37
-
void setRumbleOff()
Definition: XBOXONE.cpp:452
+
void setRumbleOff()
Definition: XBOXONE.cpp:454
bool getButtonClick(ButtonEnum b)
Definition: XBOXONE.cpp:389
#define XBOX_VID1
Definition: XBOXONE.h:42
Definition: address.h:39
diff --git a/class_x_b_o_x_o_n_e.html b/class_x_b_o_x_o_n_e.html index ba92e6d3..108aeb9a 100644 --- a/class_x_b_o_x_o_n_e.html +++ b/class_x_b_o_x_o_n_e.html @@ -584,7 +584,7 @@ Protected Attributes

Used to set the rumble off.

-

Definition at line 452 of file XBOXONE.cpp.

+

Definition at line 454 of file XBOXONE.cpp.

@@ -635,7 +635,7 @@ Protected Attributes -

Definition at line 474 of file XBOXONE.cpp.

+

Definition at line 476 of file XBOXONE.cpp.