$REVOLUTION_SDK_ROOT/build/demos/kpaddemo
This sample program verifies KPAD library functionality. Using it, you can display onscreen any value that is possible to obtain from the library, and you can edit any value it is possible to modify in the library.
| 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 Bar. |
| POS HOR DIS ACC - PLAY SENS MODE | Shows the play radius (play_radius), sensitivity (sensitivity), and play mode (play_mode) 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 (displayed as solid-line arrows). When a Nunchuk is installed, the fs.acc information of the KPADEXStatus structure is displayed the same way (displayed as dotted-line arrows). |
| 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. |
| DPDCB | It will be displayed together with the reason value when a callback registered with KPADSetControlDpdCallback is called. The display from the last call will stay on the screen. |
| AIM | Displays the aiming mode. |
| CIRCLE CLAMP / CROSS CLAMP | Displays the stick clamp mode. |
| SMP.RATE | Displays how many registered callbacks of the KPADSetSamplingCallback function are called per second. |
The values can be edited using the digital buttons. Use the +Control Pad to move the cursor; A Button to increment the value for that digit or to change play_mode to KPAD_PLAY_MODE_TIGHT; and B Button to decrement it or change play_mode to KPAD_PLAY_MODE_LOOSE.
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.
When the Nunchuk's Control Stick is moved, the movement is displayed on the TV screen as a yellow, dashed-line arrow.
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.
To turn the DPD feature ON, press the 1 Button on the Wii Remote; to turn it OFF, press the 2 Button.
When HOME on the Wii Remote is pressed, the aiming mode, which can be set using the KPADEnableAimingMode and KPADDisableAimingMode functions, is switched.
Allows the switching of clamp mode of the Nunchuk or Classic Controller stick. The clamp mode is configured using the KPADEnableStickCrossClamp and KPADDisableStickCrossClamp functions. This is switched every time a C Button on the Nunchuk Unit or the -/SELECT Button on the Classic Controller is pressed. This is also switched while the Z Button on the Nunchuk or the +/START Button on the Classic Controller is pressed.
Pressing the Z Button on the Nintendo GameCube controller connected to 1P calls the KPADSetButtonProcMode function and changes the button-processing method. In the kpadsample demo, cursor movements utilize the button trigger information in the starting element of the sample buffer of the KPADReadEx function. Note that when the button processing method is KPAD_BUTTON_PROC_MODE_TIGHT, there will be times when the cursor does not move even if the button is pressed because there is no button trigger information in the starting element of the sampling buffer.
Miscellaneous tests may be performed by connecting a Nintendo GameCube Controller to 1P.
KPADReset function.KPADReadEx function will not be called from the main loop of the program.KPADSetReviseMode function; it will also turn ON or OFF the corrective processing that switches the position at which the Nunchuk motion sensor returns a horizontal value.KPADInitEx and KPADShutdown functions, starting and stopping the KPAD library.KPADSetButtonProcMode function and changes the button-processing method.main.hmain.c |
Contains the application startup and framework source. Controllers are initialized and loaded in these files. |
sample.hsample.c |
This application performs a variety of operations with the controller values. Contains the source for the CPU and rendering processes performed in each frame. |
graphic.hgraphic.c |
The collection of subroutines for simple graphics drawing. |
kfont.hkfont.c |
The collection of subroutines that display text and values on the screen. |
None.
2008/06/05 Added text regarding the addition of the button processing method test.
2008/04/25 Added mention of the new operation for alternately calling the KPADInit and KPADShutdown functions.
2007/07/12 Added the description for changing play_mode.
2007/06/04 Added the description for turning the Nunchuk Motion Sensor’s corrective processing ON or OFF using the KPADSetReviseMode function.
2007/01/15 Revised such that the coordinate correction feature is enabled by default. As a result, revised the demo.
2006/10/25 Revised the description to match KPAD version 2.
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 the product name from tentative to official.
2006/03/01 Initial version.
CONFIDENTIAL