Data Structures | Typedefs | Functions

controller.h File Reference

Controller Subsystem. More...

Go to the source code of this file.

Data Structures

struct  SI_condat
 SI Controller Data. More...
struct  controller_data
 Structure for interpreting SI responses. More...

Defines

Bitmasks for controller status
#define CONTROLLER_1_INSERTED   0xF000
 Controller 1 Inserted.
#define CONTROLLER_2_INSERTED   0x0F00
 Controller 2 Inserted.
#define CONTROLLER_3_INSERTED   0x00F0
 Controller 3 Inserted.
#define CONTROLLER_4_INSERTED   0x000F
 Controller 4 Inserted.
Accessory ID Values
#define ACCESSORY_NONE   0
 No accessory present.
#define ACCESSORY_MEMPAK   1
 Mempak present.
#define ACCESSORY_RUMBLEPAK   2
 Rumblepak present.
#define ACCESSORY_VRU   3
 VRU present.
SI Error Values

#define ERROR_NONE   0x0
 No error occured.
#define ERROR_BAD_COMMAND   0x1
 Command not recognized or malformed.
#define ERROR_NOT_PRESENT   0x2
 Controller not present.

Typedefs

typedef struct SI_condat _SI_condat
 SI Controller Data.
typedef struct controller_data _controller_data
 Structure for interpreting SI responses.

Functions

void controller_init ()
 Initialize the controller subsystem.
void controller_read (struct controller_data *output)
 Read the controller button status for all controllers.
int get_controllers_present ()
 Return a bitmask representing which controllers are present.
int get_accessories_present ()
 Return a bitmask specifying which controllers have recognized accessories.
void controller_scan ()
 Scan the controllers to determine the current button state.
struct controller_data get_keys_down ()
 Get keys that were pressed since the last inspection.
struct controller_data get_keys_up ()
 Get keys that were released since the last inspection.
struct controller_data get_keys_held ()
 Get keys that were held since the last inspection.
struct controller_data get_keys_pressed ()
 Get keys that are currently pressed, regardless of previous state.
int get_dpad_direction (int controller)
 Return the DPAD calculated direction.
int read_mempak_address (int controller, uint16_t address, uint8_t *data)
 Read a chunk of data from a mempak.
int write_mempak_address (int controller, uint16_t address, uint8_t *data)
 Write a chunk of data to a mempak.
int identify_accessory (int controller)
 Identify the accessory connected to a controller.
void rumble_start (int controller)
 Turn rumble on for a particular controller.
void rumble_stop (int controller)
 Turn rumble off for a particular controller.
void execute_raw_command (int controller, int command, int bytesout, int bytesin, unsigned char *out, unsigned char *in)
 Execute a raw PIF command.
int eeprom_present ()
 Probe the EEPROM interface.
void eeprom_read (int block, uint8_t *const buf)
 Read a block from EEPROM.
void eeprom_write (int block, const uint8_t *const data)
 Write a block to EEPROM.

Detailed Description

Controller Subsystem.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines