libjoybus
Joybus implementation for 32-bit MCUs
Loading...
Searching...
No Matches
gcn.h
1
7
8#pragma once
9
10#include <joybus/bus.h>
11#include <joybus/commands.h>
12#include <joybus/identify.h>
14
24int joybus_gcn_read(struct joybus *bus, enum joybus_gcn_analog_mode analog_mode,
25 enum joybus_gcn_motor_state motor_state, struct joybus_gcn_controller_state *response);
26
38int joybus_gcn_read_async(struct joybus *bus, enum joybus_gcn_analog_mode analog_mode,
39 enum joybus_gcn_motor_state motor_state, struct joybus_gcn_controller_state *response,
40 joybus_transfer_cb callback, void *user_data);
41
49int joybus_gcn_read_origin(struct joybus *bus, struct joybus_gcn_controller_state *response);
50
61 joybus_transfer_cb callback, void *user_data);
62
70int joybus_gcn_calibrate(struct joybus *bus, struct joybus_gcn_controller_state *response);
71
81int joybus_gcn_calibrate_async(struct joybus *bus, struct joybus_gcn_controller_state *response,
82 joybus_transfer_cb callback, void *user_data);
83
92int joybus_gcn_read_long(struct joybus *bus, enum joybus_gcn_motor_state motor_state,
93 struct joybus_gcn_controller_state *response);
94
105int joybus_gcn_read_long_async(struct joybus *bus, enum joybus_gcn_motor_state motor_state,
106 struct joybus_gcn_controller_state *response, joybus_transfer_cb callback,
107 void *user_data);
108
116int joybus_gcn_probe_device(struct joybus *bus, uint8_t response[JOYBUS_CMD_GCN_PROBE_DEVICE_RX]);
117
127 joybus_transfer_cb callback, void *user_data);
128
139int joybus_gcn_fix_device(struct joybus *bus, uint16_t wireless_id, struct joybus_id *response);
140
154int joybus_gcn_fix_device_async(struct joybus *bus, uint16_t wireless_id, struct joybus_id *response,
155 joybus_transfer_cb callback, void *user_data);
156
Joybus command codes and transfer lengths.
#define JOYBUS_CMD_GCN_PROBE_DEVICE_RX
GCN probe device response length.
Definition commands.h:140
Common definitions for GameCube controllers.
joybus_gcn_motor_state
GameCube controller motor states.
Definition gcn_controller.h:106
joybus_gcn_analog_mode
Analog modes for packing GameCube controller input state.
Definition gcn_controller.h:86
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.
Definition gcn.c:136
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.
Definition gcn.c:143
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.
Definition gcn.c:163
int joybus_gcn_read_origin(struct joybus *bus, struct joybus_gcn_controller_state *response)
Read the origin (neutral) state of a GameCube controller.
Definition gcn.c:100
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.
Definition gcn.c:157
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.
Definition gcn.c:80
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.
Definition gcn.c:117
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.
Definition gcn.c:177
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.
Definition gcn.c:106
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.
Definition gcn.c:123
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.
Definition gcn.c:73
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.
Definition gcn.c:183
void(* joybus_transfer_cb)(struct joybus *bus, int status, void *user_data)
Function type for transfer completion callbacks.
Definition bus.h:74
Joybus device identification values and utilities.
GameCube controller input/origin state.
Definition gcn_controller.h:43
Represents the 3-byte ID field from an "identify" buffer.
Definition identify.h:98
A Joybus instance.
Definition bus.h:96