ps3 with sbdbt
Dependents: Base_Hybrid_Latihan_Ok_Hajar_servo_senso 2016_mother_3
Revision 3:5640aae53391, committed 2016-09-30
- Comitter:
- sgrsn
- Date:
- Fri Sep 30 12:28:35 2016 +0000
- Parent:
- 2:fe29007fb56c
- Commit message:
- PS3
Changed in this revision
PS3.cpp | Show annotated file Show diff for this revision Revisions of this file |
PS3.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r fe29007fb56c -r 5640aae53391 PS3.cpp --- a/PS3.cpp Mon Sep 26 10:28:39 2016 +0000 +++ b/PS3.cpp Fri Sep 30 12:28:35 2016 +0000 @@ -48,6 +48,14 @@ { return (*(PS3Data+(button>>4)) >> (button & 0x0f)) & 1; } +bool PS3::getSELECTState() +{ + return getButtonState(migi) & getButtonState(hidari); +} +bool PS3::getSTARTState() +{ + return getButtonState(ue) & getButtonState(sita); +} int PS3::getRightJoystickXaxis() { return (int)PS3Data[5]-64; @@ -72,4 +80,14 @@ { return atan2(double(PS3Data[4]*-1+64), double(PS3Data[3]-64))*double(180/PI); } +void PS3::printdata() +{ + Serial pc(USBTX, USBRX); + for(int i = 0; i < 8; i++) + { + pc.printf("%4d", PS3Data[i]); + } +} + +
diff -r fe29007fb56c -r 5640aae53391 PS3.h --- a/PS3.h Mon Sep 26 10:28:39 2016 +0000 +++ b/PS3.h Fri Sep 30 12:28:35 2016 +0000 @@ -45,6 +45,8 @@ void addattach(void (*Func)()); void nothingFunc(); bool getButtonState(int button); + bool getSELECTState(); + bool getSTARTState(); int getRightJoystickXaxis(); int getRightJoystickYaxis(); int getLeftJoystickXaxis(); @@ -60,6 +62,7 @@ /*{ return atan2(double(PS3Data[4]*-1+64), double(PS3Data[3]-64))*double(180/PI); }*/ + void printdata(); private: char PS3Data[8]; void (*fpFunc)();