WPADControlBLC

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_BLCMD_ON            0xaa
#define WPAD_BLCMD_OFF           0x55
#define WPAD_BLCMD_UPDATE_TEMP   0x00

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

s32 WPADControlBLC( s32 chan, u8 command, WPADCallback callback );

Parameters

chan One of the WPAD_CHANn values.
command Either of:
  • WPAD_BLCMD_ON
  • WPAD_BLCMD_OFF
  • WPAD_BLCMD_UPDATE_TEMP
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

Controls the specified Wii Balance Board. This function registers Wii Balance Board control commands with the WPAD library. The WPAD library processes registered commands when other commands are not running.

Commands

The different commands are defined as follows.

WPAD_BLCMD_OFF Stops the Wii Balance Board.
WPAD_BLCMD_ON Starts the Wii Balance Board.
WPAD_BLCMD_UPDATE_TEMP Updates the temperature value for the Wii Balance Board.

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 Removed the command to obtain remaining battery power and added the command to obtain temperature.
2007/05/31 Initial version.


CONFIDENTIAL