Advertisement
BaSs_HaXoR

Wired PS3 Six Axis Controller Using USB HID as Input

Sep 15th, 2014
478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.97 KB | None | 0 0
  1. http://www.codeproject.com/Articles/23634/Wired-PS-Six-Axis-Controller-Using-USB-HID-as-Inp
  2.  
  3. typedef struct tagPS3_data
  4. {
  5.     BYTE    ReportID;
  6.     union {
  7.         struct{
  8.             BYTE    LAnalogX;
  9.             BYTE    LAnalogY;
  10.             BYTE    dummy[46];
  11.             bool    Triangle:1;
  12.             bool    Circle:1;
  13.             bool    Cross:1;
  14.             bool    Cube:1;
  15.             bool    L2:1;
  16.             bool    R2:1;
  17.             bool    L1:1;
  18.             bool    R1:1;
  19.         };
  20.         BYTE    data[49];
  21.     };
  22. } PS3_data;
  23.  
  24. iPos += sprintf(&buffer[iPos],"test %d\r\n", 0 );
  25.  
  26.  void PS3_data::Format ( char* buffer )
  27.     {
  28.         int iPos = 0;
  29.  
  30.         iPos += sprintf(&buffer[iPos],"LeftJoy:%d-%d RightPad:%d %d %d %d\r\n",
  31.             LAnalogX,LAnalogY,Triangle,Circle,Cross,Cube);
  32.  
  33.         int id=0;
  34.         int idMax=45;
  35.         for ( ; id<=idMax;id++)    iPos += sprintf(&buffer[iPos],"%02d:%d\r\n", id,
  36.             data[id]);
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement