libdragon
Loading...
Searching...
No Matches
Macros | Functions
joypad.c File Reference

Joypad Subsystem. More...

Macros

#define JOYPAD_IDENTIFY_INTERVAL_TICKS   TICKS_PER_SECOND
 Number of ticks between Joybus identify commands.
 
#define ASSERT_JOYPAD_INITIALIZED()    assertf(joypad_init_refcount > 0, "joypad_init() was not called")
 Convenience macro to ensure Joypad subsystem is initialized.
 
#define BB_HACK_FLAGS_SWAP_PORT1   ((*(uint32_t *)0x8000038c) & 3)
 BBPlayer "Hack Flags" register value.
 

Functions

joypad_inputs_t joypad_read_n64_inputs (joypad_port_t port)
 Read the inputs from a Nintendo 64 controller synchronously.
 
void joypad_init (void)
 Initialize the Joypad subsystem.
 
void joypad_close (void)
 Close the Joypad subsystem.
 
void joypad_poll (void)
 Fetch the current Joypad input state.
 
bool joypad_is_connected (joypad_port_t port)
 Whether a Joybus device is plugged in to a Joypad port.
 
joybus_identifier_t joypad_get_identifier (joypad_port_t port)
 Get the Joybus device identifier for a Joypad port.
 
joypad_style_t joypad_get_style (joypad_port_t port)
 Get the Joypad style for a Joypad port.
 
joypad_accessory_type_t joypad_get_accessory_type (joypad_port_t port)
 Get the Joypad accessory type for a Joypad port.
 
int joypad_get_accessory_state (joypad_port_t port)
 Get the Joypad accessory state for a Joypad port.
 
int joypad_get_accessory_error (joypad_port_t port)
 Get the Joypad accessory error for a Joypad port.
 
uint8_t joypad_get_transfer_pak_status (joypad_port_t port)
 Get the Transfer Pak status byte for a Joypad port.
 
bool joypad_get_rumble_supported (joypad_port_t port)
 Is rumble supported for a Joypad port?
 
bool joypad_get_rumble_active (joypad_port_t port)
 Is rumble active for a Joypad port?
 
void joypad_set_rumble_active (joypad_port_t port, bool active)
 Activate or deactivate rumble on a Joypad port.
 
joypad_inputs_t joypad_get_inputs (joypad_port_t port)
 Get the current Joypad inputs state for a Joypad port.
 
joypad_buttons_t joypad_get_buttons (joypad_port_t port)
 Get the current Joypad buttons state for a Joypad port.
 
joypad_buttons_t joypad_get_buttons_pressed (joypad_port_t port)
 Get the Joypad buttons that were pressed since the last time Joypads were read for a Joypad port.
 
joypad_buttons_t joypad_get_buttons_released (joypad_port_t port)
 Get the Joypad buttons that were released since the last time Joypads were read for a Joypad port.
 
joypad_buttons_t joypad_get_buttons_held (joypad_port_t port)
 Get the Joypad buttons that are held down since the last time Joypads were read for a Joypad port.
 
int joypad_get_axis_pressed (joypad_port_t port, joypad_axis_t axis)
 Get the direction of a "press" of an axis on a Joypad port.
 
int joypad_get_axis_released (joypad_port_t port, joypad_axis_t axis)
 Get the direction of a "release" of an axis on a Joypad port.
 
int joypad_get_axis_held (joypad_port_t port, joypad_axis_t axis)
 Get the direction that an axis is held on a Joypad port.
 
joypad_8way_t joypad_get_direction (joypad_port_t port, joypad_2d_t axes)
 Get the 8-way direction for a Joypad port's directional axes.
 

Variables

"Hot" (interrupt-driven) global state

volatile joybus_identifier_t joypad_identifiers_hot [JOYPAD_PORT_COUNT] = {0}
 Joypad identifiers for each port.
 
volatile joypad_device_hot_t joypad_devices_hot [JOYPAD_PORT_COUNT] = {0}
 Joypad "hot" devices for each port.
 
volatile joypad_gcn_origin_t joypad_origins_hot [JOYPAD_PORT_COUNT] = {0}
 Joypad origins for each port.
 
volatile joypad_accessory_t joypad_accessories_hot [JOYPAD_PORT_COUNT] = {0}
 Joypad accessories for each port.
 
"Cold" (non-volatile) global state

Detailed Description

Joypad Subsystem.

Author
Christopher Bonhage me@ch.nosp@m.rist.nosp@m.opher.nosp@m.bonh.nosp@m.age.c.nosp@m.om