INPUT 0x01
Input Report 0x01 (64 bytes)
C Struct Example
Note that this format is not portable. LSB is indicated here for posterity. Implement at your own discretion.
#pragma pack(push, 1) // Ensure byte alignment
// Input report (Report ID: 1)
typedef struct
{
uint8_t plug_status; // Plug Status Format
uint8_t charge_percent; // 0-100
union {
struct {
uint8_t button_south : 1; // LSB
uint8_t button_east : 1;
uint8_t button_west : 1;
uint8_t button_north : 1;
uint8_t dpad_up : 1;
uint8_t dpad_down : 1;
uint8_t dpad_left : 1;
uint8_t dpad_right : 1;
};
uint8_t buttons_1;
};
union
{
struct
{
uint8_t button_stick_left : 1; // LSB
uint8_t button_stick_right : 1;
uint8_t button_l_shoulder : 1;
uint8_t button_r_shoulder : 1;
uint8_t button_l_trigger : 1;
uint8_t button_r_trigger : 1;
uint8_t button_l_paddle_1 : 1;
uint8_t button_r_paddle_1 : 1;
};
uint8_t buttons_2;
};
union
{
struct
{
uint8_t button_start : 1; // LSB
uint8_t button_select : 1;
uint8_t button_guide : 1;
uint8_t button_share : 1;
uint8_t button_l_paddle_2 : 1;
uint8_t button_r_paddle_2 : 1;
uint8_t button_l_touchpad : 1;
uint8_t button_r_touchpad : 1;
};
uint8_t buttons_3;
};
union
{
struct
{
uint8_t button_power : 1; // LSB
uint8_t button_misc_4 : 1;
uint8_t button_misc_5 : 1;
uint8_t button_misc_6 : 1;
// Misc 7 through 10 is unused by
// SDL currently!
uint8_t button_misc_7 : 1;
uint8_t button_misc_8 : 1;
uint8_t button_misc_9 : 1;
uint8_t button_misc_10 : 1;
};
uint8_t buttons_4;
};
int16_t left_x; // Left stick X
int16_t left_y; // Left stick Y
int16_t right_x; // Right stick X
int16_t right_y; // Right stick Y
int16_t trigger_l; // Left trigger
int16_t trigger_r; // Right trigger
uint32_t imu_timestamp_us; // IMU Timestamp Microseconds
int16_t accel_x; // Accelerometer X
int16_t accel_y; // Accelerometer Y
int16_t accel_z; // Accelerometer Z
int16_t gyro_x; // Gyroscope X
int16_t gyro_y; // Gyroscope Y
int16_t gyro_z; // Gyroscope Z
int16_t touchpad_1_x; // Touchpad/trackpad
int16_t touchpad_1_y;
int16_t touchpad_1_pressure;
int16_t touchpad_2_x;
int16_t touchpad_2_y;
int16_t touchpad_2_pressure;
uint8_t reserved_bulk[17]; // Reserved
} sinput_input_s;
#pragma pack(pop)Data Table
Byte | Data | Type | Notes |
|---|---|---|---|
0 | Report ID | uint8 | 0x01 |
1 | Plug Status | uint8 | |
2 | Charge Percent | uint8 | 0-100 |
3-6 | Buttons | uint8[4] | |
7-8 | Left X | int16 | INT16 0 is center |
9-10 | Left Y | int16 | INT16 0 is center |
11-12 | Right X | int16 | INT16 0 is center |
13-14 | Right Y | int16 | INT16 0 is center |
15-16 | Trigger L | int16 | INT16_MIN to INT16_MAX |
17-18 | Trigger R | int16 | INT16_MIN to INT16_MAX |
19-22 | IMU Timestamp | uint32 | Microseconds, with wraparound |
23-24 | Accel X (Gs) | int16 | 0 is neutral |
25-26 | Accel Y | int16 | 0 is neutral |
27-28 | Accel Z | int16 | 0 is neutral |
29-30 | Gyro X (deg/sec) | int16 | 0 is neutral |
31-32 | Gyro Y | int16 | 0 is neutral |
33-34 | Gyro Z | int16 | 0 is neutral |
35-36 | Touch 1 X | int16 | |
37-38 | Touch 1 Y | int16 | |
39-40 | Touch 1 Pressure | uint16 | |
41-42 | Touch 2 X | int16 | |
43-44 | Touch 2 Y | int16 | |
45-46 | Touch 2 Pressure | uint16 | |
47-63 | Reserved |