Crate gc_adapter

Source
Expand description

A library for working with the Nintendo Gamecube controller adapter.

Supports:

  • Official Nintendo Gamecube Controller Adapter for Wii U and Switch
  • Mayflash Gamecube Controller Adapter (in “Wii U/Switch” mode)
  • Other 3rd party adapters (untested)

§Example

use gc_adapter::GcAdapter;

// get adapter from global context
let mut adapter = GcAdapter::from_usb().unwrap();

// refresh inputs to ensure they are up to date
adapter.refresh_inputs();

// read and display all controller ports
dbg!(adapter.read_controllers());

// enable rumble for only ports 4
adapter.set_rumble([false, false, false, true]);
 
std::thread::sleep(std::time::Duration::from_millis(100));

// on drop all rumble will be disabled and the USB connection
// will be cleaned up
let _ = adapter;

Re-exports§

pub use rusb;

Modules§

constants
Vendor and Product IDs for adapter

Structs§

Buttons
A collection of which buttons are pressed
Controller
A controller port: either disconnected or otherwise.
ControllerStatus
Status of controller for the given port
GcAdapter
A connection to a gamecube adapter
LibUsbAdapter
Adapter interface for libusb to provide USB access for the gamecube adapter.
SignedAxis
An unsigned axis, representing a centered value, such as a joystick axis.
Stick
An analog control stick. Can represent either the left or right stick.
Triggers
The two analog triggers. For the digital portion, see Buttons::right_trigger and Buttons::left_trigger.
UnsignedAxis
An unsigned axis, representing a positive or zero value.

Enums§

ControllerType
Type of controller connected (Disconnected, Normal, or Wavebird)
Packet
A Gamecube Controller adapter USB payload

Traits§

AdapterHardware
A trait representing a struct which provides access to a limited set of USB operations