WPADGetBLCalibration

Syntax

#include <cafe/pads/wpad/wpadBalance.h>

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

#define WPAD_BLCLB_BLK1_ADDR     0x0024
#define WPAD_BLCLB_BLK1_LEN      16
#define WPAD_BLCLB_BLK2_ADDR     0x0034
#define WPAD_BLCLB_BLK2_LEN      8
#define WPAD_BLCLB_BLK3_ADDR     0x003c
#define WPAD_BLCLB_BLK3_LEN      4
#define WPAD_BLCLB_BLK4_ADDR     0x0050
#define WPAD_BLCLB_BLK4_LEN      16
#define WPAD_BLCLB_BLK5_ADDR     0x0060
#define WPAD_BLCLB_BLK5_LEN      16

typedef void (*WPADCallback) ( s32 chan, s32 result );

s32 WPADGetBLCalibration( s32 chan, u8 *data, u16 addr, u16 len, WPADCallback callback );

Parameters

chan One of the WPAD_CHANn values.
data Buffer where the calibration values are copied.
addr Address where the obtained calibration values are stored.
len Size of the obtained calibration values.
callback Callback function to notify about the result. Notification processing is omitted if NULL is specified.

Return Values

WPAD_ERR_NONE The WPAD library received the command.
WPAD_ERR_NO_CONTROLLER The connection was broken.
WPAD_ERR_BUSY The WPAD library was unable to receive the command. Wait a short time and call the function again.

Description

Gets the calibration values for the specified Wii Balance Board. The Wii Balance Board calibration values are divided into five blocks, and the address and size associated with each block of values are defined by WPAD_BLCLB_BLK*_ADDR and WPAD_BLCLB_BLK*_LEN, respectively. When obtaining values, use the defined address and size to obtain each block individually. Due to the Wii Balance Board specification, when blocks of values are obtained in succession it is possible for the obtained values to be incorrect, even if no error code indicates an issue. For this reason, pause a short time between successive calls.

Callbacks

When a callback function has been set, the callback function is called together with the processing result. When the return value is WPAD_ERR_NONE, the callback function is called when the process is completed. Otherwise, it is called before the function escapes. The following error codes are passed to the callback function.

WPAD_ERR_NONE The command was processed normally.
WPAD_ERR_BUSY The WPAD library was unable to receive the command. Wait a short time and call the function again.
WPAD_ERR_TRANSFER A communication error prevented normal processing of the command.
WPAD_ERR_NO_CONTROLLER The connection was broken.

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.

Revision History

2013/05/08 Automated cleanup pass.
2009/09/24 Explained the timing of the call to the callback function.
2007/09/11 Corrected errors in notation.
2007/05/31 Initial version.


CONFIDENTIAL