WPADSetSamplingCallback

Syntax

#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 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 radio signal 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

WPADStartFastSyncDevice, WPADStartFastSimpleSync

Revision History

2006/10/05 Added mention that the buffer is cleared when a controller is connected.
2006/09/18 Added notes for calling the WPADStartFastSyncDevice and WPADStartFastSimpleSync functions.
2006/08/15 Added descriptions regarding callback function call intervals. Removed mention of the callback function being cleared when the external extension controller is inserted or removed.
2006/06/19 Changed the name of the game remote control; changed explanations to product specifications.
2005/11/01 Added the WPAD_CHANn macro. Revised the sampling cycle to be a 4ms cycle.
2005/08/01 Initial version.


CONFIDENTIAL