libjoybus
Joybus implementation for 32-bit MCUs
Loading...
Searching...
No Matches
GameCube Commands

Functions

int joybus_gcn_read (struct joybus *bus, enum joybus_gcn_analog_mode analog_mode, enum joybus_gcn_motor_state motor_state, struct joybus_gcn_controller_state *response)
 Read the current input state of a GameCube controller.
int joybus_gcn_read_async (struct joybus *bus, enum joybus_gcn_analog_mode analog_mode, enum joybus_gcn_motor_state motor_state, struct joybus_gcn_controller_state *response, joybus_transfer_cb callback, void *user_data)
 Read the current input state of a GameCube controller, asynchronously.
int joybus_gcn_read_origin (struct joybus *bus, struct joybus_gcn_controller_state *response)
 Read the origin (neutral) state of a GameCube controller.
int joybus_gcn_read_origin_async (struct joybus *bus, struct joybus_gcn_controller_state *response, joybus_transfer_cb callback, void *user_data)
 Read the origin (neutral) state of a GameCube controller, asynchronously.
int joybus_gcn_calibrate (struct joybus *bus, struct joybus_gcn_controller_state *response)
 Calibrate a GameCube controller, setting its current input state as the origin.
int joybus_gcn_calibrate_async (struct joybus *bus, struct joybus_gcn_controller_state *response, joybus_transfer_cb callback, void *user_data)
 Calibrate a GameCube controller, setting its current input state as the origin, asynchronously.
int joybus_gcn_read_long (struct joybus *bus, enum joybus_gcn_motor_state motor_state, struct joybus_gcn_controller_state *response)
 Read the current input state of a GameCube controller, with full precision.
int joybus_gcn_read_long_async (struct joybus *bus, enum joybus_gcn_motor_state motor_state, struct joybus_gcn_controller_state *response, joybus_transfer_cb callback, void *user_data)
 Read the current input state of a GameCube controller, with full precision, asynchronously.
int joybus_gcn_probe_device (struct joybus *bus, uint8_t response[JOYBUS_CMD_GCN_PROBE_DEVICE_RX])
 Send a "probe device" command to a WaveBird controller.
int joybus_gcn_probe_device_async (struct joybus *bus, uint8_t response[JOYBUS_CMD_GCN_PROBE_DEVICE_RX], joybus_transfer_cb callback, void *user_data)
 Send a "probe device" command to a WaveBird controller, asynchronously.
int joybus_gcn_fix_device (struct joybus *bus, uint16_t wireless_id, struct joybus_id *response)
 Send a "fix device" command to a WaveBird controller.
int joybus_gcn_fix_device_async (struct joybus *bus, uint16_t wireless_id, struct joybus_id *response, joybus_transfer_cb callback, void *user_data)
 Send a "fix device" command to a WaveBird controller, asynchronously.

Detailed Description

Function Documentation

◆ joybus_gcn_calibrate()

int joybus_gcn_calibrate ( struct joybus * bus,
struct joybus_gcn_controller_state * response )

Calibrate a GameCube controller, setting its current input state as the origin.

Parameters
busthe Joybus instance to use
responsebuffer to store the origin state response in
Returns
0 on success, a negative joybus_error on failure

◆ joybus_gcn_calibrate_async()

int joybus_gcn_calibrate_async ( struct joybus * bus,
struct joybus_gcn_controller_state * response,
joybus_transfer_cb callback,
void * user_data )

Calibrate a GameCube controller, setting its current input state as the origin, asynchronously.

Parameters
busthe Joybus instance to use
responsebuffer to store the origin state response
callbacka callback function to call when the transfer is complete
user_datauser data to pass to the callback function
Returns
0 if the transfer was started, a negative joybus_error otherwise

◆ joybus_gcn_fix_device()

int joybus_gcn_fix_device ( struct joybus * bus,
uint16_t wireless_id,
struct joybus_id * response )

Send a "fix device" command to a WaveBird controller.

Non-wireless controllers will ignore this command. If successful, the response buffer will contain the updated controller ID.

Parameters
busthe Joybus instance to use
wireless_idthe 10-bit wireless ID to fix the controller to
responsebuffer to store the identity response in

◆ joybus_gcn_fix_device_async()

int joybus_gcn_fix_device_async ( struct joybus * bus,
uint16_t wireless_id,
struct joybus_id * response,
joybus_transfer_cb callback,
void * user_data )

