WPADControlDpd

Syntax

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

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

#define WPAD_DPD_OFF             0
#define WPAD_DPD_STD             1
#define WPAD_DPD_EXP             3
#define WPAD_DPD_FULL		 5

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

s32 WPADControlDpd( s32 chan, u32 command, WPADCallback callback );

Parameters

chan One of the WPAD_CHANn values.
command One of the following:
  • WPAD_DPD_OFF
  • WPAD_DPD_STD
  • WPAD_DPD_EXP
  • WPAD_DPD_FULL
callback Callback function to report on the result. When NULL is specified, notification processing is omitted.

Return Values

WPAD_ERR_NONE The WPAD library received a command.
WPAD_ERR_NO_CONTROLLER The connection was broken.
WPAD_ERR_BUSY The WPAD library was unable to receive a command. Wait a short time and call it again.

Description

Controls the Pointer for the specified Wii remote. This function registers the Pointer control command in the WPAD library. The WPAD library processes registered commands when other commands are not running.

Commands

The different commands are defined as follows. When changing from standard to expanded mode, or the reverse, there is no need to halt the pointer.

WPAD_DPD_OFF Halts the pointer.
WPAD_DPD_STD Starts the pointer in standard mode. Only object coordinates are valid in standard mode. A fixed value is returned for object size. This mode can only be used together with the pointer and external expansion controller data. This mode cannot be used if an external expansion controller is not being used.
WPAD_DPD_EXP Launches the pointer in expanded mode. Both object coordinates and size are valid in expanded mode. This mode cannot be used together with external expansion controller data. To use this mode, specify WPAD_FMT_CORE_ACC_DPD in the WPADSetDataFormat function.
WPAD_DPD_FULL Launches the pointer in full mode. In full mode, the object coordinates, size, object radius, pixel value, and object range are valid, but the data rate is half the normal rate. In this mode, an external extension controller cannot be used.

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 a command. Wait a short time and call it again.
WPAD_ERR_TRANSFER A communications error prevented normal processing of the command.
WPAD_ERR_NO_CONTROLLER The connection was broken.
NOTE:
Problem with audio output from speaker at same time as WPADControlDpd

If the application attempts to output audio from the speaker after launching the pointer by using WPADControlDpd, the pointer's launch configuration may prevent sounds from playing initially. Accordingly, you should wait a brief period of time after launching the pointer before playing audio.

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

WPADIsDpdEnabled
WPADSetDataFormat

Revision History

2014/03/05 Updated to WPAD_FMT_CORE_ACC_DPD command.
2013/05/08 Automated cleanup pass.
2010/06/23 Added explanation about playing audio from speaker at same time as WPADControlDpd.
2009/09/24 Explained the timing of the call to the callback function.
2009/07/07 Revised the description of WPAD_DPD_STD and WPAD_DPD_EXP.
2007/09/18 Corrected a name mismatch between the argument list and the C specification.
2006/11/29 Added WPAD_ERR_BUSY, which had been left out of the error codes passed by the callback.
2006/08/15 Described the DPD full mode.
2006/06/19 Initial version.


CONFIDENTIAL