diff --git a/PS3BT.cpp b/PS3BT.cpp index 088325b4..ad263f61 100644 --- a/PS3BT.cpp +++ b/PS3BT.cpp @@ -581,22 +581,20 @@ void PS3BT::setAllOff() { void PS3BT::setRumbleOff() { HIDBuffer[3] = 0x00; - HIDBuffer[4] = 0x00; //low mode off + HIDBuffer[4] = 0x00; HIDBuffer[5] = 0x00; - HIDBuffer[6] = 0x00; //high mode off + HIDBuffer[6] = 0x00; HID_Command(HIDBuffer, HID_BUFFERSIZE); } void PS3BT::setRumbleOn(Rumble mode) { - if ((mode & 0x30) > 0x00) { - uint8_t power[2] = { 0xff, 0x00 }; // Defaults to RumbleLow - if (mode == RumbleHigh) { - power[0] = 0x00; - power[1] = 0xff; - } - setRumbleOn(0xfe, power[0], 0xfe, power[1]); + uint8_t power[2] = { 0xff, 0x00 }; // Defaults to RumbleLow + if (mode == RumbleHigh) { + power[0] = 0x00; + power[1] = 0xff; } + setRumbleOn(0xfe, power[0], 0xfe, power[1]); } void PS3BT::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower) { @@ -607,6 +605,10 @@ void PS3BT::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftD HID_Command(HIDBuffer, HID_BUFFERSIZE); } +void PS3BT::setLedRaw(uint8_t value) { + HIDBuffer[11] = value; + HID_Command(HIDBuffer, HID_BUFFERSIZE); +} void PS3BT::setLedOff(LED a) { HIDBuffer[11] &= ~((uint8_t)((pgm_read_byte(&LEDS[(uint8_t)a]) & 0x0f) << 1)); HID_Command(HIDBuffer, HID_BUFFERSIZE); diff --git a/PS3BT.h b/PS3BT.h index ef0b7544..a4200a65 100644 --- a/PS3BT.h +++ b/PS3BT.h @@ -171,6 +171,12 @@ public: * @param leftPower The intensity of the left/high rumble effect. */ void setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower); + + /** + * Set LED value without using the ::LED enum. + * @param value See: ::LED enum. + */ + void setLedRaw(uint8_t value); /** * Turn the specific ::LED off. * @param a The ::LED to turn off. diff --git a/PS3USB.cpp b/PS3USB.cpp index 5a3218c4..bba4d7e3 100644 --- a/PS3USB.cpp +++ b/PS3USB.cpp @@ -454,16 +454,18 @@ void PS3USB::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t left PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE); } +void PS3USB::setLedRaw(uint8_t value) { + writeBuf[9] = value; + PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE); +} void PS3USB::setLedOff(LED a) { writeBuf[9] &= ~((uint8_t)((pgm_read_byte(&LEDS[(uint8_t)a]) & 0x0f) << 1)); PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE); } - void PS3USB::setLedOn(LED a) { writeBuf[9] |= (uint8_t)((pgm_read_byte(&LEDS[(uint8_t)a]) & 0x0f) << 1); PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE); } - void PS3USB::setLedToggle(LED a) { writeBuf[9] ^= (uint8_t)((pgm_read_byte(&LEDS[(uint8_t)a]) & 0x0f) << 1); PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE); diff --git a/PS3USB.h b/PS3USB.h index 05a9476c..697dd00b 100644 --- a/PS3USB.h +++ b/PS3USB.h @@ -190,6 +190,12 @@ public: * @param leftPower The intensity of the left/high rumble effect. */ void setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower); + + /** + * Set LED value without using the ::LED enum. + * @param value See: ::LED enum. + */ + void setLedRaw(uint8_t value); /** * Turn the specific ::LED off. * @param a The ::LED to turn off. diff --git a/Wii.cpp b/Wii.cpp index a96e5a58..e4d93a14 100755 --- a/Wii.cpp +++ b/Wii.cpp @@ -869,6 +869,11 @@ void WII::setRumbleToggle() { HID_Command(HIDBuffer, 3); } +void WII::setLedRaw(uint8_t value) { + HIDBuffer[1] = 0x11; + HIDBuffer[2] = value | (HIDBuffer[2] & 0x01); // Keep the rumble bit + HID_Command(HIDBuffer, 3); +} void WII::setLedOff(LED a) { HIDBuffer[1] = 0x11; HIDBuffer[2] &= ~(pgm_read_byte(&LEDS[(uint8_t)a])); diff --git a/Wii.h b/Wii.h index e79a75b0..c35b31ac 100755 --- a/Wii.h +++ b/Wii.h @@ -178,6 +178,12 @@ public: void setRumbleOn(); /** Toggle rumble. */ void setRumbleToggle(); + + /** + * Set LED value without using the ::LED enum. + * @param value See: ::LED enum. + */ + void setLedRaw(uint8_t value); /** * Turn the specific ::LED off. * @param a The ::LED to turn off.