controller.c File Reference

Controller Subsystem. More...

#include <string.h>
#include "libdragon.h"
#include "regsinternal.h"


SI status register bit definitions

#define SI_STATUS_DMA_BUSY   ( 1 << 0 )
 SI DMA busy.
#define SI_STATUS_IO_BUSY   ( 1 << 1 )
 SI IO busy.


void controller_init ()
 Initialize the controller subsystem.
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.
void controller_read (struct controller_data *output)
 Read the controller button status for all controllers.
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.
void execute_raw_command (int controller, int command, int bytesout, int bytesin, unsigned char *out, unsigned char *in)
 Execute a raw PIF command.
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.
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.

Detailed Description

Controller Subsystem.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines