wut  v1.5.0
Wii U Toolchain
Data Structures | Typedefs | Enumerations | Functions

KPAD is a high-level library over WPAD. More...

Collaboration diagram for KPAD:

Data Structures

struct  KPADVec2D
 2D vector. More...
 
struct  KPADVec3D
 3D vector. More...
 
struct  KPADStatus
 A structure conataining the Wii Remote data. More...
 
union  KPADStatus.__unnamed42__
 Extension data, check with extensionType to see what is valid to read. More...
 
struct  KPADStatus.__unnamed42__.nunchuck
 Structure to use when extension type is set to WPAD_EXT_NUNCHUK. More...
 
struct  KPADStatus.__unnamed42__.classic
 Structure to use when extension type is set to WPAD_EXT_CLASSIC. More...
 
struct  KPADStatus.__unnamed42__.pro
 Structure to use when extension type is set to WPAD_EXT_PRO_CONTROLLER. More...
 

Typedefs

typedef enum WPADChan KPADChan
 Wii Remote channel. More...
 
typedef enum WPADDataFormat KPADDataFormat
 Data format. More...
 
typedef enum WPADExtensionType KPADExtensionType
 Extension type. More...
 
typedef struct KPADStatus KPADStatus
 
typedef struct KPADVec2D KPADVec2D
 
typedef struct KPADVec3D KPADVec3D
 
typedef enum KPADError KPADError
 Error. More...
 
typedef WPADConnectCallback KPADConnectCallback
 

Enumerations

enum  KPADError {
  KPAD_ERROR_OK = 0 ,
  KPAD_ERROR_NO_SAMPLES = -1 ,
  KPAD_ERROR_INVALID_CONTROLLER = -2 ,
  KPAD_ERROR_WPAD_UNINIT = -3 ,
  KPAD_ERROR_BUSY = -4 ,
  KPAD_ERROR_UNINITIALIZED = -5
}
 Error. More...
 

Functions

void KPADInit ()
 Initialises the KPAD library for use. More...
 
void KPADShutdown ()
 Cleans up and frees the KPAD library. More...
 
int32_t KPADRead (KPADChan chan, KPADStatus *data, uint32_t size)
 Read data from the desired controller. More...
 
int32_t KPADReadEx (KPADChan chan, KPADStatus *data, uint32_t size, KPADError *error)
 Read data from the desired controller. More...
 
int32_t KPADSetMaxControllers (uint32_t maxControllers)
 Set the maximum amount of controllers which can be connected to the system. More...
 
uint32_t KPADGetMaxControllers (void)
 Get the maximum amount of controllers which can be connected to the system. More...
 
uint32_t KPADGetGameMaxControllers (void)
 Get the maximum amount of controllers which can be connected, as reported by IOS-PAD. More...
 
KPADConnectCallback KPADSetConnectCallback (KPADChan chan, KPADConnectCallback callback)
 Set a callback for when a controller connection status changes. More...
 

Detailed Description

KPAD is a high-level library over WPAD.


Data Structure Documentation

◆ KPADVec2D

struct KPADVec2D

2D vector.

Definition at line 46 of file kpad.h.

Data Fields
float x x.
float y y.

◆ KPADVec3D

struct KPADVec3D

3D vector.

Definition at line 58 of file kpad.h.

Data Fields
float x x.
float y y.
float z z.

◆ KPADStatus

struct KPADStatus

A structure conataining the Wii Remote data.

Definition at line 73 of file kpad.h.

Data Fields
uint32_t hold Indicates what KPADButtons are held down.
uint32_t trigger Indicates what KPADButtons have been pressed since last sample.
uint32_t release Indicates what KPADButtons have been released since last sample.
KPADVec3D acc Indicates the value of the acceleration sensor.
float accMagnitude Indicates the magnitude of acceleration.
float accVariation Indicates the variation in acceleration.
KPADVec2D pos Indicates the position where the Wii Remote is pointing.
KPADVec2D angle Angle.
uint8_t extensionType Value from KPADExtensionType.
int8_t error Value from KPADError.
int8_t posValid Validity of the result.
uint8_t format Value from KPADDataFormat.
union KPADStatus __unnamed__ Extension data, check with extensionType to see what is valid to read.

◆ KPADStatus.__unnamed42__

union KPADStatus.__unnamed42__

Extension data, check with extensionType to see what is valid to read.

Definition at line 116 of file kpad.h.

Data Fields
__unnamed42__ nunchuck Structure to use when extension type is set to WPAD_EXT_NUNCHUK.
__unnamed42__ classic Structure to use when extension type is set to WPAD_EXT_CLASSIC.
__unnamed42__ pro Structure to use when extension type is set to WPAD_EXT_PRO_CONTROLLER.

◆ KPADStatus.__unnamed42__.nunchuck

struct KPADStatus.__unnamed42__.nunchuck

Structure to use when extension type is set to WPAD_EXT_NUNCHUK.

Definition at line 119 of file kpad.h.

Data Fields
KPADVec2D stick Position of the analog stick.
KPADVec3D acc Indicates the value of the acceleration sensor.
float accMagnitude Indicates the magnitude of acceleration.
float accVariation Indicates the variation in acceleration.
uint32_t hold Indicates what buttons are held down.
uint32_t trigger Indicates what buttons have been pressed since last sample.
uint32_t release Indicates what buttons have been released since last sample.

◆ KPADStatus.__unnamed42__.classic

struct KPADStatus.__unnamed42__.classic

Structure to use when extension type is set to WPAD_EXT_CLASSIC.

Definition at line 138 of file kpad.h.

Data Fields
uint32_t hold Indicates what buttons are held down.
uint32_t trigger Indicates what buttons have been pressed since last sample.
uint32_t release Indicates what buttons have been released since last sample.
KPADVec2D leftStick Position of left analog stick.
KPADVec2D rightStick Position of right analog stick.
float leftTrigger Left trigger.
float rightTrigger Right trigger.

◆ KPADStatus.__unnamed42__.pro

struct KPADStatus.__unnamed42__.pro

Structure to use when extension type is set to WPAD_EXT_PRO_CONTROLLER.

Definition at line 157 of file kpad.h.

Data Fields
uint32_t hold Indicates what buttons are held down.
uint32_t trigger Indicates what buttons have been pressed since last sample.
uint32_t release Indicates what buttons have been released since last sample.
KPADVec2D leftStick Position of left analog stick.
KPADVec2D rightStick Position of right analog stick.
int32_t charging Is charging flag.
int32_t wired Is wired flag.

Typedef Documentation

◆ KPADChan

typedef enum WPADChan KPADChan

Wii Remote channel.

Definition at line 1 of file kpad.h.

◆ KPADDataFormat

Data format.

Definition at line 1 of file kpad.h.

◆ KPADExtensionType

Extension type.

Definition at line 1 of file kpad.h.

◆ KPADStatus

typedef struct KPADStatus KPADStatus

Definition at line 1 of file kpad.h.

◆ KPADVec2D

typedef struct KPADVec2D KPADVec2D

Definition at line 1 of file kpad.h.

◆ KPADVec3D

typedef struct KPADVec3D KPADVec3D

Definition at line 1 of file kpad.h.

◆ KPADError

typedef enum KPADError KPADError

Error.

◆ KPADConnectCallback

Definition at line 218 of file kpad.h.

Enumeration Type Documentation

◆ KPADError

enum KPADError

Error.

Enumerator
KPAD_ERROR_OK 

No error occurred, and data was written to the buffers.

KPAD_ERROR_NO_SAMPLES 

There was no sample new data available to write.

KPAD_ERROR_INVALID_CONTROLLER 

The requested controller or channel was invalid.

KPAD_ERROR_WPAD_UNINIT 

WPAD is uninitialized, shouldn't happen unless WPADShutdown() is manually called.

KPAD_ERROR_BUSY 

KPAD channel is busy, perhaps being accessed by another thread.

KPAD_ERROR_UNINITIALIZED 

KPAD is uninitialized, need to call KPADInit()

Definition at line 29 of file kpad.h.

Function Documentation

◆ KPADInit()

void KPADInit ( )

Initialises the KPAD library for use.

◆ KPADShutdown()

void KPADShutdown ( )

Cleans up and frees the KPAD library.

◆ KPADRead()

int32_t KPADRead ( KPADChan  chan,
KPADStatus data,
uint32_t  size 
)

Read data from the desired controller.

Parameters
chanThe channel of the controller to read from.
dataThe KPADStatus to fill.
sizeThe maximum number of data to read.
Returns
The number of data read.

◆ KPADReadEx()

int32_t KPADReadEx ( KPADChan  chan,
KPADStatus data,
uint32_t  size,
KPADError error 
)

Read data from the desired controller.

Parameters
chanThe channel of the controller to read from.
dataThe KPADStatus to fill.
sizeThe maximum number of data to read.
errorA pointer to an error code.
Returns
The number of data read.

◆ KPADSetMaxControllers()

int32_t KPADSetMaxControllers ( uint32_t  maxControllers)

Set the maximum amount of controllers which can be connected to the system.

Parameters
maxControllersThe maximum amount of controllers. Must be 4 or 7.
Returns
0 on success.

◆ KPADGetMaxControllers()

uint32_t KPADGetMaxControllers ( void  )

Get the maximum amount of controllers which can be connected to the system.

Returns
The maximum amount of controllers.

◆ KPADGetGameMaxControllers()

uint32_t KPADGetGameMaxControllers ( void  )

Get the maximum amount of controllers which can be connected, as reported by IOS-PAD.

Returns
The maximum amount of controllers.

◆ KPADSetConnectCallback()

KPADConnectCallback KPADSetConnectCallback ( KPADChan  chan,
KPADConnectCallback  callback 
)

Set a callback for when a controller connection status changes.

Parameters
chanThe channel of the controller to set a callback for.
callbackPointer to a callback function.
Returns
The previous connect callback.