WPADSetExtensionCallback

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_DEV_CORE              0
#define WPAD_DEV_FREESTYLE         1
#define WPAD_DEV_CLASSIC           2
#define WPAD_DEV_BALANCE_CHECKER   3
#define WPAD_DEV_MPLS              5
#define WPAD_DEV_MPLS_FREESTYLE    6
#define WPAD_DEV_MPLS_CLASSIC      7
#define WPAD_DEV_TRAIN            16
#define WPAD_DEV_GUITAR           17
#define WPAD_DEV_DRUM             18
#define WPAD_DEV_TAIKO            19
#define WPAD_DEV_MPLS_FUTURE     250
#define WPAD_DEV_FUTURE          251
#define WPAD_DEV_NOT_SUPPORTED   252
#define WPAD_DEV_NOT_FOUND       253
#define WPAD_DEV_UNKNOWN         255

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

WPADExtensionCallback WPADSetExtensionCallback( s32 chan, WPADExtensionCallback callback );

Parameters

chan One of the WPAD_CHANn values.
callback The callback function that notifies of an event when an External Extension Controller is inserted or removed.

Return Values

Pointer to the most recently registered callback function.

Description

Registers a callback function to be notified when an external extension controller is inserted into or removed from a Wii remote on the specified channel. If NULL is specified, no notifications are made. The device type is passed to the callback function's result argument.

When the external extension controller is removed, this callback is called once with a result of WPAD_DEV_CORE.

Be aware that callback functions registered by using this function will be cleared in the following circumstances:

and so the extension callback is typically set during the connection callback (see WPADSetConnectCallback).

WPADProbe can also be used to determine the controller/extension type.

NOTE:
The Wii Balance Board is not a Wii remote external extension controller, so this function will not report Wii Balance Board events.
NOTE:
When an external extension controller is inserted, this callback is called twice. This is because it takes some time to recognize the device type of the inserted external extension controller. When an external extension controller is inserted, it is not immediately recognized and WPAD_DEV_UNKNOWN is returned with the callback. After the device type is known, the callback is called again with the device type. If the controller is disconnected during the recognition process, then WPAD_DEV_NOT_FOUND is passed.

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

WPADSetConnectCallback
WPADProbe

Revision History

2013/05/08 Automated cleanup pass.
2008/12/26 Added WPAD_DEV_TAIKO and WPAD_DEV_BALANCE_CHECKER.
2008/12/19 Added WPAD_DEV_DRUM.
2008/09/30 Added WPAD_DEV_MPLS, WPAD_DEV_MPLS_FREESTYLE, WPAD_DEV_MPLS_CLASSIC, and WPAD_DEV_MPLS_FUTURE to Syntax.
2008/04/16 Added the Master Controller and Guitar Controller. Added a Note regarding the Wii Balance Board.
2006/10/05 Added mention that the buffer is cleared when a controller is connected.
2006/09/06 Added a description of the case when WPAD_DEV_NOT_FOUND is passed.
2006/08/15 Removed statement that the callback is cleared when an external extension controller is plugged into or unplugged from the console.
2006/06/19 Initial version.


CONFIDENTIAL