mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Code cleanup
This commit is contained in:
parent
67a8989cef
commit
f3342aa589
4 changed files with 366 additions and 356 deletions
|
@ -598,6 +598,7 @@ void PS3BT::setRumbleOn(Rumble mode) {
|
|||
setRumbleOn(0xfe, power[0], 0xfe, power[1]);
|
||||
}
|
||||
}
|
||||
|
||||
void PS3BT::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower) {
|
||||
HIDBuffer[3] = rightDuration;
|
||||
HIDBuffer[4] = rightPower;
|
||||
|
@ -605,6 +606,7 @@ void PS3BT::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftD
|
|||
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);
|
||||
|
|
|
@ -445,15 +445,16 @@ void PS3USB::setRumbleOff() {
|
|||
}
|
||||
|
||||
void PS3USB::setRumbleOn(Rumble mode) {
|
||||
if ((mode & 0x30) > 0) {
|
||||
uint8_t power[2] = { 0xff, 0 }; // Defaults to RumbleLow
|
||||
if ((mode & 0x30) > 0x00) {
|
||||
uint8_t power[2] = { 0xff, 0x00 }; // Defaults to RumbleLow
|
||||
if (mode == RumbleHigh) {
|
||||
power[0] = 0;
|
||||
power[0] = 0x00;
|
||||
power[1] = 0xff;
|
||||
}
|
||||
setRumbleOn(0xfe, power[0], 0xfe, power[1]);
|
||||
}
|
||||
}
|
||||
|
||||
void PS3USB::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower) {
|
||||
writeBuf[1] = rightDuration;
|
||||
writeBuf[2] = rightPower;
|
||||
|
@ -461,6 +462,7 @@ void PS3USB::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t left
|
|||
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);
|
||||
|
|
10
PS3USB.h
10
PS3USB.h
|
@ -91,16 +91,22 @@ 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;
|
||||
};
|
||||
/**@}*/
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue