1
0
mirror of https://github.com/gdsports/USBHost_t36 synced 2024-11-21 08:35:03 -05:00

Merge pull request #16 from KurtE/XBOX1-Rumble

XBox1 controller rumble support
This commit is contained in:
Paul Stoffregen 2018-01-17 06:49:10 -08:00 committed by GitHub
commit 5e4707a242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,18 +119,19 @@ bool JoystickController::setRumble(uint8_t lValue, uint8_t rValue, uint8_t timeo
case XBOXONE: case XBOXONE:
// Lets try sending a request to the XBox 1. // Lets try sending a request to the XBox 1.
txbuf_[0] = 0x9; txbuf_[0] = 0x9;
txbuf_[1] = 0x8; txbuf_[1] = 0x0;
txbuf_[2] = 0x0; txbuf_[2] = 0x0;
txbuf_[3] = 0x08; // Substructure (what substructure rest of this packet has) txbuf_[3] = 0x09; // Substructure (what substructure rest of this packet has)
txbuf_[4] = 0x00; // Mode txbuf_[4] = 0x00; // Mode
txbuf_[5] = 0x0f; // Rumble mask (what motors are activated) (0000 lT rT L R) txbuf_[5] = 0x0f; // Rumble mask (what motors are activated) (0000 lT rT L R)
txbuf_[6] = 0x0; // lT force txbuf_[6] = 0x0; // lT force
txbuf_[7] = 0x0; // rT force txbuf_[7] = 0x0; // rT force
txbuf_[8] = lValue; // L force txbuf_[8] = lValue; // L force
txbuf_[9] = rValue; // R force txbuf_[9] = rValue; // R force
txbuf_[10] = 0x80; // Length of pulse txbuf_[10] = 0xff; // Length of pulse
txbuf_[11] = 0x00; // Period between pulses txbuf_[11] = 0x00; // Period between pulses
if (!queue_Data_Transfer(txpipe_, txbuf_, 12, this)) { txbuf_[12] = 0x00; // Repeat
if (!queue_Data_Transfer(txpipe_, txbuf_, 13, this)) {
println("XBoxOne rumble transfer fail"); println("XBoxOne rumble transfer fail");
} }
return true; // return true; //