embassy-usb-host

Crates

git

Versions

default

Flavors

parse_standard_input

Function parse_standard_input 

Source
pub fn parse_standard_input(data: &[u8]) -> Option<GamepadReport>
Expand description

Parse a standard GIP gamepad input report (message type 0x20).

Expects the full packet including the 4-byte GIP header. Layout (offsets from packet start):

OffsetContent
0Message type (0x20)
1Flags
2Sequence
3Payload length (0x0E = 14)
4Buttons 0: menu, view, A, B, X, Y
5Buttons 1: dpad, LB, RB, LS, RS
6–7Left trigger (u16 LE, 0–1023)
8–9Right trigger (u16 LE, 0–1023)
10–11Left stick X (i16 LE)
12–13Left stick Y (i16 LE)
14–15Right stick X (i16 LE)
16–17Right stick Y (i16 LE)