#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 ;
s32 tgc_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). Zero is always returned, effective from SDK 3.3. |
| cl.rtrigger | Information related to the R Button of the Classic Controller (where 0.0f ≦ rtrigger ≦ 1.0f). Zero is always returned, effective from SDK 3.3. |
| 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. This is the true load applied to the Wii Balance Board. |
| bl.weight | Sensor values for each of the four corners of the Wii Balance Board, converted into weights. |
| bl.weight_ave | Average value calculated continuously over approximately 2 seconds' worth of samples of the body weight values calculated at each of the four corners of the Wii Balance Board. |
| bl.weight_err | Error code related to bl.weight, the sensor value obtained from the Wii Balance Board. |
| bl.tgc_weight_err | Error code related to bl.tgc_weight. The value is the most recent average weight applied to the entire Wii Balance Board over approximately 2 seconds, with temperature and gravity corrections calculated. |
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 load of 7 kg or more has been placed on the Wii Balance Board. KPAD_WBC_ERR_NONE A load of 7 kg or more has not been placed on the Wii Balance Board. KPAD_WBC_ERR_NO_BATTERY The Wii Balance Board has no remaining battery life and the sensors are not operational. KPAD_WBC_ERR_SETUP The calibration of the Wii Balance Board is not completed. KPAD_WBC_ERR_WRONG_TEMP This error code is not set any more. KPAD_WBC_ERR_WRONG_ZERO A load was placed on the Wii Balance Board while the zero point was being set, so the zero-point setting has failed. Call the KPADResetWbcZeroPointfunction and reset the zero point for the Wii Balance Board.KPAD_WBC_ERR_WEIGHT_OVER A load of more than 150 kg has been placed on the Wii Balance Board. KPAD_WBC_ERR_CALIBRATION Wii Balance Board calibration has failed three times. KPAD_WBC_ERR_NO_ZEROPOINT The Wii Balance Board zero point is not set. Call the KPADResetWbcZeroPointfunction and set the zero point for the Wii Balance Board.KPAD_WBC_ERR_ZEROPOINT The Wii Balance Board zero point is in the process of being set.
The following macro constants define the error codes related to the most recent average weight applied to the entire Wii Balance Board over approximately 2 seconds, with temperature and gravity corrections calculated.
KPAD_WBC_ERR_TGC_READY Ready to accurately measure the correct load. KPAD_WBC_ERR_TGC_NONE Measurement of the load is complete. The accurate value for the correct load is stored in bl.tgc_weight.KPAD_WBC_ERR_TGC_UNSTABLE An object is on the Wii Balance Board and it is ready to make an accurate measurement, but more than 10 seconds passed and the board failed to make an accurate weight measurement. The value of bl.tgc_weightis indefinite.KPAD_WBC_ERR_TGC_UNKNOWN The state before accurately measuring the correct load. The value of bl.tgc_weightis indefinite.KPAD_WBC_ERR_TGC_TIMEOUT The Wii Balance Board is ready to make an accurate measurement, but more than 10 seconds have passed and still no load has been placed on the device. The value of bl.tgc_weightis indefinite.KPAD_WBC_ERR_TGC_BUSY The load is being measured. The value of bl.tgc_weightis indefinite.
2010/04/29 Revised the description of the Wii Balance Board error codes.
2009/06/23 Revised the explanations for cl.ltrigger and cl.rtrigger.
2009/03/18 Revised the explanation for the Wii Balance Board structure members, bl.tgc_weight and bl.tgc_weight_err. Added the Wii Balance Board error codes.
2008/12/12 Changed a structure member for the Wii Balance Board. Revised Description regarding bl.weight_ave.
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