1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css"> 8<title>WPADStatus</title> 9</head> 10 11<body> 12 13<h1>WPADStatus</h1> 14 15 16<H2>C Specification</H2> 17<DL> 18 <DD> 19<PRE><CODE>#include <revolution/wpad.h></CODE></PRE> 20 <DD> 21 <PRE><CODE> 22#define WPAD_DPD_MAX_OBJECTS 4 23 24#define WPAD_BUTTON_LEFT 0x0001 25#define WPAD_BUTTON_RIGHT 0x0002 26#define WPAD_BUTTON_DOWN 0x0004 27#define WPAD_BUTTON_UP 0x0008 28#define WPAD_BUTTON_PLUS 0x0010 29#define WPAD_BUTTON_2 0x0100 30#define WPAD_BUTTON_1 0x0200 31#define WPAD_BUTTON_B 0x0400 32#define WPAD_BUTTON_A 0x0800 33#define WPAD_BUTTON_MINUS 0x1000 34#define WPAD_BUTTON_HOME 0x8000 35 36// for FreeStyle 37#define WPAD_BUTTON_Z 0x2000 38#define WPAD_BUTTON_C 0x4000 39 40// for ClassicStyle 41#define WPAD_CL_BUTTON_UP 0x0001 42#define WPAD_CL_BUTTON_LEFT 0x0002 43#define WPAD_CL_TRIGGER_ZR 0x0004 44#define WPAD_CL_BUTTON_X 0x0008 45#define WPAD_CL_BUTTON_A 0x0010 46#define WPAD_CL_BUTTON_Y 0x0020 47#define WPAD_CL_BUTTON_B 0x0040 48#define WPAD_CL_TRIGGER_ZL 0x0080 49#define WPAD_CL_RESERVED 0x0100 50#define WPAD_CL_TRIGGER_R 0x0200 51#define WPAD_CL_BUTTON_PLUS 0x0400 52#define WPAD_CL_BUTTON_HOME 0x0800 53#define WPAD_CL_BUTTON_MINUS 0x1000 54#define WPAD_CL_TRIGGER_L 0x2000 55#define WPAD_CL_BUTTON_DOWN 0x4000 56#define WPAD_CL_BUTTON_RIGHT 0x8000 57 58// for compatibility 59#define WPAD_BUTTON_SELECT WPAD_BUTTON_MINUS 60#define WPAD_BUTTON_START WPAD_BUTTON_PLUS 61#define WPAD_BUTTON_SMALL_B WPAD_BUTTON_2 62#define WPAD_BUTTON_SMALL_A WPAD_BUTTON_1 63#define WPAD_BUTTON_Z1 WPAD_BUTTON_Z 64#define WPAD_BUTTON_Z2 WPAD_BUTTON_C 65 66 67typedef struct WPADStatus 68{ 69u16 button; 70s16 accX; 71s16 accY; 72s16 accZ; 73DPDObject obj[WPAD_DPD_MAX_OBJECTS]; 74u8 dev; 75s8 err; 76} WPADStatus; 77 78typedef struct DPDObject 79{ 80s16 x; 81s16 y; 82u16 size; 83u8 traceId; 84} DPDObject; 85</CODE></PRE> 86</DL> 87<H2>Elements</H2> 88<TABLE border="1" cellpadding="3" cellspacing="0.1"> 89 <TBODY> 90 <tr> 91<TD><code><b><i>button</i></b></code></TD> 92<TD>When a button is pressed, the corresponding bit (<code>WPAD_BUTTON_*</code>) is set to 1.</TD> 93 </tr> 94 <tr> 95<TD><code><b><i>accX</i></b></code></TD> 96<TD>Output of the motion sensor's x-component. The resolution is 1024. A value of 0 corresponds to 0G (outputs in the range of -512 <= <code><b><i>accX</i></b></code> < 512).</TD> 97 </tr> 98 <tr> 99<TD><code><b><i>accY</i></b></code></TD> 100<TD>Output of the motion sensor's y-component. The resolution is the same as for <code><b><i>accX</i></b></code>.</TD> 101 </tr> 102 <tr> 103<TD><code><b><i>accZ</i></b></code></TD> 104<TD>Output of the motion sensor's z-component. The resolution is the same as for <code><b><i>accX</i></b></code>.</TD> 105 </tr> 106 <tr> 107<TD><code><b><i>obj[].x</i></b></code></TD> 108<TD>The x-coordinate of the center of mass for the object obtained with the pointer. The resolution is 1024.</TD> 109 </tr> 110 <tr> 111<TD><code><b><i>obj[].y</i></b></code></TD> 112<TD>The y-coordinate of the center of mass for the object obtained with the pointer. The resolution is 768.</TD> 113 </tr> 114 <tr> 115<TD><code><b><i>obj[].size</i></b></code></TD> 116<TD>The size of the object obtained with the pointer. The resolution is 128*96.</TD> 117 </tr> 118 <tr> 119<TD><code><b><i>obj[].traceId</i></b></code></TD> 120<TD>The trace ID of the object obtained with the pointer.</TD> 121 </tr> 122 <tr> 123<TD><code><b><i>dev</i></b></code></TD> 124<TD>The controller type.</TD> 125 </tr> 126 <TR> 127<TD width="120" valign="top"><CODE><b><i>err</i></b></CODE></TD> 128<TD width="520">The controller error status. 129 </TD> 130 </TR> 131 </TBODY> 132</TABLE> 133 134 135 136<h2>Description</h2> 137<p> 138The WPADStatus structure represents the status of the Wii Remote. 139<ul> 140<li>Number of Standard Controllers</li> 141</ul> 142<blockquote> 143The maximum number of Wii Remotes that can connect is defined as a macro constant. 144<table border="1"> 145<TR> 146<TD width="150"><CODE>WPAD_MAX_CONTROLLERS</CODE></TD> 147<TD>The maximum number of Wii Remotes that can connect.</TD> 148</TR> 149</table> 150</blockquote> 151 152<ul> 153<li>Button Input</li> 154</ul> 155<blockquote> 156Button inputs are defined with the following macro constants. The Wii Remote is equipped with + Control Pad, A, B, 1, 2, MINUS, PLUS, and HOME digital buttons. 157<table border="1"> 158<TR> 159<TD width="150"><CODE>WPAD_BUTTON_UP</CODE></TD> 160<TD>+Control Pad UP is being pressed.</TD> 161</TR> 162<TR> 163<TD width="150"><CODE>WPAD_BUTTON_DOWN</CODE></TD> 164<TD>+Control Pad DOWN is being pressed.</TD> 165</TR> 166<TR> 167<TD width="150"><CODE>WPAD_BUTTON_LEFT</CODE></TD> 168<TD>+Control Pad LEFT is being pressed.</TD> 169</TR> 170<TR> 171<TD width="150"><CODE>WPAD_BUTTON_RIGHT</CODE></TD> 172<TD>+Control Pad RIGHT is being pressed.</TD> 173</TR> 174<TR> 175<TD width="150"><CODE>WPAD_BUTTON_A</CODE></TD> 176<TD>The A Button is being pressed.</TD> 177</TR> 178<TR> 179<TD width="150"><CODE>WPAD_BUTTON_B</CODE></TD> 180<TD>The B Button is being pressed.</TD> 181</TR> 182<TR> 183<TD width="150"><CODE>WPAD_BUTTON_1</CODE></TD> 184<TD>The 1 Button is being pressed.</TD> 185</TR> 186<TR> 187<TD width="150"><CODE>WPAD_BUTTON_2</CODE></TD> 188<TD>The 2 Button is being pressed.</TD> 189</TR> 190<TR> 191<TD width="150"><CODE>WPAD_BUTTON_MINUS</CODE></TD> 192<TD>The MINUS button is being pressed.</TD> 193</TR> 194<TR> 195<TD width="150"><CODE>WPAD_BUTTON_PLUS</CODE></TD> 196<TD>The PLUS button is being pressed.</TD> 197</TR> 198<TR> 199<TD width="150"><CODE>WPAD_BUTTON_HOME</CODE></TD> 200<TD>HOME is being pressed.</TD> 201</TR> 202</table> 203</blockquote> 204 205<ul> 206<li>Pointer</li> 207</ul> 208<blockquote> 209The pointer specifications are defined as macro constants. 210 211<table border="1"> 212<TR> 213<TD width="150"><CODE>WPAD_DPD_MAX_OBJECTS</CODE></TD> 214<TD>The maximum number of objects that the pointer can detect simultaneously.</TD> 215</TR> 216<TR> 217<TD width="150"><CODE>WPAD_DPD_ANGLE</CODE></TD> 218<TD>The pointer view angle (in degrees).</TD> 219</TR> 220<TR> 221<TD width="150"><CODE>WPAD_DPD_IMG_RESO_WX</CODE></TD> 222<TD>Pointer resolution along the x-axis.</TD> 223</TR> 224<TR> 225<TD width="150"><CODE>WPAD_DPD_IMG_RESO_WY</CODE></TD> 226<TD>Pointer resolution along the y-axis.</TD> 227</TR> 228</table> 229 230<p> 231Object data items are stored in the obj[] array in the order that they are detected by the pointer. The pointer scans the image captured by sensor internally from top left to bottom right and outputs object data in the order detected. At the same time, trace ID(s) are assigned in the order that the objects are detected. 232</p> 233<p> 234The trace ID helps to judge whether previously obtained data is the same as the currently obtained data. Consider a case where objects A (trace ID=0) and B (trace ID=1) are detected as A and B, respectively, by the previous scan, and then they are detected as B and A, respectively, after the pointer is moved. The output order for the current scan is the reverse of the previous one. However, the trace IDs are in the order of B (using the previously assigned trace ID of 1) and A (using the previously assigned trace ID of 0), and the fact that the data is the same is preserved. 235</p> 236</blockquote> 237 238<ul> 239<li>Motion Sensor</li> 240</ul> 241<blockquote> 242The motion sensor specifications are defined as macro constants. 243 244<table border="1" 245 246<TR> 247<TD width="150"><CODE>WPAD_ACC_RESO</CODE></TD> 248<TD>The motion sensor's resolution.</TD> 249</TR> 250 251</table> 252</blockquote> 253 254<ul> 255<li>Controller Type</li> 256</ul> 257<blockquote> 258Controller types are defined with the following macro constants. 259 <TABLE border="1" width="500" cellspacing="0.1"> 260 <TBODY> 261 <TR> 262<TD width="150"><CODE>WPAD_DEV_CORE</CODE></TD> 263<TD width="350">Wii Remote.</TD> 264 </TR> 265 <TR> 266<TD width="150"><CODE>WPAD_DEV_FREESTYLE</CODE></TD> 267<TD width="350">Nunchuk Style.</TD> 268 </TR> 269 <TR> 270<TD width="150"><CODE>WPAD_DEV_CLASSIC</CODE></TD> 271<TD width="350">Classic Style. 272 </TR> 273 <TR> 274<TD width="150"><CODE>WPAD_DEV_UNKNOWN</CODE></TD> 275<TD width="350">Unknown device. 276 </TD> 277 </TR> 278 </TBODY> 279 </TABLE> 280</blockquote> 281<ul> 282<li>Error Status</li> 283</ul> 284<blockquote> 285Error statuses are defined with the following macro constants. 286 <TABLE border="1" width="500" cellspacing="0.1"> 287 <TBODY> 288 <TR> 289<TD width="150"><CODE>WPAD_ERR_NONE</CODE></TD> 290<TD width="350">Indicates the Wii Remote is connected. The <code>WPADStatus</code> structure contains valid data.</TD> 291 </TR> 292 <TR> 293<TD width="150"><CODE>WPAD_ERR_NO_CONTROLLER</CODE></TD> 294<TD width="350">Indicates the Wii Remote is not connected. The <code>WPADStatus</code> structure does not contain valid data. (Members other than <CODE><b><i>err</i></b></CODE> are undefined.) 295 </TD> 296 </TR> 297 <TR> 298<TD width="150"><CODE>WPAD_ERR_BUSY</CODE></TD> 299<TD width="350">Processing is being carried out for the Wii Remote. Only button information is valid for the <code>WPADStatus</code> structure.<BR> 300 </TR> 301 <TR> 302<TD width="150"><CODE>WPAD_ERR_TRANSFER</CODE></TD> 303<TD width="350">Indicates a problem occurred during communications. The <code>WPADStatus</code> structure does not contain valid data. (Members other than <CODE><b><i>err</i></b></CODE> are undefined.) 304 </TD> 305 </TR> 306 <TR> 307<TD width="150"><CODE>WPAD_ERR_INVALID</CODE></TD> 308<TD width="350">The data format of data received from the Wii Remote differs from that set by the <a href="./WPADSetDataFormat.html"><code>WPADSetDataFormat</code></a> function. (Structure members other than err are undefined.)</TD> 309 </TR> 310 </TBODY> 311 </TABLE> 312</blockquote> 313 314</p> 315<H2>See Also</H2> 316<p> 317<A href="./toc.html" target="contents"><CODE>WPAD Functions</CODE></A><br> 318</p> 319 320 321<H2>Revision History</H2> 322<P> 32308/15/2006 Revised the description of WPAD_ERR_INVALID<br> 2006/06/19 Added define, changed the name of the External Extension Controller, changed the names of buttons, revised the description of WPAD_DEV_DOLPHIN. 10/27/2005 Changed the resolution for acceleration from 2048 to 1024. Changed the interface from EXI to SI.<br>09/27/2005 Changed the abbreviation to DPD. Deleted the note regarding the <code>DPDObject</code> members <CODE><b><i>size</i></b></CODE> and <CODE><b><i>traceID</i></b></CODE>; Changed the description related to DPD.<br>08/30/2005 Revised the description of buttons; added a note that the member variables of the structure <code>DPDObject</code> will change.<br>08/01/2005 Initial version.<br> 324</P> 325<hr> 326<P>CONFIDENTIAL</p> 327</BODY> 328</HTML>