kpadmpls

Location

$REVOLUTION_SDK_ROOT/build/demos/kpaddemo

Description

This 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.

Screen Display

MPLS PRAMS Edits modifiable parameters using the KPAD library. The following items can be edited: Zero-Point Tolerance, Zero-Point Drift Correction, Attitude Correction, Acceleration Correction, and DPD Correction. The state of each item is also displayed.
KPAD DEMO MAN Explains how to operate the sample demo.
ACC Displays the KPADStatus structure's acc information as a vector expressing the XY dimensions and a vector expressing the ZY dimensions.
OBJ Indicates the position of the object captured by the DPD. The rectangle is the sensor range.
MPLS Indicates the mpls value in the KPADMPStatus structure. The angular velocity for each axis is displayed below as pitch, yaw, and roll vectors. Up is positive, and down is negative.
ANGLE Indicates the angle value in the KPADMPStatus structure. The following angular data for each axis is displayed using circles for the pitch, yaw, and roll. The counterclockwise direction is positive.
DIR Indicates the dir value in the KPADMPStatus structure. A block is displayed to the side, rotated according to the attitude data.
MPLSCB Displayed, together with the reason value, when a callback registered with the KPADSetControlMplsCallback function is called. The display from the most recent call remains on the screen.
SMP.RATE Displays how many registered callbacks of the KPADSetSamplingCallback function are called per second.

Parameter Adjustment

The 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.

Resetting

Press the 1 Button on the Wii Remote to call the KPADResetMpls function and reset the internal state of all data processing related to the Wii MotionPlus. Press the 2 Button to call the KPADSetMplsAngle and KPADSetMplsDirection functions and reset the Wii Remote's angle and attitude data.

Starting the Wii MotionPlus and Changing Modes

The 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.

A ButtonChange to normal mode
B ButtonChange to bypass mode
X ButtonChange to a mode allowing simultaneous use of the Nunchuk
Y ButtonChange to a mode allowing simultaneous use of the Classic Controller

Calibration

Pressing HOME on the Wii Remote resets the Wii MotionPlus zero point using the KPADStartMplsCalibration function. Calibration processing is performed while the Wii MotionPlus is starting and when its mode is changing.

Block Color

The color of the block displayed in the center of the screen changes depending on the status of the Wii MotionPlus.

Bypass mode, not inserted, not connectedGray
Only the Wii MotionPlus is inserted in the Wii RemoteMagenta
A Wii MotionPlus and Nunchuk are inserted in the Wii RemoteOrange
A Wii MotionPlus and Classic Controller are inserted in the Wii RemoteGreen
A Wii MotionPlus and an extension controller other than the Nunchuk or Classic Controller are inserted in the Wii RemoteViolet

In addition, while the KPAD library is calibrating the Wii MotionPlus the block turns semitransparent. It returns to its original color as processing approaches completion.

Moving the Fulcrum of the Block

A 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.

Source Code Files

main.h
main.c
Contains the application startup and framework source.
sample.h
mpls.c
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.
graphic.h
graphic.c
The collection of subroutines for drawing simple graphics.
kfont.h
kfont.c
The collection of subroutines that display text and values on the screen.

See Also

None.

Revision History

2008/12/04 Initial version.


CONFIDENTIAL