mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Overloaded PS3BT/PS3USB's setRumbleOn to accept custom rumble settings.
This commit is contained in:
parent
904f2ff25a
commit
adff5d790d
4 changed files with 343 additions and 321 deletions
|
@ -608,7 +608,13 @@ void PS3BT::setRumbleOn(Rumble mode) {
|
|||
HID_Command(HIDBuffer, HID_BUFFERSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
void PS3BT::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower) {
|
||||
HIDBuffer[3] = rightDuration;
|
||||
HIDBuffer[4] = rightPower;
|
||||
HIDBuffer[5] = leftDuration;
|
||||
HIDBuffer[6] = leftPower;
|
||||
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);
|
||||
|
|
8
PS3BT.h
8
PS3BT.h
|
@ -163,6 +163,14 @@ public:
|
|||
* @param mode Either ::RumbleHigh or ::RumbleLow.
|
||||
*/
|
||||
void setRumbleOn(Rumble mode);
|
||||
/**
|
||||
* Turn on ::Rumble using custom duration and power.
|
||||
* @param rightDuration The duration of the right/low rumble effect.
|
||||
* @param rightPower The intensity of the right/low rumble effect.
|
||||
* @param leftDuration The duration of the left/high rumble effect.
|
||||
* @param leftPower The intensity of the left/high rumble effect.
|
||||
*/
|
||||
void setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower);
|
||||
/**
|
||||
* Turn the specific ::LED off.
|
||||
* @param a The ::LED to turn off.
|
||||
|
|
|
@ -464,7 +464,13 @@ void PS3USB::setRumbleOn(Rumble mode) {
|
|||
PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
void PS3USB::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower) {
|
||||
writeBuf[1] = rightDuration;
|
||||
writeBuf[2] = rightPower;
|
||||
writeBuf[3] = leftDuration;
|
||||
writeBuf[4] = leftPower;
|
||||
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);
|
||||
|
|
18
PS3USB.h
18
PS3USB.h
|
@ -91,22 +91,16 @@ public:
|
|||
* @return 0 on success.
|
||||
*/
|
||||
virtual uint8_t Poll();
|
||||
|
||||
/**
|
||||
* Get the device address.
|
||||
* @return The device address.
|
||||
*/
|
||||
virtual uint8_t GetAddress() {
|
||||
return bAddress;
|
||||
};
|
||||
|
||||
virtual uint8_t GetAddress() { return bAddress; };
|
||||
/**
|
||||
* Used to check if the controller has been initialized.
|
||||
* @return True if it's ready.
|
||||
*/
|
||||
virtual bool isReady() {
|
||||
return bPollEnable;
|
||||
};
|
||||
virtual bool isReady() { return bPollEnable; };
|
||||
/**@}*/
|
||||
|
||||
/**
|
||||
|
@ -182,6 +176,14 @@ public:
|
|||
* @param mode Either ::RumbleHigh or ::RumbleLow.
|
||||
*/
|
||||
void setRumbleOn(Rumble mode);
|
||||
/**
|
||||
* Turn on ::Rumble using custom duration and power.
|
||||
* @param rightDuration The duration of the right/low rumble effect.
|
||||
* @param rightPower The intensity of the right/low rumble effect.
|
||||
* @param leftDuration The duration of the left/high rumble effect.
|
||||
* @param leftPower The intensity of the left/high rumble effect.
|
||||
*/
|
||||
void setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower);
|
||||
/**
|
||||
* Turn the specific ::LED off.
|
||||
* @param a The ::LED to turn off.
|
||||
|
|
Loading…
Reference in a new issue