WPADSetSamplingCallback

C Specification

#include <revolution/wpad.h>

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

typedef void (* WPADSamplingCallback )( s32 chan );

WPADSamplingCallback WPADSetSamplingCallback( s32 chan, WPADSamplingCallback callback );

Arguments

chan One of the WPAD_CHANn values.
callback The callback function that indicates receipt of data from the Wii Remote.

Return Values

Pointer to the most recently registered callback function.

Description

Registers the callback function that notifies the receipt of data by the Wii Remote Control at the specified channel. If NULL is specified, no notifications are made until reset.

Although the Wii Remote sends data to the Wii Console approximately every five milliseconds, be sure to note that due to Wii hardware specifications, the registered callback function is not called at even intervals every 5 milliseconds, but rather is called at an interval of four milliseconds, then six milliseconds, then four milliseconds, then six milliseconds, and so on. Further note that the registered callback function is not always called at this interval due to the fact that the data frame from the Wii Remote may not be received by the Wii Console depending on ambient electromagnetic conditions.

Please note that when the WPADStartFastSyncDevice or WPADStartFastSimpleSync function is called, the data transfer with the Wii Remote will change from a fixed-interval communication to a best-effort communication. The registered callback function will not be called at fixed intervals.

Note that the registered callback function is cleared in the following cases.

See Also

WPAD Function>
WPADStartFastSyncDevice, WPADStartFastSimpleSync

Revision History

2006/10/06 Mentioned that the callback function is cleared when a controller is connected.
2006/09/18 Added notes for calling the WPADStartFastSyncDevice or WPADStartFastSimpleSync functions.
2006/08/15 Added descriptions regarding callback function call intervals. Removed mention of callback function being cleared at insertion/removal of External Extension Controller.
2006/06/19 Changed the name of the game remote. Changed the description to match the product specification.
2005/11/01 Added WPAD_CHANn macro. Revised the sampling cycle to one of the approximately 4ms.
2005/08/01 Initial version.


CONFIDENTIAL