espp/xinput

1.5.0

Latest
uploaded 10 hours ago
Header-only X-Input (Xbox 360 controller) wire format: the 20-byte input report, rumble and LED-ring reports and the interface / XID descriptor, for USB devices and hosts

Readme

# X-Input Component

[![Badge](https://components.espressif.com/components/espp/xinput/badge.svg)](https://components.espressif.com/components/espp/xinput)

`xinput.hpp` is the wire format of X-Input, the protocol of the wired Xbox 360
controller (and of most third-party controllers in their "X-input" mode). It is
header-only and dependency-free (no ESP-IDF or TinyUSB headers), so it builds
and is tested on a computer too, and it serves both ends of the cable:

- [`usb_device`](../usb_device) presents an X-Input controller to a PC or
  console: it packs `xinput::GamepadState::report()` and reads the host's
  rumble with `xinput::decode_rumble()`;
- [`xbox_host`](../xbox_host) reads an X-Input controller plugged into a USB
  host port: it parses `xinput::parse_report()` and sends
  `xinput::rumble_report()` / `xinput::led_report()`.

## Wire format

An X-Input controller presents a vendor-specific interface (class `0xFF`,
subclass `0x5D`, protocol `0x01`) with one interrupt IN and one interrupt OUT
endpoint.

| Direction | Message | Bytes |
|-----------|---------|-------|
| IN | input report | `00 14 <buttons lo> <buttons hi> <LT> <RT> <LX> <LY> <RX> <RY>` + 6 reserved (sticks int16 little-endian, Y up positive) |
| IN | LED status | `01 03 <pattern>` |
| OUT | rumble | `00 08 00 <left motor> <right motor> 00 00 00` |
| OUT | LED ring | `01 03 <pattern>` (`xinput::Led`, `xinput::player_led(n)`) |

See `include/xinput.hpp` for the button bits (`xinput::Button`) and the
interface + XID descriptor builder.

Links

Supports all targets

Maintainer

  • William Emfinger <waemfinger@gmail.com>
To add this component to your project, run:

idf.py add-dependency "espp/xinput^1.5.0"

download archive

Stats

  • Archive size
    Archive size ~ 7.06 KB
  • Downloaded in total
    Downloaded in total 0 times
  • Downloaded this version
    This version: 0 times

Badge

espp/xinput version: 1.5.0
|