WPADSetDataFormat

Syntax

#include <cafe/pads/wpad/wpad.h>
#include <cafe/pads/wpad/wpadBalance.h>
#include <cafe/pads/wpad/wpadGuitar.h>
#include <cafe/pads/wpad/wpadDrum.h>
#include <cafe/pads/wpad/wpadTaiko.h>
#include <cafe/pads/wpad/wpadTrain.h>

#define WPAD_CHAN0               0
#define WPAD_CHAN1               1
#define WPAD_CHAN2               2
#define WPAD_CHAN3               3

#define WPAD_FMT_CORE                  0
#define WPAD_FMT_CORE_ACC              1
#define WPAD_FMT_CORE_ACC_DPD          2
#define WPAD_FMT_FREESTYLE             3
#define WPAD_FMT_FREESTYLE_ACC         4
#define WPAD_FMT_FREESTYLE_ACC_DPD     5
#define WPAD_FMT_CLASSIC               6
#define WPAD_FMT_CLASSIC_ACC           7
#define WPAD_FMT_CLASSIC_ACC_DPD       8
#define WPAD_FMT_CORE_ACC_DPD_FULL     9
#define WPAD_FMT_TRAIN                10
#define WPAD_FMT_GUITAR               11
#define WPAD_FMT_BALANCE_CHECKER      12
#define WPAD_FMT_DRUM                 15
#define WPAD_FMT_MPLS                 16
#define WPAD_FMT_TAIKO                17
#define WPAD_FMT_URCC                 22

s32 WPADSetDataFormat( s32 chan, u32 fmt );

Parameters

chan One of the WPAD_CHANn values.
fmt One of the WPAD_FMT_* values.

Return Values

Returns one of the following codes:

WPAD_ERR_NONE The WPAD library received a command.
WPAD_ERR_NO_CONTROLLER The connection was broken.
WPAD_ERR_BUSY The WPAD library was unable to receive a command.

Description

Changes the data format received from the Wii remote on the specified channel. This function registers the data format change command in the WPAD library. The WPAD library processes registered commands when other commands are not running. Valid data cannot be obtained while commands are being processed. After the change has been made, data obtained with the WPADRead function or autosampling is stored in the structure type corresponding to the specified format. By default, the Wii remote data format (WPAD_FMT_CORE) is used for the Wii remote, and the Wii Balance Board data format (WPAD_FMT_BALANCE_CHECKER) is used for the Wii Balance Board.

Do not call this function unless necessary because the counter for the screen burn-in protection feature, as counted internally by the system, is reset when the data format is changed by calling this function.

Data formats for received data are defined with the macro constants shown below.

WPAD_FMT_CORE Wii remote data format (WPADStatus structure). Only button information is valid.
NOTE:
This is the default type.
WPAD_FMT_CORE_ACC Wii remote data format (WPADStatus structure). The button and motion sensor information is valid.
WPAD_FMT_CORE_ACC_DPD Wii remote data format (WPADStatus structure). The button, motion sensor, and pointer information is valid. The pointer has valid size and coordinate data.
WPAD_FMT_FREESTYLE Nunchuk Style data format (WPADFSStatus structure). Only the button information is valid for the Wii remote.
WPAD_FMT_FREESTYLE_ACC Nunchuk Style data format (WPADFSStatus structure). The button and Motion Sensor information is valid for the Wii remote.
WPAD_FMT_FREESTYLE_ACC_DPD Nunchuk Style data format (WPADFSStatus structure). The Wii remote button, Motion Sensor, and Pointer information is valid. However, only the coordinate data is valid for the Pointer.
WPAD_FMT_CLASSIC Classic Style data format (WPADCLStatus structure). Only the button information is valid for the Wii remote.
WPAD_FMT_CLASSIC_ACC Classic Style data format (WPADCLStatus structure). The button and Motion Sensor information is valid for the Wii remote.
WPAD_FMT_CLASSIC_ACC_DPD Classic Style data format (WPADCLStatus structure). The Wii remote button, Motion Sensor, and Pointer information is valid. However, only the coordinate data is valid for the Pointer.
WPAD_FMT_CORE_ACC_DPD_FULL Wii remote extended data format (WPADStatusEx structure). The Wii remote button, Motion Sensor, and Pointer information is valid. For the pointer, the coordinate data, size, object radius, pixel value, and range are valid. However, the data rate is half that of normal (roughly 100 samples per second).
WPAD_FMT_TRAIN Wii remote + Master Controller data format (WPADTRStatus structure). Only Wii remote buttons are enabled.
WPAD_FMT_GUITAR Wii remote + Guitar controller data format (WPADCLStatus structure). For the Wii remote, the button, Motion Sensor, and Pointer information is valid. However, only the coordinate data is valid for the pointer.
WPAD_FMT_DRUM Wii remote + Drum Controller data format (WPADCLStatus structure). The Wii remote button, Motion Sensor, and Pointer information is valid. However, the coordinate data is only valid for the Pointer.
WPAD_FMT_TAIKO Wii remote + Taiko Drum Controller data format (WPADCLStatus structure). The Wii remote button, Motion Sensor, and Pointer information is valid. However, the coordinate data is only valid for the Pointer.
WPAD_FMT_BALANCE_CHECKER Wii Balance Board data format (WPADBLStatus structure).
NOTE:
Wii Balance Board default.
WPAD_FMT_MPLS Wii MotionPlus data format (WPADMPStatus structure). The Wii remote button, Motion Sensor, and Pointer information is valid. However, the coordinate data is only valid for the Pointer. Use this format when the format is either the MotionPlus Style or the Nunchuk/MotionPlus Style. When the format is the Nunchuk/MotionPlus Style, the sampling rates for the Wii MotionPlus and the Nunchuk are half the normal rates.
WPAD_FMT_URCC URCC data format (WPADUCStatus structure). The URCC button, 2 analog sticks, state of charger and cable are valid.

Do Not Call From

Background Do not call this function from the background.
Interrupt handler Do not call this function from any interrupt handler.
Exception handler Do not call this function from any exception handler.
Multiple Cores Do not call this function from more than one Core.

See Also

WPADGetDataFormat
WPADStatus

Revision History

2014/03/06 Fixed incorrect links.
2013/05/08 Automated cleanup pass.
2012/02/27 Added WPAD_FMT_URCC.
2008/12/26 Added WPAD_FMT_TAIKO.
2008/12/19 Added WPAD_FMT_DRUM.
2008/09/30 Explained the Wii MotionPlus.
2008/04/16 Added to the description of the master controller, guitar controller, and Wii Balance Board. Deleted the WPADFSStatus, WPADCLStatus, and WPADStatusEx structures from See Also.
2006/08/15 Added the extended data format.
2006/06/19 Renamed the external extension controller and added a data format.
2005/10/20 Initial version.


CONFIDENTIAL