1 /*---------------------------------------------------------------------------*
2   Project:  Cafe
3   File:     vpadAPIs.h
4 
5   Copyright (C) Nintendo.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13  *---------------------------------------------------------------------------*/
14 
15 #ifndef __VPAD_API_H__
16 #define __VPAD_API_H__
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 /*************************************/
23 /*        function prototype         */
24 /*************************************/
25 void         VPADInit          ( void ) ;
26 void         VPADShutdown      ( void ) ;
27 s32          VPADRead          ( s32 chan,
28                                  VPADStatus samplingBufs[],
29                                  u32 length, s32* err ) ;
30 
31 void         VPADSetAccParam   ( s32 chan,
32                                  f32 play_radius, f32 sensitivity ) ;
33 void         VPADGetAccParam   ( s32 chan,
34                                  f32 *play_radius, f32 *sensitivity ) ;
35 
36 void         VPADSetBtnRepeat  ( s32 chan, f32 delay_sec, f32 pulse_sec ) ;
37 
38 void         VPADEnableStickCrossClamp  ( s32 chan ) ;
39 void         VPADDisableStickCrossClamp ( s32 chan ) ;
40 void         VPADSetLStickClampThreshold( s32 chan,  s32 max, s32 min) ;
41 void         VPADSetRStickClampThreshold( s32 chan,  s32 max, s32 min) ;
42 void         VPADGetLStickClampThreshold( s32 chan,  s32* max, s32* min) ;
43 void         VPADGetRStickClampThreshold( s32 chan,  s32* max, s32* min) ;
44 void         VPADSetStickOrigin         ( s32 chan ) ;
45 void         VPADDisableLStickZeroClamp ( s32 chan ) ;
46 void         VPADDisableRStickZeroClamp ( s32 chan ) ;
47 void         VPADEnableLStickZeroClamp  ( s32 chan ) ;
48 void         VPADEnableRStickZeroClamp  ( s32 chan ) ;
49 void         VPADSetCrossStickEmulationParamsL( s32 chan,
50                                                 f32 rot_deg,
51                                                 f32 xy_deg,
52                                                 f32 radius );
53 void         VPADSetCrossStickEmulationParamsR( s32 chan,
54                                                 f32 rot_deg,
55                                                 f32 xy_deg,
56                                                 f32 radius );
57 void         VPADGetCrossStickEmulationParamsL( s32 chan,
58                                                 f32* rot_deg,
59                                                 f32* xy_deg,
60                                                 f32* radius );
61 void         VPADGetCrossStickEmulationParamsR( s32 chan,
62                                                 f32* rot_deg,
63                                                 f32* xy_deg,
64                                                 f32* radius );
65 
66 VPADSamplingCallback VPADSetSamplingCallback( s32 chan,
67                                               VPADSamplingCallback callback ) ;
68 
69 void         VPADSetAccPlayMode ( s32 chan, VPADPlayMode mode ) ;
70 VPADPlayMode VPADGetAccPlayMode ( s32 chan ) ;
71 
72 void         VPADSetButtonProcMode ( s32 chan, u8 mode ) ;
73 u8           VPADGetButtonProcMode ( s32 chan ) ;
74 
75 
76 //======= Gyro Calculation =======//
77 void         VPADSetGyroAngle           ( s32 chan, f32 ax, f32 ay, f32 az ) ;
78 void         VPADSetGyroDirection       ( s32 chan, VPADDir *dir ) ;
79 void         VPADSetGyroDirectionMag    ( s32 chan, f32 mag ) ;
80 void         VPADSetGyroMagnification   ( s32 chan,
81                                           f32 pitch, f32 yaw, f32 roll ) ;
82 
83 void         VPADEnableGyroZeroPlay ( s32 chan ) ;
84 void         VPADEnableGyroDirRevise( s32 chan ) ;
85 void         VPADEnableGyroAccRevise( s32 chan ) ;
86 
87 void         VPADDisableGyroZeroPlay ( s32 chan ) ;
88 void         VPADDisableGyroDirRevise( s32 chan ) ;
89 void         VPADDisableGyroAccRevise( s32 chan ) ;
90 
91 f32          VPADIsEnableGyroZeroPlay ( s32 chan ) ;
92 f32          VPADIsEnableGyroZeroDrift( s32 chan ) ;
93 f32          VPADIsEnableGyroDirRevise( s32 chan ) ;
94 f32          VPADIsEnableGyroAccRevise( s32 chan ) ;
95 
96 void         VPADSetGyroZeroPlayParam ( s32 chan, f32 radius ) ;
97 void         VPADSetGyroDirReviseParam( s32 chan, f32 revise_pw ) ;
98 void         VPADSetGyroAccReviseParam( s32 chan,
99                                         f32 revise_pw, f32 revise_range ) ;
100 void         VPADSetGyroDirReviseBase ( s32 chan, VPADDir *base ) ;
101 
102 void         VPADGetGyroZeroPlayParam ( s32 chan, f32 *radius ) ;
103 void         VPADGetGyroDirReviseParam( s32 chan, f32 *revise_pw ) ;
104 void         VPADGetGyroAccReviseParam( s32 chan,
105                                         f32 *revise_pw, f32 *revise_range ) ;
106 
107 void         VPADInitGyroZeroPlayParam ( s32 chan ) ;
108 void         VPADInitGyroDirReviseParam( s32 chan ) ;
109 void         VPADInitGyroAccReviseParam( s32 chan ) ;
110 
111 void         VPADInitGyroZeroDriftMode( s32 chan ) ;
112 void         VPADSetGyroZeroDriftMode ( s32 chan,
113                                         VPADGyroZeroDriftMode  mode ) ;
114 void         VPADGetGyroZeroDriftMode ( s32 chan,
115                                         VPADGyroZeroDriftMode *mode ) ;
116 
117 //======= Touch Panel =======//
118 s16 VPADCalcTPCalibrationParam( VPADTPCalibrationParam* param,
119                                 u16 rawX1, u16 rawY1, u16 x1, u16 y1,
120                                 u16 rawX2, u16 rawY2, u16 x2, u16 y2 );
121 
122 void VPADSetTPCalibrationParam( s32 chan,
123                                 const VPADTPCalibrationParam param );
124 
125 void VPADGetTPCalibrationParam( s32 chan,
126                                 VPADTPCalibrationParam* param );
127 
128 void VPADGetTPCalibratedPoint( s32 chan,
129                                VPADTPData *disp, const VPADTPData *raw );
130 
131 void VPADGetTPCalibratedPointEx( s32 chan, VPADTPResolution tpReso,
132                                  VPADTPData *disp, const VPADTPData *raw );
133 
134 
135 //======= Motor =======//
136 s32    VPADControlMotor( s32 chan, u8* pattern, u8 length ) ;
137 void   VPADStopMotor( s32 chan ) ;
138 
139 //======= Sensorbar LED =======//
140 s32    VPADSetSensorBar( s32 chan, BOOL on ) ;
141 
142 //======= LCD Mode =======//
143 s32    VPADSetLcdMode( s32 chan, VPADLcdMode mode ) ;
144 s32    VPADGetLcdMode( s32 chan, VPADLcdMode *mode ) ;
145 
146 //======= TV Menu =======//
147 u8     VPADGetTVMenuStatus ( s32 chan ) ;
148 
149 //======= Magnetometer =======//
150 f32    VPADIsStartedGyroMagRevise( s32 chan );
151 void   VPADStartGyroMagRevise    ( s32 chan );
152 void   VPADStopGyroMagRevise     ( s32 chan );
153 
154 void   VPADSetGyroMagReviseParam( s32 chan,
155                                   f32  revise_pw, f32  play_angle ) ;
156 void   VPADGetGyroMagReviseParam( s32 chan,
157                                   f32* revise_pw, f32* play_angle ) ;
158 
159 #ifdef __cplusplus
160 }
161 #endif
162 
163 #endif  // __VPAD_API_H__
164