Send a "fix device" command to a WaveBird controller, asynchronously.

Non-wireless controllers will ignore this command. If successful, the response buffer will contain the updated controller ID.

Parameters
busthe Joybus instance to use
wireless_idthe 10-bit wireless ID to fix the controller to
responsebuffer to store the identity response in
callbacka callback function to call when the transfer is complete
user_datauser data to pass to the callback function
Returns
0 if the transfer was started, a negative joybus_error otherwise

◆ joybus_gcn_probe_device()

int joybus_gcn_probe_device ( struct joybus * bus,
uint8_t response[JOYBUS_CMD_GCN_PROBE_DEVICE_RX] )

Send a "probe device" command to a WaveBird controller.

Parameters
busthe Joybus instance to use
responsebuffer to store the response in
Returns
0 on success, a negative joybus_error on failure

◆ joybus_gcn_probe_device_async()

int joybus_gcn_probe_device_async ( struct joybus * bus,
uint8_t response[JOYBUS_CMD_GCN_PROBE_DEVICE_RX],
joybus_transfer_cb callback,
void * user_data )

Send a "probe device" command to a WaveBird controller, asynchronously.

Parameters
busthe Joybus instance to use
responsebuffer to store the response in
callbacka callback function to call when the transfer is complete
user_datauser data to pass to the callback function

◆ joybus_gcn_read()

int joybus_gcn_read ( struct joybus * bus,
enum joybus_gcn_analog_mode analog_mode,
enum joybus_gcn_motor_state motor_state,
struct joybus_gcn_controller_state * response )

Read the current input state of a GameCube controller.

Parameters
busthe Joybus instance to use
analog_modethe analog mode to use
motor_statethe motor state to use
responsebuffer to store the input state response in
Returns
0 on success, a negative joybus_error on failure

◆ joybus_gcn_read_async()

int joybus_gcn_read_async ( struct joybus * bus,
enum joybus_gcn_analog_mode analog_mode,
enum joybus_gcn_motor_state motor_state,
struct joybus_gcn_controller_state * response,
joybus_transfer_cb callback,
void * user_data )

Read the current input state of a GameCube controller, asynchronously.

Parameters
busthe Joybus instance to use
analog_modethe analog mode to use
motor_statethe motor state to use
responsebuffer to store the input state response in
callbacka callback function to call when the transfer is complete
user_datauser data to pass to the callback function
Returns
0 if the transfer was started, a negative joybus_error otherwise

◆ joybus_gcn_read_long()

int joybus_gcn_read_long ( struct joybus * bus,
enum joybus_gcn_motor_state motor_state,
struct joybus_gcn_controller_state * response )

Read the current input state of a GameCube controller, with full precision.

Parameters
busthe Joybus instance to use
motor_statethe motor state to use (one of JOYBUS_GCN_MOTOR_*)
responsebuffer to store the input state response
Returns
0 on success, a negative joybus_error on failure

◆ joybus_gcn_read_long_async()

int joybus_gcn_read_long_async ( struct joybus * bus,
enum joybus_gcn_motor_state motor_state,
struct joybus_gcn_controller_state * response,
joybus_transfer_cb callback,
void * user_data )

Read the current input state of a GameCube controller, with full precision, asynchronously.

Parameters
busthe Joybus instance to use
motor_statethe motor state to use (one of JOYBUS_GCN_MOTOR_*)
responsebuffer to store the input state response
callbacka callback function to call when the transfer is complete
user_datauser data to pass to the callback function
Returns
0 if the transfer was started, a negative joybus_error otherwise

◆ joybus_gcn_read_origin()

int joybus_gcn_read_origin ( struct joybus * bus,
struct joybus_gcn_controller_state * response )

Read the origin (neutral) state of a GameCube controller.

Parameters
busthe Joybus instance to use
responsebuffer to store the origin state response in
Returns
0 on success, a negative joybus_error on failure

◆ joybus_gcn_read_origin_async()

int joybus_gcn_read_origin_async ( struct joybus * bus,
struct joybus_gcn_controller_state * response,
joybus_transfer_cb callback,
void * user_data )

Read the origin (neutral) state of a GameCube controller, asynchronously.

Parameters
busthe Joybus instance to use
responsebuffer to store the origin state response in
callbacka callback function to call when the transfer is complete
user_datauser data to pass to the callback function
Returns
0 if the transfer was started, a negative joybus_error otherwise