mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Forgot delay and a bunch of #ifdef DEBUG
This commit is contained in:
parent
7750b494e6
commit
4fa973d441
1 changed files with 10 additions and 3 deletions
13
XBOXRECV.cpp
13
XBOXRECV.cpp
|
@ -208,12 +208,10 @@ uint8_t XBOXRECV::Init(uint8_t parent, uint8_t port, bool lowspeed) {
|
||||||
goto FailSetConf;
|
goto FailSetConf;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Notify(PSTR("\r\nXbox Wireless Receiver Connected"));
|
Notify(PSTR("\r\nXbox Wireless Receiver Connected\r\n"));
|
||||||
#endif
|
#endif
|
||||||
XboxReceiverConnected = true;
|
XboxReceiverConnected = true;
|
||||||
|
|
||||||
bPollEnable = true;
|
bPollEnable = true;
|
||||||
Notify(PSTR("\r\n"));
|
|
||||||
return 0; // successful configuration
|
return 0; // successful configuration
|
||||||
|
|
||||||
/* diagnostic messages */
|
/* diagnostic messages */
|
||||||
|
@ -281,6 +279,7 @@ uint8_t XBOXRECV::Poll() {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
delay(1);
|
||||||
if(BUFFER_SIZE > 0) {
|
if(BUFFER_SIZE > 0) {
|
||||||
#ifdef EXTRADEBUG
|
#ifdef EXTRADEBUG
|
||||||
Notify(PSTR("Bytes Received: "));
|
Notify(PSTR("Bytes Received: "));
|
||||||
|
@ -301,10 +300,14 @@ void XBOXRECV::readReport(uint8_t controller) {
|
||||||
return;
|
return;
|
||||||
if(readBuf[0] == 0x08) { // This report is send when a controller is connected and disconnected
|
if(readBuf[0] == 0x08) { // This report is send when a controller is connected and disconnected
|
||||||
Xbox360Connected[controller] = (bool)(readBuf[1] == 0x80);
|
Xbox360Connected[controller] = (bool)(readBuf[1] == 0x80);
|
||||||
|
#ifdef DEBUG
|
||||||
Notify(PSTR("Controller "));
|
Notify(PSTR("Controller "));
|
||||||
Serial.print(controller);
|
Serial.print(controller);
|
||||||
|
#endif
|
||||||
if(Xbox360Connected[controller]) {
|
if(Xbox360Connected[controller]) {
|
||||||
|
#ifdef DEBUG
|
||||||
Notify(PSTR(": connected\r\n"));
|
Notify(PSTR(": connected\r\n"));
|
||||||
|
#endif
|
||||||
switch (controller) {
|
switch (controller) {
|
||||||
case 0:
|
case 0:
|
||||||
setLedOn(controller,LED1);
|
setLedOn(controller,LED1);
|
||||||
|
@ -320,8 +323,10 @@ void XBOXRECV::readReport(uint8_t controller) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
else
|
else
|
||||||
Notify(PSTR(": disconnected\r\n"));
|
Notify(PSTR(": disconnected\r\n"));
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(readBuf[1] != 0x01) // Check if it's the correct report - the receiver also sends different status reports
|
if(readBuf[1] != 0x01) // Check if it's the correct report - the receiver also sends different status reports
|
||||||
|
@ -350,6 +355,7 @@ void XBOXRECV::readReport(uint8_t controller) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void XBOXRECV::printReport(uint8_t controller, uint8_t nBytes) { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
|
void XBOXRECV::printReport(uint8_t controller, uint8_t nBytes) { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
|
||||||
|
#ifdef (DEBUG || PRINTREPORT)
|
||||||
if (readBuf == NULL)
|
if (readBuf == NULL)
|
||||||
return;
|
return;
|
||||||
Notify(PSTR("Controller "));
|
Notify(PSTR("Controller "));
|
||||||
|
@ -360,6 +366,7 @@ void XBOXRECV::printReport(uint8_t controller, uint8_t nBytes) { //Uncomment "#d
|
||||||
Serial.print(" ");
|
Serial.print(" ");
|
||||||
}
|
}
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
uint8_t XBOXRECV::getButtonPress(uint8_t controller, Button b) {
|
uint8_t XBOXRECV::getButtonPress(uint8_t controller, Button b) {
|
||||||
if(b == L2) // These are analog buttons
|
if(b == L2) // These are analog buttons
|
||||||
|
|
Loading…
Reference in a new issue