kpadsample

Description

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

Screen Display

POINTING Indicates the scaling value for determining the onscreen position using the factor with which to multiply the pos member variable of the KPADStatus structure. The blue frame that is displayed onscreen shows a range of +/-1 for pos.
INTERVAL Indicates the interval between the two sensors on the Sensor Bar in meters.
POS HOR DIS ACC - PLAY SENS Shows the play radius (play_radius) and sensitivity (sensitivity) set for the pos, horizon, dist, and acc of the KPADStatus structure.
RPT - DLAY PLUS Indicates the repeat start time (delay_sec) and the repeat interval (pulse_sec) of the digital button.
HLD Indicates the flag as a binary value when a digital button is held down (hold).
TRG Indicates the flag as a binary value at the instant when a digital button is pressed (trig).
REL Indicates the flag as a binary value at the instant 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 Nunchaku Unit is installed, the fs.acc information of the KPADEXStatus structure is displayed in 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 with 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 leveled for some reason or if the accelerometer returns values that are off by a large magnitude (for example, when the Wii Remote Control is held in a horizontal position, but the acceleration sensor returns values that differ greatly from the values for a horizontal position). The calibration process corrects the value of the horizon member of the KPADStatus structure (the acc member variable is not affected).

Calibration is activated by pressing the plus and minus buttons simultaneously. Be sure the controller is in a horizontal position and that only two sensors are detected. If one or three sensors are detected, calibration fails. If calibration succeeds, CALIBRATE is displayed onscreen. If calibration fails, ERROR is displayed onscreen.

Source Code Files

main.h, main.c Contains the application startup and framework source. Controller initialization and loading are performed in these files.
sample.h, sample.c This application performs a variety of operations with the controller values. Contains the source for CPU and 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 displays text and values onscreen.

See Also

Revision History

03/01/2006 Initial version.
06/19/2006 Changed tentative product name to official name.