#include <revolution/kpad.h>
typedef union KPADEXStatus{
struct {
Vec2 stick ;
Vec acc ;
f32 acc_value ;
f32 acc_speed ;
} fs ;
struct {
u32 hold;
u32 trig;
u32 release;
Vec2 lstick;
Vec2 rstick;
f32 ltrigger;
f32 rtrigger;
} cl ;
struct {
double tgc_weight ;
double weight[ WPAD_PRESS_UNITS ] ;
double weight_ave[ WPAD_PRESS_UNITS ] ;
s32 weight_err ;
} bl ;
} KPADEXStatus ;
| fs.stick | Control stick data for the Nunchuk. A circular or a cross clamp of maximum 1.0f is applied. |
|---|---|
| fs.acc | Accelerometer data. Note the coordinate system. Unlike the WPAD library, when the Nunchuk is pointed toward the TV screen, forward is Z+, upward is Y+, and rightward is X+. |
| fs.acc_value | Acceleration magnitude (length along the x-, y-, and z-axes). |
| fs.acc_speed | Change in acceleration (difference in length along the x-, y-, and z-axes relative to the previous values). |
| cl.hold | The flag is enabled while a Classic Controller button is pressed. |
| cl.trig | The flag is enabled only for the instant a Classic Controller button is pressed. |
| cl.release | The flag is enabled only for the instant a Classic Controller button is let go. |
| cl.lstick | Information related to the Classic Controller's L Stick. A circular or cross clamp of maximum 1.0f is applied. |
| cl.rstick | Information related to the Classic Controller's R Stick. A circular or cross clamp of maximum 1.0f is applied. |
| cl.ltrigger | Information related to the L Button of the Classic Controller (where 0.0f ≦ ltrigger ≦ 1.0f). |
| cl.rtrigger | Information related to the R Button of the Classic Controller (where 0.0f ≦ rtrigger ≦ 1.0f). |
| bl.tgc_weight | The most recent average weight applied to the entire Wii Balance Board over approximately 2 seconds, with temperature and gravity corrections calculated. |
| bl.weight | Sensor values for each of the four corners of the Wii Balance Board, converted into weights. |
| bl.weight_ave | Average values of the most recent weight for each corner of the Wii Balance Board over approximately 2 seconds. |
| bl.weight_err | Error code related to sensor values obtained from the Wii Balance Board. |
This union stores information from the external extension controller (Nunchuk and Classic Controller) separate from the Wii Remote. When the programmer accesses the ex_status member of the KPADStatus structure, that access must be performed according to the values of error status (wpad_err), controller type (dev_type), and data format (data_format).
Input from the Classic Controller buttons is defined using the following macro constants:
KPAD_CL_BUTTON_UP +Control Pad UP is being pressed. KPAD_CL_BUTTON_DOWN +Control Pad DOWN is being pressed. KPAD_CL_BUTTON_LEFT +Control Pad LEFT is being pressed. KPAD_CL_BUTTON_RIGHT +Control Pad RIGHT is being pressed. KPAD_CL_BUTTON_A A Button is being pressed. KPAD_CL_BUTTON_B B Button is being pressed. KPAD_CL_BUTTON_X X Button is being pressed. KPAD_CL_BUTTON_Y Y Button is being pressed. KPAD_CL_BUTTON_PLUS +/START Button is being pressed. KPAD_CL_BUTTON_HOME HOME is being pressed. KPAD_CL_BUTTON_MINUS -/SELECT Button is being pressed. KPAD_CL_TRIGGER_L L Button is being pressed. KPAD_CL_TRIGGER_R R Button is being pressed. KPAD_CL_TRIGGER_ZL ZL Button is being pressed. KPAD_CL_TRIGGER_ZR ZR Button is being pressed.
The error codes related to Wii Balance Board sensor values are defined by the following macro definitions.
KPAD_WBC_ERR_EXIST A mass of 7kg or greater has been placed on the Wii Balance Board. KPAD_WBC_ERR_NONE A mass of 7 kilograms or greater has not been placed on the Wii Balance Board. KPAD_WBC_ERR_NO_BATTERY The Wii Balance Board has no remaining battery life, and its sensors are not operational. KPAD_WBC_ERR_SETUP Wii Balance Board calibration has not been completed. KPAD_WBC_ERR_WRONG_TEMP Wii Balance Board temperature information is incorrect. Call the KPADResetWbcZeroPointfunction to initialize the Wii Balance Board.KPAD_WBC_ERR_WRONG_ZERO The zero point has not been correctly set for the Wii Balance Board. Call the KPADResetWbcZeroPointfunction to initialize the Wii Balance Board.
2008/04/30 Added descriptions related to the Wii Balance Board.
2006/10/25 Revised the description to match KPAD version 2.
2006/06/19 Changed the product name from tentative to official. Added information about unsupported member variables.
2006/03/01 Initial version.
CONFIDENTIAL