20151026 リセット追加

Dependencies:   FatFileSystem mbed

Fork of PS3_BlueUSB by Kiko Ishimoto

Files at this revision

API Documentation at this revision

Comitter:
nodoame
Date:
Sun Oct 25 07:26:18 2015 +0000
Parent:
4:3d912e4eef8e
Commit message:
??????;

Changed in this revision

TestShell.cpp Show annotated file Show diff for this revision Revisions of this file
USBHost.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/TestShell.cpp	Sun Oct 25 06:16:36 2015 +0000
+++ b/TestShell.cpp	Sun Oct 25 07:26:18 2015 +0000
@@ -100,6 +100,8 @@
 #define WII_REMOTE 0x042500
 #define PS3_REMOTE 0x080500
 char DATA[30];
+char tmpDATA[30];
+int dcount=0,count=0;
 
 class HIDBluetooth
 {
@@ -207,6 +209,18 @@
                 DATA[29] = ((ps3report*)(data+1))->Connection;                               
                 //Dev.putc(0xff);
                 //wait(0.003);
+                for(int i=0;i<30;i++){
+                    if(tmpDATA[i]==DATA[i])
+                        dcount++;
+                    tmpDATA[i]=DATA[i];
+                }
+                if(dcount>29)
+                    count++;
+                else
+                    count=0;
+                if(count>600)
+                    NVIC_SystemReset();
+                dcount=0;
                 Dev.putc(114);
                 wait(0.0003);
                 for(int i = 0;i<7;i++)
@@ -214,7 +228,7 @@
                     //if(i%2 == 1)
                     wait(0.0003);
                     Dev.putc(DATA[i]);
-                    printf(": %3d " , DATA[i]);
+                    printf(": %3d\r\n " , count);
                 }
                 if(((int)DATA[1]&12)==12&&leaveF){
                     leaveF=false;
--- a/USBHost.cpp	Sun Oct 25 06:16:36 2015 +0000
+++ b/USBHost.cpp	Sun Oct 25 07:26:18 2015 +0000
@@ -808,8 +808,10 @@
         {
             if (status & CurrentConnectStatus)    // Connecting
                 ResetPort(hub,port);            // Reset to initiate connect (state machine?)
-            else
+            else{
                 Disconnect(hub,port);
+                NVIC_SystemReset();
+            }
         }
 
         if (status & PortResetStatusChange)