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
Revision 10:c961d228b63e, committed 2017-12-11
- Comitter:
- Suzutomo
- Date:
- Mon Dec 11 09:08:28 2017 +0000
- Parent:
- 9:b98be6c2f23e
- Commit message:
- Update
Changed in this revision
| PS4.cpp | Show annotated file Show diff for this revision Revisions of this file | 
diff -r b98be6c2f23e -r c961d228b63e PS4.cpp
--- a/PS4.cpp	Mon Dec 11 09:07:06 2017 +0000
+++ b/PS4.cpp	Mon Dec 11 09:08:28 2017 +0000
@@ -10,124 +10,6 @@
     }
 }
 
-/*bool PS4::UpDate()
-{
-
-    //Make backup
-    memcpy( DATA_CONTROLLER_OLD, DATA_CONTROLLER, sizeof(DATA_CONTROLLER) );
-
-    //Get data by I2C
-    //int s = i2c->read((ADDR | 1), data, 17);
-    if (serial->getc() == 0x80) {
-        for (int i = 0; i<9; i++) {
-            data[i]  = serial->getc();
-        }
-    }
-    if(1) {
-
-        //UpDate
-        DATA_CONTROLLER[CONNECTION] = (data[0] >> 0) & 0x01;
-        DATA_CONTROLLER[UP] = (data[1] >> 7) & 0x01;
-        DATA_CONTROLLER[RIGHT] = (data[1] >> 6) & 0x01;
-        DATA_CONTROLLER[DOWN] = (data[1] >> 5) & 0x01;
-        DATA_CONTROLLER[LEFT] = (data[1] >> 4) & 0x01;
-        DATA_CONTROLLER[TRIANGLE] = (data[1] >> 3) & 0x01;
-        DATA_CONTROLLER[CIRCLE] = (data[1] >> 2) & 0x01;
-        DATA_CONTROLLER[CROSS] = (data[1] >> 1) & 0x01;
-        DATA_CONTROLLER[SQUARE] = (data[1] >> 0) & 0x01;
-        DATA_CONTROLLER[L1] = (data[2] >> 7) & 0x01;
-        DATA_CONTROLLER[R1] = (data[2] >> 6) & 0x01;
-        DATA_CONTROLLER[SHARE] = (data[2] >> 5) & 0x01;
-        DATA_CONTROLLER[OPTIONS] = (data[2] >> 4) & 0x01;
-        DATA_CONTROLLER[L3] = (data[2] >> 3) & 0x01;
-        DATA_CONTROLLER[R3] = (data[2] >> 2) & 0x01;
-        DATA_CONTROLLER[PS] = (data[2] >> 1) & 0x01;
-        DATA_CONTROLLER[TOUCHPAD] = (data[2] >> 0) & 0x01;
-        DATA_CONTROLLER[LeftHatX] = data[3];
-        DATA_CONTROLLER[LeftHatY] = data[4];
-        DATA_CONTROLLER[RightHatX] = data[5];
-        DATA_CONTROLLER[RightHatY] = data[6];
-        DATA_CONTROLLER[L2] = data[7];
-        DATA_CONTROLLER[R2] = data[8];
-        DATA_TP[X][0] = ((data[9] & 0b11110000) << 4) + data[11];
-        DATA_TP[X][1] = ((data[9] & 0b00001111)<< 8) + data[12];
-        DATA_TP[Y][0] = ((data[10] & 0b11000000) << 2) + data[13];
-        DATA_TP[Y][1] = ((data[10] & 0b00110000) << 4) + data[14];
-        //DATA_CONTROLLER[PITCH] = ((data[10] & 0b00001100) << 6) + data[15];
-        //DATA_CONTROLLER[ROLL] = ((data[10] & 0b00000011) << 8) + data[16];
-
-    } else {
-        for(int i = 0; i < 23; i++) {
-            DATA_CONTROLLER[i] = i >= 15 && i <= 18 ? 127 : 0;
-        }
-    }
-
-    if (serial->getc() == 0x0A) {
-        for (int i = 0; i<8; i++) {
-            paddata[i]  = serial->getc();
-        }
-        DATA_TP[X][0] = ((paddata[0] & 0b11110000) << 4) + paddata[2];
-        DATA_TP[X][1] = ((paddata[0] & 0b00001111) << 8) + paddata[3];
-        DATA_TP[Y][0] = ((paddata[1] & 0b11000000) << 2) + paddata[4];
-        DATA_TP[Y][1] = ((paddata[1] & 0b00110000) << 4) + paddata[5];
-    }
-    if (serial->getc() == 0x0B) {
-        int input = serial->getc();
-        //int b_memory = input % 10;
-        //int a_memory = (input /= 10) % 10;
-        return 1;
-    }
-    return 0;
-}
-
-
-int PS4::getData ( char a,char b)
-{
-    serial->putc(0x0B);
-    serial->putc(a);
-    serial->putc(b);
-    return 0;
-}
-
-int PS4::getPress( CONTROLLER buttom )
-{
-    if(buttom < 25) {
-        return DATA_CONTROLLER[buttom];
-    } else {
-        return 0;
-    }
-}
-
-int PS4::getClick( CONTROLLER button, bool mode )
-{
-    //mode:0 -> Rising
-    //mode:1 -> Falling
-
-    if(button <= 13) {
-        return mode*(DATA_CONTROLLER[button]*!DATA_CONTROLLER_OLD[button])
-               + !mode*(!DATA_CONTROLLER[button]*DATA_CONTROLLER_OLD[button]);
-
-    } else if( (19<=button) && (button<=20) ) {
-        return mode*((DATA_CONTROLLER[button]>127)*!(DATA_CONTROLLER_OLD[button]>127))
-               + !mode*(!(DATA_CONTROLLER[button]>127)*(DATA_CONTROLLER_OLD[button]>127));
-
-    } else {
-        return 0;
-    }
-}
-
-int PS4::touchPad( TP direction, bool finger )
-{
-    return DATA_TP[direction][finger];
-}
-
-int PS4::getTouchPad()
-{
-    serial->putc(0x0A);
-
-    return 0;
-}*/
-
 int PS4::getPress( int button,bool finger)
 {
     if (button >= 1 && button <= 16) return BUTTON_NEW[button - 1];
    