kpadsample (KPADOld)

Location

$REVOLUTION_SDK_ROOT/build/demos/kpadOlddemo

Description

This sample program verifies KPADOld library functionality.
Values obtained from the library can be displayed on the screen and values that can be modified by the library can be edited.

Screen Display

POINTING The scaling value used for determining the on-screen position; it is the factor by which you multiply the pos member variable of the KPADStatus structure. The blue frame displayed on the screen shows a range of +/-1 for pos.
INTERVAL Indicates the interval (in meters) between the two sensors on the Sensor Bars.
POS HOR DIS ACC - PLAY SENS Shows the play radius (play_radius) and sensitivity (sensitivity) set for the pos,horizon,dist, and acc in the KPADStatus structure.
RPT - DLAY PLUS Indicates the repeat start time (delay_sec) and the repeat interval (pulse_sec) of the digital button.
HLD Displays the binary value of the flag set when a digital button is held down (hold) .
TRG Displays the binary value of the flag set when a digital button is pressed (trig).
REL Displays the binary value of the flag set when a digital button is released (release).
ACC Indicates the acc information of the KPADStatus structure as a vector in the 2D-xy-plane and a vector in the 2D-zy-plane (arrows are solid lines). When a Nunchuk is installed, the fs.acc information of the KPADEXStatus structure is displayed the same way (arrows are dotted lines).
VALID Indicates the dpd_valid_fg value of the KPADStatus structure.
DIST Indicates the dist value of the KPADStatus structure.
OBJ Indicates the position of the object captured by the DPD. The rectangle is the sensor range.

Parameter Adjustment

The values can be edited using the digital buttons. Move the cursor using the +Control Pad, and use the A Button to increment the value for that digit, and the B Button to decrement it.

Calibration

Calibration is required if the Sensor Bar is not level or if the accelerometer returns values that are off by a large amount. One example of this is when the Wii Remote is held in a horizontal position but the acceleration sensor returns values that differ considerably from those of a horizontal position. The calibration process corrects the value of the KPADStatus structure's horizon member variable; the acc member variable is not affected.

To activate calibration, press the + Button and - Button simultaneously. Be sure that the controller is in a horizontal position and that only two sensors are detected. If one or three sensors are detected, calibration will fail. If calibration succeeds, CALIBRATE is displayed on the screen; if calibration fails, ERROR is displayed.

Nunchuk

When the Nunchuk's Control Stick is moved, the movement is displayed on the TV screen as a yellow, dashed-line arrow.

Classic Controller

The kpadsample demo supports the Classic Controller. When a Classic Controller is connected to a Wii Remote, the state of the digital buttons (pressed/not pressed) on the Classic Controller will be displayed in the lower part of the TV screen. Movements of the Classic Controller L Stick and R Stick are displayed on the screen using blue and green arrows, respectively.

DPD ON/OFF

To turn the DPD feature ON, press the 1 Button on the Wii Remote; to turn it OFF, press the 2 Button.

Aiming Mode ON/OFF

When HOME on the Wii Remote is pressed, the aiming mode, which can be set using the KPADEnableAimingMode and KPADDisableAimingMode functions, is switched.

Source Code Files

main.h
main.c
Contains the application startup and framework source. Controllers are initialized and loaded in these files.
sample.h
sample.c
This application performs a variety of operations with the controller values. Contains the source for CPU and the drawing processes performed in each frame.
graphic.h
graphic.c
The collection of subroutines for simple graphics drawing.
kfont.h
kfont.c
The collection of subroutines that display text and values on the screen.

See Also

None.

Revision History

2006/10/25 Changed the name to KPADOld library, beginning with Revolution SDK 2.3.
2006/09/07 Added information about turning the aiming mode ON and OFF.
2006/08/30 Added information about operating the Nunchuk and Classic Controller.
2006/08/30 Added information about the ON/OFF operation of the DPD functionality.
2006/06/19 Changed tentative product name to official name.
2006/03/01 Initial version.


CONFIDENTIAL