PSP2SDK  dirty-f9e4f2d
The free SDK for PSP2
include/psp2/ctrl.h
Go to the documentation of this file.
00001 
00012 #ifndef _PSP2_CTRL_H_
00013 #define _PSP2_CTRL_H_
00014 
00015 #include <stdint.h>
00016 
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020 
00021 enum {
00022     SCE_CTRL_ERROR_INVALID_ARG  = 0x80340001,
00023     SCE_CTRL_ERROR_PRIV_REQUIRED    = 0x80340002,
00024     SCE_CTRL_ERROR_FATAL        = 0x803400FF
00025 };
00026 
00028 enum {
00029     PSP2_CTRL_SELECT    = 0x000001, 
00030     PSP2_CTRL_START     = 0x000008, 
00031     PSP2_CTRL_UP        = 0x000010, 
00032     PSP2_CTRL_RIGHT     = 0x000020, 
00033     PSP2_CTRL_DOWN      = 0x000040, 
00034     PSP2_CTRL_LEFT      = 0x000080, 
00035     PSP2_CTRL_LTRIGGER  = 0x000100, 
00036     PSP2_CTRL_RTRIGGER  = 0x000200, 
00037     PSP2_CTRL_TRIANGLE  = 0x001000, 
00038     PSP2_CTRL_CIRCLE    = 0x002000, 
00039     PSP2_CTRL_CROSS     = 0x004000, 
00040     PSP2_CTRL_SQUARE    = 0x008000, 
00041     PSP2_CTRL_ANY       = 0x010000  
00042 };
00043 
00045 enum {
00047     PSP2_CTRL_MODE_DIGITAL = 0,
00049     PSP2_CTRL_MODE_ANALOG,
00051     PSP2_CTRL_MODE_ANALOG_WIDE
00052 };
00053 
00055 typedef struct SceCtrlData {
00057     uint64_t    timeStamp;
00059     unsigned int    buttons;
00061     unsigned char   lx;
00063     unsigned char   ly;
00065     unsigned char   rx;
00067     unsigned char   ry;
00069     uint8_t     reserved[16];
00070 } SceCtrlData;
00071 
00073 typedef struct SceCtrlRapidFireRule {
00074     unsigned int Mask;
00075     unsigned int Trigger;
00076     unsigned int Target;
00077     unsigned int Delay;
00078     unsigned int Make;
00079     unsigned int Break;
00080 } SceCtrlRapidFireRule;
00081 
00089 int sceCtrlSetSamplingMode(int mode);
00090 
00098 int sceCtrlGetSamplingMode(int *pMode);
00099 
00109 int sceCtrlPeekBufferPositive(int port, SceCtrlData *pad_data, int count);
00110 
00120 int sceCtrlPeekBufferNegative(int port, SceCtrlData *pad_data, int count);
00121 
00131 int sceCtrlReadBufferPositive(int port, SceCtrlData *pad_data, int count);
00132 
00142 int sceCtrlReadBufferNegative(int port, SceCtrlData *pad_data, int count);
00143 
00153 int sceCtrlSetRapidFire(int port, int idx, const SceCtrlRapidFireRule* pRule);
00154 
00163 int sceCtrlClearRapidFire(int port, int idx);
00164 
00165 #ifdef __cplusplus
00166 }
00167 #endif
00168 
00169 #endif /* _PSP2CTRL_H_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines