KallistiOS  2.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Data Structures | Macros | Typedefs | Functions
controller.h File Reference

Definitions for using the controller device. More...

#include <sys/cdefs.h>
#include <arch/types.h>

Go to the source code of this file.

Data Structures

struct  cont_cond_t
struct  cont_state_t
 Controller status structure. More...

Macros

#define CONT_C   (1<<0)
#define CONT_B   (1<<1)
#define CONT_A   (1<<2)
#define CONT_START   (1<<3)
#define CONT_DPAD_UP   (1<<4)
#define CONT_DPAD_DOWN   (1<<5)
#define CONT_DPAD_LEFT   (1<<6)
#define CONT_DPAD_RIGHT   (1<<7)
#define CONT_Z   (1<<8)
#define CONT_Y   (1<<9)
#define CONT_X   (1<<10)
#define CONT_D   (1<<11)
#define CONT_DPAD2_UP   (1<<12)
#define CONT_DPAD2_DOWN   (1<<13)
#define CONT_DPAD2_LEFT   (1<<14)
#define CONT_DPAD2_RIGHT   (1<<15)
#define CONT_CAPABILITY_C   (1<<0)
#define CONT_CAPABILITY_B   (1<<1)
#define CONT_CAPABILITY_A   (1<<2)
#define CONT_CAPABILITY_START   (1<<3)
#define CONT_CAPABILITY_DPAD_UP   (1<<4)
#define CONT_CAPABILITY_DPAD_DOWN   (1<<5)
#define CONT_CAPABILITY_DPAD_LEFT   (1<<6)
#define CONT_CAPABILITY_DPAD_RIGHT   (1<<7)
#define CONT_CAPABILITY_Z   (1<<8)
#define CONT_CAPABILITY_Y   (1<<9)
#define CONT_CAPABILITY_X   (1<<10)
#define CONT_CAPABILITY_D   (1<<11)
#define CONT_CAPABILITY_DPAD2_UP   (1<<12)
#define CONT_CAPABILITY_DPAD2_DOWN   (1<<13)
#define CONT_CAPABILITY_DPAD2_LEFT   (1<<14)
#define CONT_CAPABILITY_DPAD2_RIGHT   (1<<15)
#define CONT_CAPABILITY_RTRIG   (1<<16)
#define CONT_CAPABILITY_LTRIG   (1<<17)
#define CONT_CAPABILITY_ANALOG_X   (1<<18)
#define CONT_CAPABILITY_ANALOG_Y   (1<<19)
#define CONT_CAPABILITY_ANALOG2_X   (1<<20)
#define CONT_CAPABILITY_ANALOG2_Y   (1<<21)

Typedefs

typedef void(* cont_btn_callback_t )(uint8 addr, uint32 btns)
 Controller automatic callback type.

Functions

void cont_btn_callback (uint8 addr, uint32 btns, cont_btn_callback_t cb)
 Set an automatic button press callback.

Detailed Description

Definitions for using the controller device.

This file contains the definitions needed to access the Maple controller device. Obviously, this corresponds to the MAPLE_FUNC_CONTROLLER function code.

Author:
Jordan DeLong
Dan Potter

Typedef Documentation

typedef void(* cont_btn_callback_t)(uint8 addr, uint32 btns)

Controller automatic callback type.

Functions of this type can be set with cont_btn_callback() to respond automatically to the specified set of buttons being pressed. This can be used, for instance, to implement the standard A+B+X+Y+Start method of ending the program running.


Function Documentation

void cont_btn_callback ( uint8  addr,
uint32  btns,
cont_btn_callback_t  cb 
)

Set an automatic button press callback.

This function sets a callback function to be called when the specified controller has the set of buttons given pressed.

Parameters:
addrThe controller to listen on. This value can be obtained by using maple_addr().
btnsThe buttons bitmask to match.
cbThe callback to call when the buttons are pressed.