20151026 リセット追加

Dependencies:   FatFileSystem mbed

Fork of PS3_BlueUSB by Kiko Ishimoto

Revision:
4:3d912e4eef8e
Parent:
3:8733d7b59027
Child:
5:ac875050e1bd
--- a/TestShell.cpp	Sun Oct 18 02:55:45 2015 +0000
+++ b/TestShell.cpp	Sun Oct 25 06:16:36 2015 +0000
@@ -37,6 +37,7 @@
 DigitalOut LEDa(LED1);
 PwmOut     LEDb(LED2);
 PwmOut     LEDc(LED3);
+PwmOut LEDd(LED4);
 Serial Dev(p28,p27);
 BusIn LB(p24,p23,p22,p21);
 
@@ -99,6 +100,7 @@
 #define WII_REMOTE 0x042500
 #define PS3_REMOTE 0x080500
 char DATA[30];
+
 class HIDBluetooth
 {
     int _control;   // Sockets for control (out) and interrupt (in)
@@ -114,6 +116,8 @@
 public:
     HIDBluetooth() : _control(0),_interrupt(0),_devClass(0), _ready(1){
         Dev.baud(921600);
+        LEDd.period(3.0);
+        LEDd.write(0.5);
     };
     
     bool InUse()
@@ -200,7 +204,7 @@
                 DATA[26] = ((ps3report*)(data+1))->GyroZ & 0xff;
                 DATA[27] = ((ps3report*)(data+1))->Charge;     
                 DATA[28] = ((ps3report*)(data+1))->Power;
-                DATA[29] = ((ps3report*)(data+1))->Connection;                                 
+                DATA[29] = ((ps3report*)(data+1))->Connection;                               
                 //Dev.putc(0xff);
                 //wait(0.003);
                 Dev.putc(114);
@@ -215,9 +219,12 @@
                 if(((int)DATA[1]&12)==12&&leaveF){
                     leaveF=false;
                     t->Ps3Hid_Rumble(10, 255, 10, 10);
+                    //t->Ps3Hid_Led(4);
                 }
-                else if(!((int)DATA[1]&12)==12)
+                else if(!(((int)DATA[1]&12)==12)){
                     leaveF=true;
+                    //t->Ps3Hid_Led(0);
+                }
                 wait(0.001);
                 printf("\n");
                 char flag=0;