mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Minor edit
This commit is contained in:
parent
d4fcf68de4
commit
f16e348199
2 changed files with 7 additions and 13 deletions
14
PS3BT.cpp
14
PS3BT.cpp
|
@ -195,12 +195,10 @@ uint8_t PS3BT::Init(uint8_t parent, uint8_t port, bool lowspeed)
|
||||||
for (uint8_t i=0; i<num_of_conf; i++) {
|
for (uint8_t i=0; i<num_of_conf; i++) {
|
||||||
ConfigDescParser<USB_CLASS_WIRELESS_CTRL, WI_SUBCLASS_RF, WI_PROTOCOL_BT, CP_MASK_COMPARE_ALL> confDescrParser(this);
|
ConfigDescParser<USB_CLASS_WIRELESS_CTRL, WI_SUBCLASS_RF, WI_PROTOCOL_BT, CP_MASK_COMPARE_ALL> confDescrParser(this);
|
||||||
rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
|
rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
|
||||||
if( rcode ) {
|
if(rcode)
|
||||||
goto FailGetConfDescr;
|
goto FailGetConfDescr;
|
||||||
}
|
if( bNumEP > 3 ) //all endpoints extracted
|
||||||
if( bNumEP > 3 ) { //all endpoints extracted
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
} // for (uint8_t i=0; i<num_of_conf; i++...
|
} // for (uint8_t i=0; i<num_of_conf; i++...
|
||||||
|
|
||||||
if (bNumEP < PS3_MAX_ENDPOINTS) {
|
if (bNumEP < PS3_MAX_ENDPOINTS) {
|
||||||
|
@ -215,8 +213,6 @@ uint8_t PS3BT::Init(uint8_t parent, uint8_t port, bool lowspeed)
|
||||||
|
|
||||||
delay(200); // Give time for address change
|
delay(200); // Give time for address change
|
||||||
|
|
||||||
//rcode = pUsb->setConf(bAddress, epInfo[ CSR_CONTROL_PIPE ].epAddr, bConfigurationValue);//bConfigurationValue = 0x01
|
|
||||||
|
|
||||||
// Set Configuration Value
|
// Set Configuration Value
|
||||||
rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, bConfNum);
|
rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, bConfNum);
|
||||||
if( rcode )
|
if( rcode )
|
||||||
|
@ -259,7 +255,7 @@ uint8_t PS3BT::Init(uint8_t parent, uint8_t port, bool lowspeed)
|
||||||
delay(200);//Give time for address change
|
delay(200);//Give time for address change
|
||||||
|
|
||||||
|
|
||||||
rcode = pUsb->setConf(bAddress, epInfo[ PS3_CONTROL_PIPE ].epAddr, bConfigurationValue);//bConfigurationValue = 0x01
|
rcode = pUsb->setConf(bAddress, epInfo[ PS3_CONTROL_PIPE ].epAddr, 1);
|
||||||
if( rcode )
|
if( rcode )
|
||||||
goto FailSetConf;
|
goto FailSetConf;
|
||||||
|
|
||||||
|
@ -1135,8 +1131,6 @@ void PS3BT::L2CAP_task()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case L2CAP_EV_HID_ENABLE_SIXAXIS:
|
case L2CAP_EV_HID_ENABLE_SIXAXIS:
|
||||||
delay(1000);//There has to be a delay before sending the commands
|
|
||||||
|
|
||||||
for (uint8_t i = 0; i < BULK_MAXPKTSIZE; i++)//Reset l2cap in buffer as it sometimes read it as a button has been pressed
|
for (uint8_t i = 0; i < BULK_MAXPKTSIZE; i++)//Reset l2cap in buffer as it sometimes read it as a button has been pressed
|
||||||
l2capinbuf[i] = 0;
|
l2capinbuf[i] = 0;
|
||||||
ButtonState = 0;
|
ButtonState = 0;
|
||||||
|
@ -1144,6 +1138,7 @@ void PS3BT::L2CAP_task()
|
||||||
|
|
||||||
if (remote_name[0] == 'P')//First letter in PLAYSTATION(R)3 Controller ('P') - 0x50
|
if (remote_name[0] == 'P')//First letter in PLAYSTATION(R)3 Controller ('P') - 0x50
|
||||||
{
|
{
|
||||||
|
delay(1000);//There has to be a delay before sending the commands
|
||||||
enable_sixaxis();
|
enable_sixaxis();
|
||||||
|
|
||||||
for (uint8_t i = 15; i < 19; i++)
|
for (uint8_t i = 15; i < 19; i++)
|
||||||
|
@ -1158,6 +1153,7 @@ void PS3BT::L2CAP_task()
|
||||||
}
|
}
|
||||||
else if (remote_name[0] == 'N')//First letter in Navigation Controller ('N') - 0x4E
|
else if (remote_name[0] == 'N')//First letter in Navigation Controller ('N') - 0x4E
|
||||||
{
|
{
|
||||||
|
delay(1000);//There has to be a delay before sending the commands
|
||||||
enable_sixaxis();
|
enable_sixaxis();
|
||||||
|
|
||||||
for (uint8_t i = 15; i < 19; i++)
|
for (uint8_t i = 15; i < 19; i++)
|
||||||
|
|
2
PS3BT.h
2
PS3BT.h
|
@ -152,8 +152,6 @@
|
||||||
#define PENDING 0x01
|
#define PENDING 0x01
|
||||||
#define SUCCESSFUL 0x00
|
#define SUCCESSFUL 0x00
|
||||||
|
|
||||||
#define bConfigurationValue 0x01 // Used to set configuration
|
|
||||||
|
|
||||||
#define PS3_MAX_ENDPOINTS 4
|
#define PS3_MAX_ENDPOINTS 4
|
||||||
#define WI_SUBCLASS_RF 0x01
|
#define WI_SUBCLASS_RF 0x01
|
||||||
#define WI_PROTOCOL_BT 0x01
|
#define WI_PROTOCOL_BT 0x01
|
||||||
|
|
Loading…
Reference in a new issue