VPADStatus / VPADDir

Syntax

#include <cafe/vpad.h>

typedef struct VPADDir{
    Vec  X;
    Vec  Y;
    Vec  Z;
} VPADDir;

typedef struct VPADStatus{
    u32  hold ;
    u32  trig ;
    u32  release ;
 
    Vec2 lStick ;
    Vec2 rStick ;

    Vec  acc ;
    f32  accValue ;
    f32  accSpeed ;
    Vec2 accVertical ;

    Vec  gyro ;
    Vec  angle;

    s8   vpadErr ;
    
    VPADTPData  tpData ;
    VPADTPData  tpFilteredData1 ;
    VPADTPData  tpFilteredData2 ;

    VPADDir     dir ;

    BOOL   headphoneStatus ;

    Vec    magnet ;

    u8     slideVolume ;

    u8     batteryLevel ;

    u8     micStatus ;

    u8     slideVolumeCalibrated ;

    u8   __paddings__[ 7 ] ;

} VPADStatus ;

Elements

Elements Contained in the VPADDir Structure

X X-axis direction value.
Y Y-axis direction value.
Z Z-axis direction value.

Elements Contained in the VPADStatus Structure

hold The flag is enabled while the button is pressed.
trig The flag is enabled only for the instant the button is pressed.
release The flag is enabled only for the instant the button is released.
lStick Information related to the DRC's L Stick. A circular or cross clamp of up to 1.0f is applied.
rStick Information related to the DRC's R Stick. A circular or cross clamp of up to 1.0f is applied.
acc Acceleration sensor value.
accValue Magnitude of acceleration (length of x, y, and z).
accSpeed Change in acceleration (length of the difference along the x, y, and z axes relative to the previous values).
accVertical The top-bottom orientation of the DRC as obtained from the accelerometer. When the DRC is facing forward, the result for this 2D vector of length 1 is (1,0). The x coordinate is always positive, never negative. When y is positive, the DRC is facing upward; when negative, it is facing downward. This variable is not reflected in the play radius and sensitivity settings for VPAD.
gyro The value of the DRC angular velocity in each direction. 360 dps is expressed as a value ranging from 0 to 1.
angle The value of the DRC rotational angle obtained by calculating the value of the angular velocity in each direction. 360 degrees is expressed as a value ranging from 0 to 1.0.
vpadErr Reserved. Currently, there is no requirement to check this value in the application.
tpData The VPADTPData structure stores Touch Panel information.
tpFilteredData1 Touch panel data filtered by VPADTPData. Suitable for finger touch drawing.
tpFilteredData2 VPADTPData filtered touch panel data. Suitable for moving objects by finger touch.
dir The 3D attitude of the DRC.
headphoneStatus Whether headphones are plugged in (TRUE: headphones are inserted).
magnet Magnetometer value.
slideVolume The value of the DRC speaker volume (ranges from 0 to 255).
This is the raw data.
batteryLevel The battery Level of the DRC.
micStatus The microphone status of the DRC.
If (micStatus & VPAD_EXTERNAL_MIC_ON) != 0, it indicates that a headset (headphone + microphone) has been plugged into the DRC.
NOTE:
There is a delay (typically about 1 second) to detect it after the headphoneStatus becomes TRUE.
slideVolumeCalibrated The value of the DRC speaker volume (ranges from 0 to 255).
The factory calibration data is applied to this member.

Return Values

Button Input

Button input is defined with the following macro constants. The digital buttons +Control Pad, A, B, X, Y, + (plus), - (minus), L, R, ZL, ZR, L Stick, R Stick and HOME are located on the DRC. The +Control Pad is emulated by using the analog stick input.

VPAD_BUTTON_UP +Control Pad UP is being pressed.
VPAD_BUTTON_DOWN +Control Pad DOWN is being pressed.
VPAD_BUTTON_LEFT +Control Pad LEFT is being pressed.
VPAD_BUTTON_RIGHT +Control Pad RIGHT is being pressed.
VPAD_BUTTON_A A Button is being pressed.
VPAD_BUTTON_B B Button is being pressed.
VPAD_BUTTON_X X Button is being pressed.
VPAD_BUTTON_Y Y Button is being pressed.
VPAD_BUTTON_HOME HOME is being pressed.
VPAD_BUTTON_PLUS + Button is being pressed.
VPAD_BUTTON_MINUS - Button is being pressed.
VPAD_BUTTON_L(VPAD_TRIGGER_L) L Button(Trigger) is being pressed.
VPAD_BUTTON_R(VPAD_TRIGGER_R) R Button(Trigger) is being pressed.
VPAD_BUTTON_ZL(VPAD_TRIGGER_ZL) ZL Button(Trigger) is being pressed.
VPAD_BUTTON_ZR(VPAD_TRIGGER_ZR) ZR Button(Trigger) is being pressed.
VPAD_BUTTON_STICK_L L Stick Button is being pressed.
VPAD_BUTTON_STICK_R R Stick Button is being pressed.
VPAD_BUTTON_STICK_L_EMULATION_UP Up on the emulated +Control Pad, using the analog stick (L) input.
VPAD_BUTTON_STICK_L_EMULATION_DOWN Down on the emulated +Control Pad, using the analog stick (L) input.
VPAD_BUTTON_STICK_L_EMULATION_LEFT Left on the emulated +Control Pad, using the analog stick (L) input.
VPAD_BUTTON_STICK_L_EMULATION_RIGHT Right on the emulated +Control Pad, using the analog stick (L) input.
VPAD_BUTTON_STICK_R_EMULATION_UP Up on the emulated +Control Pad, using the analog stick (R) input.
VPAD_BUTTON_STICK_R_EMULATION_DOWN Down on the emulated +Control Pad, using the analog stick (R) input.
VPAD_BUTTON_STICK_R_EMULATION_LEFT Left on the emulated +Control Pad, using the analog stick (R) input.
VPAD_BUTTON_STICK_R_EMULATION_RIGHT Right on the emulated +Control Pad, using the analog stick (R) input.

Battery Level

Battery Level is defined with the following macro constants.

VPAD_BATTERY_LEVEL_CHARGE The battery in the DRC is charging.
VPAD_BATTERY_LEVEL_SHUTDOWN The DRC is shut down automatically at this battery level.
VPAD_BATTERY_LEVEL_CRITICAL The battery level is critical. The battery LED is blinking red.
VPAD_BATTERY_LEVEL_LOW The battery level is low. The battery LED is lit red.
VPAD_BATTERY_LEVEL_MEDIUM The battery level is medium.
VPAD_BATTERY_LEVEL_HIGH The battery level is high.
VPAD_BATTERY_LEVEL_MAX The battery level is maximum.

Description

This structure stores the controller information obtained with the VPADRead function. The tables above describe the information that is obtained.

See Also

VPADRead

Revision History

2015/04/09 Fixed the description of angle member in VPADStatus.
2014/01/27 Deleted unnecessary description.
2013/06/20 Added the description of "slideVolumeCalibrated".
2013/05/08 Automated cleanup pass.
2012/10/05 Added a comment for vpadErr.
2012/08/16 Added the description of micStatus.
2012/06/13 Added the description of magnetometer data.
2012/04/03 Added the description of filtered touch panel data.
2012/03/26 Added the description of +Control Pad emulation using the analog stick input.
2012/03/24 Added the description of battery level.
2012/01/20 Added the descriptions of L Stick Button and R Stick Button.
2011/12/02 Replaced the word "Trigger" with "Button".
2011/08/18 Added the description of headphoneStatus and slideVolume.
2011/03/30 Initial version.


CONFIDENTIAL