kpadmpls

Location

$CAFE_ROOT/system/src/demo/kpad

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.

NOTE:
The Cafe controller must be paired before this demo can be used.

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.
SMP.RATE Displays how many registered callbacks of the KPADSetSamplingCallback function are called per second.

Wii Remote Controls

The Wii remote controller buttons have these functions in this demo:

Parameter Adjustment

The values can be edited using the digital buttons. Move the cursor with the Wii remote +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.

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 + Button and the - Button on the Wii remote.

GameCube Controls

The Nintendo GameCube controller (optional, connected to P1) buttons have these functions in this demo:

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. The mode can be changed with the GameCube buttons.

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

Controlling the Sensor Bar

The sensor bar can be turned on or off using the GameCube buttons.

X ButtonTurn the sensor bar ON
Y ButtonTurn the sensor bar OFF

Calibration

Pressing the +Control Pad Up Button on the GameCube Controller connected to P1 resets the Wii MotionPlus zero point using the KPADStartMplsCalibration function.

While the Wii MotionPlus is being calibrated by the KPAD library the block darkens. It returns to its original color as processing approaches completion.

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.

Revision History

2014/06/18 Fix some outdated comments.
2013/05/08 Automated cleanup pass.
2008/12/04 Initial version.


CONFIDENTIAL