WPADSetAutoSamplingBuf

Syntax

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

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

void WPADSetAutoSamplingBuf( s32 chan, void *buf, u32 length );

Parameters

chan One of the WPAD_CHANn values.
buf Pointer that indicates the beginning of the ring buffer storing the controller status.
length Length (number of elements) of the array passed with buf.

Return Values

None.

Description

Sets the buffer that stores controller information received from the Wii remote at the specified channel. This buffer is used as a ring buffer.

The controller information is stored in the buffer specified by buf. This buffer must be an array of structures having the data format specified by the WPADSetDataFormat function. If a callback function was set with the WPADSetSamplingCallback function, the callback function will be called each time the controller information is stored.

The buffer index that stored the most recent controller information can be obtained with the WPADGetLatestIndexInBuf function.

The controller status stored in the newest index +1 may be overwritten unintentionally by an interrupt. As a workaround for this issue, set the number of buf elements that are referenced by the user program in a single frame to be length-1 or smaller.

To stop storing controller information in the ring buffer, call this function with buf set to NULL.

This can be used with the WPADRead function.

Be aware that ring buffers registered using this function will be cleared in the following circumstances.

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

WPADRead
WPADGetDataFormat
WPADSetDataFormat
WPADGetLatestIndexInBuf
WPADSetSamplingCallback
WPADStatus

Revision History

2013/05/08 Automated cleanup pass.
2008/04/16 Deleted the WPADFSStatus, WPADCLStatus, and WPADStatusEx structures from See Also.
2006/10/05 Added mention that the buffer is cleared when a controller is connected.
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 Deleted designations specific to SI specifications.
2005/11/01 Added the WPAD_CHANn macros. Deleted text about the WPADAttach function. Changed API specs. Added links to functions. Added note about change to SI in the Description.
2005/08/30 Renamed the bufSize argument to length; modified Description.
2005/08/04 Revised the description of the bufSize argument.
2005/08/01 Initial version.


CONFIDENTIAL