v1 Stable

Dependencies:   F401RE-USBHost USBHostXpad mbed

Revision:
10:02dbdace7cfb
Parent:
9:b64b08b130ed
Child:
12:0cc5d9260495
--- a/main.cpp	Sat Feb 18 16:42:44 2017 +0000
+++ b/main.cpp	Fri Feb 24 02:45:37 2017 +0000
@@ -681,6 +681,7 @@
             {
                 if(!buttonPressed) // make sure it's a separate button press
                 {
+                    myled = true;
                     buttonPressed = true;
                     state++;
                     continue;
@@ -707,10 +708,16 @@
             // Set pin mode to output
             data.output();
             
+            //pc.printf("cmd = 0x%02X\r\n",cmd);
+            
             switch(cmd)
             {
                 case 0x00: // identity
+                    //pc.printf("I got an 0x00!\r\n");
+                    SendIdentity();
+                    break;
                 case 0xFF: // reset
+                    //pc.printf("I got an 0xFF!\r\n");
                     SendIdentity();
                     break;
                 case 0x01: // poll for state
@@ -730,6 +737,7 @@
                 if(!buttonPressed) // make sure it's a separate button press
                 {
                     state = NORMAL;
+                    myled = false;
                     buttonPressed = true;
                     continue;
                 }
@@ -741,11 +749,11 @@
             
             //pc.printf("State = %d\r\n",state); // DEBUG
             
-            myled = !myled;
+            
             USBHost::poll();
-            wait(0.1);
+            //wait(0.1); // too long of a wait. caused xbone controller issues due to timeouts
             
-            if(state == NORMAL) // about to return to normal operation, make sure the LED remains off
+            if(state == NORMAL) // about to return to normal operation, make sure the LED turns off
             {
                 myled = false;
                 XpadButtonPressed = false;