ps3 with sbdbt

Dependents:   NHK2019manualver2 NHK2019manualver2_10_3

Committer:
sgrsn
Date:
Tue May 10 08:18:54 2016 +0000
Revision:
0:87f83956cb4c
Child:
2:fe29007fb56c
ps3 with sbdbt

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sgrsn 0:87f83956cb4c 1 #ifndef PS3_H
sgrsn 0:87f83956cb4c 2 #define PS3_H
sgrsn 0:87f83956cb4c 3 #include "mbed.h"
sgrsn 0:87f83956cb4c 4 //bit,button
sgrsn 0:87f83956cb4c 5 #define sikaku 16 //00010000
sgrsn 0:87f83956cb4c 6 #define sankaku 36 //00100100
sgrsn 0:87f83956cb4c 7 #define batu 37 //00100101
sgrsn 0:87f83956cb4c 8 #define maru 38 //00100110
sgrsn 0:87f83956cb4c 9 #define ue 32 //00100000
sgrsn 0:87f83956cb4c 10 #define sita 33 //00100001
sgrsn 0:87f83956cb4c 11 #define migi 34 //00100010
sgrsn 0:87f83956cb4c 12 #define hidari 35 //00100011
sgrsn 0:87f83956cb4c 13 #define L1 17 //00010001
sgrsn 0:87f83956cb4c 14 #define L2 18 //00010010
sgrsn 0:87f83956cb4c 15 #define R1 19 //00010011
sgrsn 0:87f83956cb4c 16 #define R2 20 //00010100
sgrsn 0:87f83956cb4c 17
sgrsn 0:87f83956cb4c 18 #define PI 3.141592654
sgrsn 0:87f83956cb4c 19
sgrsn 0:87f83956cb4c 20 class PS3 : public Serial
sgrsn 0:87f83956cb4c 21 {
sgrsn 0:87f83956cb4c 22 public:
sgrsn 0:87f83956cb4c 23 PS3(PinName TX, PinName RX);/* : Serial(TX,RX)
sgrsn 0:87f83956cb4c 24 {
sgrsn 0:87f83956cb4c 25 PS3Data[0] = 128;
sgrsn 0:87f83956cb4c 26 PS3Data[1] = 0;
sgrsn 0:87f83956cb4c 27 PS3Data[2] = 0;
sgrsn 0:87f83956cb4c 28 PS3Data[3] = 64;
sgrsn 0:87f83956cb4c 29 PS3Data[4] = 64;
sgrsn 0:87f83956cb4c 30 PS3Data[5] = 64;
sgrsn 0:87f83956cb4c 31 PS3Data[6] = 64;
sgrsn 0:87f83956cb4c 32 PS3Data[7] = 0;
sgrsn 0:87f83956cb4c 33 baud(2400);
sgrsn 0:87f83956cb4c 34 attach(this, &PS3::getdata, Serial::RxIrq);
sgrsn 0:87f83956cb4c 35 }*/
sgrsn 0:87f83956cb4c 36 void getdata();
sgrsn 0:87f83956cb4c 37 /*{
sgrsn 0:87f83956cb4c 38 if(Serial::readable())
sgrsn 0:87f83956cb4c 39 {
sgrsn 0:87f83956cb4c 40 for(int i = 0;i < 8;i++)
sgrsn 0:87f83956cb4c 41 *(PS3Data+i) = Serial::getc();
sgrsn 0:87f83956cb4c 42 }
sgrsn 0:87f83956cb4c 43 }*/
sgrsn 0:87f83956cb4c 44 bool getButtonState(int button);
sgrsn 0:87f83956cb4c 45 /*{
sgrsn 0:87f83956cb4c 46 return (*(PS3Data+(button>>4)) >> (button & 0x0f)) & 1;
sgrsn 0:87f83956cb4c 47 }*/
sgrsn 0:87f83956cb4c 48 double getRightJoystickAngle();
sgrsn 0:87f83956cb4c 49 /*{
sgrsn 0:87f83956cb4c 50 return atan2(double(PS3Data[6]*-1+64), double(PS3Data[5]-64))*double(180/PI);
sgrsn 0:87f83956cb4c 51 }*/
sgrsn 0:87f83956cb4c 52 double getLeftJoystickAngle();
sgrsn 0:87f83956cb4c 53 /*{
sgrsn 0:87f83956cb4c 54 return atan2(double(PS3Data[4]*-1+64), double(PS3Data[3]-64))*double(180/PI);
sgrsn 0:87f83956cb4c 55 }*/
sgrsn 0:87f83956cb4c 56 private:
sgrsn 0:87f83956cb4c 57 char PS3Data[8];
sgrsn 0:87f83956cb4c 58 };
sgrsn 0:87f83956cb4c 59
sgrsn 0:87f83956cb4c 60 #endif