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=utf-8">
5<META http-equiv="Content-Style-Type" content="text/css">
6<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
7<title>KPAD Sample Demo (kpadmpls)</title>
8</head>
9
10<body>
11
12<h1>kpadmpls</h1>
13
14<h2>Location</h2>
15<p>
16<code>$REVOLUTION_SDK_ROOT/build/demos/kpaddemo</code>
17</p>
18
19<H2>Description</H2>
20<p>
21This sample program verifies the KPAD library's Wii MotionPlus functionality. Using it, you can display any value that is possible to obtain from the library, and you can edit all modifiable values.<br>
22</p>
23
24<h3>Screen Display</h3>
25<TABLE border="1" cellpadding="3" cellspacing="0.1" width="95%">
26  <TBODY>
27    <TR>
28      <TD>MPLS PRAMS</TD>
29      <TD>Edits modifiable parameters using the KPAD library. The following items can be edited: <B>Zero-Point Tolerance</B>, <B>Zero-Point Drift Correction</B>, <B>Attitude Correction</B>, <B>Acceleration Correction</B>, and <B>DPD Correction</B>. The state of each item is also displayed.</TD>
30    </TR>
31    <TR>
32      <TD>KPAD DEMO MAN</TD>
33      <TD>Explains how to operate the sample demo.</TD>
34    </TR>
35    <TR>
36      <TD>ACC</TD>
37      <TD>Displays the <A HREF="../KPADStatus.html"><CODE>KPADStatus</CODE></A> structure's <SPAN class="argument">acc</SPAN> information as a vector expressing the XY dimensions and a vector expressing the ZY dimensions.</TD>
38    </TR>
39    <TR>
40      <TD>OBJ</TD>
41      <TD>Indicates the position of the object captured by the DPD. The rectangle is the sensor range.</TD>
42    </TR>
43    <TR>
44      <TD>MPLS</TD>
45      <TD>Indicates the <SPAN class="argument">mpls</SPAN> value in the <A HREF="../KPADMPStatus.html"><CODE>KPADMPStatus</CODE></A> structure. The angular velocity for each axis is displayed below as pitch, yaw, and roll vectors. Up is positive, and down is negative.</TD>
46    </TR>
47    <TR>
48      <TD>ANGLE</TD>
49      <TD>Indicates the <SPAN class="argument">angle</SPAN> value in the <A HREF="../KPADMPStatus.html"><CODE>KPADMPStatus</CODE></A> structure. The following angular data for each axis is displayed using circles for the pitch, yaw, and roll. The counterclockwise direction is positive.</TD>
50    </TR>
51    <TR>
52      <TD>DIR</TD>
53      <TD>Indicates the <SPAN class="argument">dir</SPAN> value in the <A HREF="../KPADMPStatus.html"><CODE>KPADMPStatus</CODE></A> structure. A block is displayed to the side, rotated according to the attitude data.</TD>
54    </TR>
55    <TR>
56      <TD>MPLSCB</TD>
57      <TD>Displayed, together with the <SPAN class="argument">reason</SPAN> value, when a callback registered with the <A HREF="../KPADSetControlMplsCallback.html"><CODE>KPADSetControlMplsCallback</CODE></A> function is called. The display from the most recent call remains on the screen.</TD>
58    </TR>
59    <TR>
60      <TD>SMP.RATE</TD>
61      <TD>Displays how  many registered callbacks of the <a href="../KPADSetSamplingCallback.html"><CODE>KPADSetSamplingCallback</CODE></a> function are called per second.</TD>
62    </TR>
63  </TBODY>
64</TABLE>
65
66<h3>Parameter Adjustment</h3>
67<p>
68The values can be edited using the digital buttons. Move the cursor with the +Control Pad. Use the A Button to either turn on or increment the selected digit. Use the B Button to either to turn off or decrement the selected digit.
69</p>
70
71<h3>Resetting</h3>
72<p>
73Press the 1 Button on the Wii Remote to call the <a href="../KPADResetMpls.html"><code>KPADResetMpls</code></a> function and reset the internal state of all data processing related to the Wii MotionPlus. Press the 2 Button to call the <a href="../KPADSetMplsAngle.html"><code>KPADSetMplsAngle</code></a> and <a href="../KPADSetMplsDirection.html"><code>KPADSetMplsDirection</code></a> functions and reset the Wii Remote's angle and attitude data.
74</p>
75
76<h3>Starting the Wii MotionPlus and Changing Modes</h3>
77<p>
78The sample program starts up the Wii MotionPlus in normal mode immediately after the Wii Remote is paired. Change the operational mode with a Nintendo GameCube Controller connected to P1.
79</p>
80<table border="1">
81<tr><th>A Button</th><td>Change to normal mode</td></tr>
82<tr><th>B Button</th><td>Change to bypass mode</td></tr>
83<tr><th>X Button</th><td>Change to a mode allowing simultaneous use of the Nunchuk</td></tr>
84<tr><th>Y Button</th><td>Change to a mode allowing simultaneous use of the Classic Controller</td></tr>
85</table>
86
87<h3>Calibration</h3>
88<p>
89Pressing HOME on the Wii Remote resets the Wii MotionPlus zero point using the <a href="../KPADStartMplsCalibration.html"><code>KPADStartMplsCalibration</code></a> function. Calibration processing is performed while the Wii MotionPlus is starting and when its mode is changing.
90</p>
91
92<h3>Block Color</h3>
93<p>
94The color of the block displayed in the center of the screen changes depending on the status of the Wii MotionPlus.
95</p>
96<table border="1">
97<tr><th>Bypass mode, not inserted, not connected</th><td>Gray</td></tr>
98<tr><th>Only the Wii MotionPlus is inserted in the Wii Remote</th><td>Magenta</td></tr>
99<tr><th>A Wii MotionPlus and Nunchuk are inserted in the Wii Remote</th><td>Orange</td></tr>
100<tr><th>A Wii MotionPlus and Classic Controller are inserted in the Wii Remote</th><td>Green</td></tr>
101<tr><th>A Wii MotionPlus and an extension controller other than the Nunchuk or Classic Controller are inserted in the Wii Remote</th><td>Violet</td></tr>
102</table>
103<p>
104In addition, while the KPAD library is calibrating the Wii MotionPlus the block turns semitransparent. It returns to its original color as processing approaches completion.
105</p>
106
107<h3>Moving the Fulcrum of the Block</h3>
108<p>
109A block is initially displayed in the center of the screen. This shape is rotated based on the attitude data, using the fulcrum as the center point. The position of the fulcrum can be moved forward and back by three levels with the + and - Buttons on the Wii Remote.
110</p>
111
112<h3>Source Code Files</h3>
113<TABLE border="1" cellpadding="3" cellspacing="0.1" width="95%">
114  <TBODY>
115    <TR>
116      <TD><CODE>main.h</CODE><BR><CODE>main.c</CODE></TD>
117      <TD>Contains the application startup and framework source.</TD>
118    </TR>
119    <TR>
120      <TD><CODE>sample.h</CODE><BR><CODE>mpls.c</CODE></TD>
121      <TD>Form the main body of the application that performs a variety of operations using the controller values. These application files initialize and load controllers and contain the source code for the CPU processing and rendering that is performed every frame.</TD>
122    </TR>
123    <TR>
124      <TD><CODE>graphic.h</CODE><BR><CODE>graphic.c</CODE></TD>
125      <TD>The collection of subroutines for drawing simple graphics.</TD>
126    </TR>
127    <TR>
128      <TD><CODE>kfont.h</CODE><BR><CODE>kfont.c</CODE></TD>
129      <TD>The collection of subroutines that display text and values on the screen.</TD>
130    </TR>
131  </TBODY>
132</TABLE>
133
134<h2>See Also</h2>
135<P>None.</P>
136
137<H2>Revision History</H2>
138<P>
1392008/12/04 Initial version.
140</P>
141
142<hr><p>CONFIDENTIAL</p></body>
143</html>