Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of PS4 by
Diff: PS3.cpp
- Revision:
 - 5:51d531c885ba
 - Parent:
 - 4:cfef9ff2d209
 
--- a/PS3.cpp	Fri Sep 08 13:14:41 2017 +0000
+++ b/PS3.cpp	Fri Sep 22 07:55:15 2017 +0000
@@ -17,7 +17,9 @@
     memcpy( DATA_CONTROLLER_OLD, DATA_CONTROLLER, sizeof(DATA_CONTROLLER) );
 
     //Get data by I2C
-    if(i2c->read((ADDR | 1), data, 8) == 0) {
+    int s = i2c->read((ADDR | 1), data, 8);
+    
+    if(s == 0) {
 
         //UpDate
         DATA_CONTROLLER[CONNECTION] = (data[1] >> 1) & 0x01;
@@ -46,7 +48,7 @@
             DATA_CONTROLLER[i] = i >= 15 && i <= 18 ? 127 : 0;
         }
     }
-    return DATA_CONTROLLER[CONNECTION];
+    return s;
 }
 
 int PS3::getPress( CONTROLLER buttom )
    