libjoybus
Joybus implementation for 32-bit MCUs
Loading...
Searching...
No Matches
gamecube.h File Reference
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  joybus_gc_controller_input
 GameCube controller input state. More...

Macros

#define JOYBUS_GCN_BUTTON_A   (1 << 0)
 GameCube controller button bitmask flags.
#define JOYBUS_GCN_BUTTON_B   (1 << 1)
#define JOYBUS_GCN_BUTTON_X   (1 << 2)
#define JOYBUS_GCN_BUTTON_Y   (1 << 3)
#define JOYBUS_GCN_BUTTON_START   (1 << 4)
#define JOYBUS_GCN_NEED_ORIGIN   (1 << 5)
#define JOYBUS_GCN_ERROR_LATCH   (1 << 6)
#define JOYBUS_GCN_ERROR   (1 << 7)
#define JOYBUS_GCN_BUTTON_LEFT   (1 << 8)
#define JOYBUS_GCN_BUTTON_RIGHT   (1 << 9)
#define JOYBUS_GCN_BUTTON_DOWN   (1 << 10)
#define JOYBUS_GCN_BUTTON_UP   (1 << 11)
#define JOYBUS_GCN_BUTTON_Z   (1 << 12)
#define JOYBUS_GCN_BUTTON_R   (1 << 13)
#define JOYBUS_GCN_BUTTON_L   (1 << 14)
#define JOYBUS_GCN_USE_ORIGIN   (1 << 15)
#define JOYBUS_GCN_BUTTON_MASK   0x7F1F

Enumerations

enum  joybus_gcn_analog_mode {
  JOYBUS_GCN_ANALOG_MODE_0 ,
  JOYBUS_GCN_ANALOG_MODE_1 ,
  JOYBUS_GCN_ANALOG_MODE_2 ,
  JOYBUS_GCN_ANALOG_MODE_3 ,
  JOYBUS_GCN_ANALOG_MODE_4
}
 Analog modes for packing GameCube controller input state. More...
enum  joybus_gcn_motor_state {
  JOYBUS_GCN_MOTOR_STOP ,
  JOYBUS_GCN_MOTOR_RUMBLE ,
  JOYBUS_GCN_MOTOR_STOP_HARD
}
 GameCube controller motor states. More...

Functions

struct joybus_gc_controller_input __attribute__ ((packed))

Variables

uint16_t buttons
 Button state.
uint8_t stick_x
 Main stick x-axis position.
uint8_t stick_y
 Main stick y-axis position.
uint8_t substick_x
 C-stick x-axis position.
uint8_t substick_y
 C-stick y-axis position.
uint8_t trigger_left
 Left analog trigger position.
uint8_t trigger_right
 Right analog trigger position.
uint8_t analog_a
 Analog A button value.
uint8_t analog_b
 Analog B button value.
enum joybus_gcn_analog_mode __attribute__

Enumeration Type Documentation

◆ joybus_gcn_analog_mode

Analog modes for packing GameCube controller input state.

Enumerator
JOYBUS_GCN_ANALOG_MODE_0 

Substick X/Y full precision, triggers and analog A/B truncated to 4 bits.

JOYBUS_GCN_ANALOG_MODE_1 

Triggers full precision, substick X/Y and analog A/B truncated to 4 bits.

JOYBUS_GCN_ANALOG_MODE_2 

Analog A/B full precision, substick X/Y and triggers truncated to 4 bits.

JOYBUS_GCN_ANALOG_MODE_3 

Substick X/Y and triggers full precision, analog A/B omitted.

JOYBUS_GCN_ANALOG_MODE_4 

Substick X/Y and analog A/B full precision, triggers omitted.

◆ joybus_gcn_motor_state

GameCube controller motor states.

Enumerator
JOYBUS_GCN_MOTOR_STOP 

Stop the rumble motor.

JOYBUS_GCN_MOTOR_RUMBLE 

Start the rumble motor.

JOYBUS_GCN_MOTOR_STOP_HARD 

Stop the rumble motor immediately.