0.2.0-dev Download ZIP
706 lines ·16.0 KB Raw
| 1 | /* |
| 2 | Simple DirectMedia Layer |
| 3 | Copyright (C) 2020 Valve Corporation |
| 4 | |
| 5 | This software is provided 'as-is', without any express or implied |
| 6 | warranty. In no event will the authors be held liable for any damages |
| 7 | arising from the use of this software. |
| 8 | |
| 9 | Permission is granted to anyone to use this software for any purpose, |
| 10 | including commercial applications, and to alter it and redistribute it |
| 11 | freely, subject to the following restrictions: |
| 12 | |
| 13 | 1. The origin of this software must not be misrepresented; you must not |
| 14 | claim that you wrote the original software. If you use this software |
| 15 | in a product, an acknowledgment in the product documentation would be |
| 16 | appreciated but is not required. |
| 17 | 2. Altered source versions must be plainly marked as such, and must not be |
| 18 | misrepresented as being the original software. |
| 19 | 3. This notice may not be removed or altered from any source distribution. |
| 20 | */ |
| 21 | #ifndef _CONTROLLER_STRUCTS_ |
| 22 | #define _CONTROLLER_STRUCTS_ |
| 23 | |
| 24 | #pragma pack(1) |
| 25 | |
| 26 | #define HID_FEATURE_REPORT_BYTES 64 |
| 27 | |
| 28 | // Header for all host <==> target messages |
| 29 | typedef struct |
| 30 | { |
| 31 | unsigned char type; |
| 32 | unsigned char length; |
| 33 | } FeatureReportHeader; |
| 34 | |
| 35 | // Generic controller settings structure |
| 36 | typedef struct |
| 37 | { |
| 38 | unsigned char settingNum; |
| 39 | unsigned short settingValue; |
| 40 | } ControllerSetting; |
| 41 | |
| 42 | // Generic controller attribute structure |
| 43 | typedef struct |
| 44 | { |
| 45 | unsigned char attributeTag; |
| 46 | uint32_t attributeValue; |
| 47 | } ControllerAttribute; |
| 48 | |
| 49 | // Generic controller settings structure |
| 50 | typedef struct |
| 51 | { |
| 52 | ControllerSetting settings[ ( HID_FEATURE_REPORT_BYTES - sizeof( FeatureReportHeader ) ) / sizeof( ControllerSetting ) ]; |
| 53 | } MsgSetSettingsValues, MsgGetSettingsValues, MsgGetSettingsDefaults, MsgGetSettingsMaxs; |
| 54 | |
| 55 | // Generic controller settings structure |
| 56 | typedef struct |
| 57 | { |
| 58 | ControllerAttribute attributes[ ( HID_FEATURE_REPORT_BYTES - sizeof( FeatureReportHeader ) ) / sizeof( ControllerAttribute ) ]; |
| 59 | } MsgGetAttributes; |
| 60 | |
| 61 | typedef struct |
| 62 | { |
| 63 | unsigned char attributeTag; |
| 64 | char attributeValue[20]; |
| 65 | } MsgGetStringAttribute; |
| 66 | |
| 67 | typedef struct |
| 68 | { |
| 69 | unsigned char mode; |
| 70 | } MsgSetControllerMode; |
| 71 | |
| 72 | // Trigger a haptic pulse |
| 73 | typedef struct { |
| 74 | unsigned char which_pad; |
| 75 | unsigned short pulse_duration; |
| 76 | unsigned short pulse_interval; |
| 77 | unsigned short pulse_count; |
| 78 | short dBgain; |
| 79 | unsigned char priority; |
| 80 | } MsgFireHapticPulse; |
| 81 | |
| 82 | typedef struct { |
| 83 | uint8_t mode; |
| 84 | } MsgHapticSetMode; |
| 85 | |
| 86 | typedef enum { |
| 87 | HAPTIC_TYPE_OFF, |
| 88 | HAPTIC_TYPE_TICK, |
| 89 | HAPTIC_TYPE_CLICK, |
| 90 | HAPTIC_TYPE_TONE, |
| 91 | HAPTIC_TYPE_RUMBLE, |
| 92 | HAPTIC_TYPE_NOISE, |
| 93 | HAPTIC_TYPE_SCRIPT, |
| 94 | HAPTIC_TYPE_LOG_SWEEP, |
| 95 | } haptic_type_t; |
| 96 | |
| 97 | typedef enum { |
| 98 | HAPTIC_INTENSITY_SYSTEM, |
| 99 | HAPTIC_INTENSITY_SHORT, |
| 100 | HAPTIC_INTENSITY_MEDIUM, |
| 101 | HAPTIC_INTENSITY_LONG, |
| 102 | HAPTIC_INTENSITY_INSANE, |
| 103 | } haptic_intensity_t; |
| 104 | |
| 105 | typedef struct { |
| 106 | uint8_t side; // 0x01 = L, 0x02 = R, 0x03 = Both |
| 107 | uint8_t cmd; // 0 = Off, 1 = tick, 2 = click, 3 = tone, 4 = rumble, 5 = |
| 108 | // rumble_noise, 6 = script, 7 = sweep, |
| 109 | uint8_t ui_intensity; // 0-4 (0 = default) |
| 110 | int8_t dBgain; // dB Can be positive (reasonable clipping / limiting will apply) |
| 111 | uint16_t freq; // Frequency of tone (if applicable) |
| 112 | int16_t dur_ms; // Duration of tone / rumble (if applicable) (neg = infinite) |
| 113 | |
| 114 | uint16_t noise_intensity; |
| 115 | uint16_t lfo_freq; // Drives both tone and rumble generators |
| 116 | uint8_t lfo_depth; // percentage, typically 100 |
| 117 | uint8_t rand_tone_gain; // Randomize each LFO cycle's gain |
| 118 | uint8_t script_id; // Used w/ dBgain for scripted haptics |
| 119 | |
| 120 | uint16_t lss_start_freq; // Used w/ Log Sine Sweep |
| 121 | uint16_t lss_end_freq; // Ditto |
| 122 | } MsgTriggerHaptic; |
| 123 | |
| 124 | typedef struct { |
| 125 | uint8_t unRumbleType; |
| 126 | uint16_t unIntensity; |
| 127 | uint16_t unLeftMotorSpeed; |
| 128 | uint16_t unRightMotorSpeed; |
| 129 | int8_t nLeftGain; |
| 130 | int8_t nRightGain; |
| 131 | } MsgSimpleRumbleCmd; |
| 132 | |
| 133 | // This is the only message struct that application code should use to interact with feature request messages. Any new |
| 134 | // messages should be added to the union. The structures defined here should correspond to the ones defined in |
| 135 | // ValveDeviceCore.cpp. |
| 136 | // |
| 137 | typedef struct |
| 138 | { |
| 139 | FeatureReportHeader header; |
| 140 | union |
| 141 | { |
| 142 | MsgSetSettingsValues setSettingsValues; |
| 143 | MsgGetSettingsValues getSettingsValues; |
| 144 | MsgGetSettingsMaxs getSettingsMaxs; |
| 145 | MsgGetSettingsDefaults getSettingsDefaults; |
| 146 | MsgGetAttributes getAttributes; |
| 147 | MsgSetControllerMode controllerMode; |
| 148 | MsgFireHapticPulse fireHapticPulse; |
| 149 | MsgGetStringAttribute getStringAttribute; |
| 150 | MsgHapticSetMode hapticMode; |
| 151 | MsgTriggerHaptic triggerHaptic; |
| 152 | MsgSimpleRumbleCmd simpleRumble; |
| 153 | } payload; |
| 154 | |
| 155 | } FeatureReportMsg; |
| 156 | |
| 157 | // Triton and derivatives utilize output reports for haptic commands. This is a |
| 158 | // snapshot from Nov 2024 -- things may change. |
| 159 | |
| 160 | // Triton Output Report Lengths #defs include +1 for the OR ID |
| 161 | |
| 162 | // Output Report Haptic Messages for Triton |
| 163 | typedef struct |
| 164 | { |
| 165 | uint8_t type; |
| 166 | uint16_t intensity; |
| 167 | struct |
| 168 | { |
| 169 | uint16_t speed; |
| 170 | int8_t gain; |
| 171 | } left, right; |
| 172 | } MsgHapticRumble; |
| 173 | #define HID_RUMBLE_OUTPUT_REPORT_BYTES 10 |
| 174 | |
| 175 | |
| 176 | typedef struct |
| 177 | { |
| 178 | uint8_t side; |
| 179 | uint16_t on_us; |
| 180 | uint16_t off_us; |
| 181 | uint16_t repeat_count; |
| 182 | } MsgHapticPulse; |
| 183 | #define HID_HAPTIC_PULSE_OUTPUT_REPORT_BYTES 8 |
| 184 | |
| 185 | typedef struct |
| 186 | { |
| 187 | uint8_t side; |
| 188 | uint8_t command; |
| 189 | int8_t gain_db; |
| 190 | } MsgHapticCommand; |
| 191 | #define HID_HAPTIC_COMMAND_REPORT_BYTES 4 |
| 192 | |
| 193 | typedef struct |
| 194 | { |
| 195 | uint8_t side; |
| 196 | int8_t gain_db; |
| 197 | uint16_t frequency; |
| 198 | uint16_t duration_ms; |
| 199 | uint16_t lfo_freq; |
| 200 | uint8_t lfo_depth; |
| 201 | } MsgHapticLfoTone; |
| 202 | #define HID_HAPTIC_LFO_TONE_REPORT_BYTES 10 |
| 203 | |
| 204 | typedef struct |
| 205 | { |
| 206 | uint8_t side; |
| 207 | int8_t gain_db; |
| 208 | uint16_t duration_ms; |
| 209 | struct |
| 210 | { |
| 211 | uint16_t frequency; |
| 212 | } start, end; |
| 213 | } MsgHapticLogSweep; |
| 214 | #define HID_HAPTIC_LOG_SWEEP_REPORT_BYTES 9 |
| 215 | |
| 216 | typedef struct m |
| 217 | { |
| 218 | uint8_t side; |
| 219 | uint8_t script_id; |
| 220 | int8_t gain_db; |
| 221 | } MsgHapticScript; |
| 222 | #define HID_HAPTIC_SCRIPT_REPORT_BYTES 4 |
| 223 | |
| 224 | typedef enum |
| 225 | { |
| 226 | ID_OUT_REPORT_HAPTIC_RUMBLE = 0x80, |
| 227 | ID_OUT_REPORT_HAPTIC_PULSE = 0x81, |
| 228 | ID_OUT_REPORT_HAPTIC_COMMAND = 0x82, |
| 229 | ID_OUT_REPORT_HAPTIC_LFO_TONE = 0x83, |
| 230 | ID_OUT_REPORT_HAPTIC_LOG_SWEEP = 0x84, |
| 231 | ID_OUT_REPORT_HAPTIC_SCRIPT = 0x85, |
| 232 | } ValveTritonOutReportMessageIDs; |
| 233 | |
| 234 | typedef struct |
| 235 | { |
| 236 | uint8_t report_id; |
| 237 | union |
| 238 | { |
| 239 | MsgHapticRumble hapticRumble; |
| 240 | MsgHapticPulse hapticPulse; |
| 241 | MsgHapticCommand hapticCommand; |
| 242 | MsgHapticLfoTone hapticLfoTone; |
| 243 | MsgHapticLogSweep hapticLogSweep; |
| 244 | MsgHapticScript hapticScript; |
| 245 | } payload; |
| 246 | |
| 247 | } OutputReportMsg; |
| 248 | |
| 249 | |
| 250 | // Roll this version forward anytime that you are breaking compatibility of existing |
| 251 | // message types within ValveInReport_t or the header itself. Hopefully this should |
| 252 | // be super rare and instead you should just add new message payloads to the union, |
| 253 | // or just add fields to the end of existing payload structs which is expected to be |
| 254 | // safe in all code consuming these as they should just consume/copy up to the prior size |
| 255 | // they were aware of when processing. |
| 256 | #define k_ValveInReportMsgVersion 0x01 |
| 257 | |
| 258 | typedef enum |
| 259 | { |
| 260 | ID_CONTROLLER_STATE = 1, |
| 261 | ID_CONTROLLER_DEBUG = 2, |
| 262 | ID_CONTROLLER_WIRELESS = 3, |
| 263 | ID_CONTROLLER_STATUS = 4, |
| 264 | ID_CONTROLLER_DEBUG2 = 5, |
| 265 | ID_CONTROLLER_SECONDARY_STATE = 6, |
| 266 | ID_CONTROLLER_BLE_STATE = 7, |
| 267 | ID_CONTROLLER_DECK_STATE = 9, |
| 268 | ID_CONTROLLER_MSG_COUNT |
| 269 | } ValveInReportMessageIDs; |
| 270 | |
| 271 | typedef struct |
| 272 | { |
| 273 | unsigned short unReportVersion; |
| 274 | |
| 275 | unsigned char ucType; |
| 276 | unsigned char ucLength; |
| 277 | |
| 278 | } ValveInReportHeader_t; |
| 279 | |
| 280 | // State payload |
| 281 | typedef struct |
| 282 | { |
| 283 | // If packet num matches that on your prior call, then the controller state hasn't been changed since |
| 284 | // your last call and there is no need to process it |
| 285 | Uint32 unPacketNum; |
| 286 | |
| 287 | // Button bitmask and trigger data. |
| 288 | union |
| 289 | { |
| 290 | Uint64 ulButtons; |
| 291 | struct |
| 292 | { |
| 293 | unsigned char _pad0[3]; |
| 294 | unsigned char nLeft; |
| 295 | unsigned char nRight; |
| 296 | unsigned char _pad1[3]; |
| 297 | } Triggers; |
| 298 | } ButtonTriggerData; |
| 299 | |
| 300 | // Left pad coordinates |
| 301 | short sLeftPadX; |
| 302 | short sLeftPadY; |
| 303 | |
| 304 | // Right pad coordinates |
| 305 | short sRightPadX; |
| 306 | short sRightPadY; |
| 307 | |
| 308 | // This is redundant, packed above, but still sent over wired |
| 309 | unsigned short sTriggerL; |
| 310 | unsigned short sTriggerR; |
| 311 | |
| 312 | // FIXME figure out a way to grab this stuff over wireless |
| 313 | short sAccelX; |
| 314 | short sAccelY; |
| 315 | short sAccelZ; |
| 316 | |
| 317 | short sGyroX; |
| 318 | short sGyroY; |
| 319 | short sGyroZ; |
| 320 | |
| 321 | short sGyroQuatW; |
| 322 | short sGyroQuatX; |
| 323 | short sGyroQuatY; |
| 324 | short sGyroQuatZ; |
| 325 | |
| 326 | } ValveControllerStatePacket_t; |
| 327 | |
| 328 | // BLE State payload this has to be re-formatted from the normal state because BLE controller shows up as |
| 329 | //a HID device and we don't want to send all the optional parts of the message. Keep in sync with struct above. |
| 330 | typedef struct |
| 331 | { |
| 332 | // If packet num matches that on your prior call, then the controller state hasn't been changed since |
| 333 | // your last call and there is no need to process it |
| 334 | Uint32 unPacketNum; |
| 335 | |
| 336 | // Button bitmask and trigger data. |
| 337 | union |
| 338 | { |
| 339 | Uint64 ulButtons; |
| 340 | struct |
| 341 | { |
| 342 | unsigned char _pad0[3]; |
| 343 | unsigned char nLeft; |
| 344 | unsigned char nRight; |
| 345 | unsigned char _pad1[3]; |
| 346 | } Triggers; |
| 347 | } ButtonTriggerData; |
| 348 | |
| 349 | // Left pad coordinates |
| 350 | short sLeftPadX; |
| 351 | short sLeftPadY; |
| 352 | |
| 353 | // Right pad coordinates |
| 354 | short sRightPadX; |
| 355 | short sRightPadY; |
| 356 | |
| 357 | //This mimics how the dongle reconstitutes HID packets, there will be 0-4 shorts depending on gyro mode |
| 358 | unsigned char ucGyroDataType; //TODO could maybe find some unused bits in the button field for this info (is only 2bits) |
| 359 | short sGyro[4]; |
| 360 | |
| 361 | } ValveControllerBLEStatePacket_t; |
| 362 | |
| 363 | // Define a payload for reporting debug information |
| 364 | typedef struct |
| 365 | { |
| 366 | // Left pad coordinates |
| 367 | short sLeftPadX; |
| 368 | short sLeftPadY; |
| 369 | |
| 370 | // Right pad coordinates |
| 371 | short sRightPadX; |
| 372 | short sRightPadY; |
| 373 | |
| 374 | // Left mouse deltas |
| 375 | short sLeftPadMouseDX; |
| 376 | short sLeftPadMouseDY; |
| 377 | |
| 378 | // Right mouse deltas |
| 379 | short sRightPadMouseDX; |
| 380 | short sRightPadMouseDY; |
| 381 | |
| 382 | // Left mouse filtered deltas |
| 383 | short sLeftPadMouseFilteredDX; |
| 384 | short sLeftPadMouseFilteredDY; |
| 385 | |
| 386 | // Right mouse filtered deltas |
| 387 | short sRightPadMouseFilteredDX; |
| 388 | short sRightPadMouseFilteredDY; |
| 389 | |
| 390 | // Pad Z values |
| 391 | unsigned char ucLeftZ; |
| 392 | unsigned char ucRightZ; |
| 393 | |
| 394 | // FingerPresent |
| 395 | unsigned char ucLeftFingerPresent; |
| 396 | unsigned char ucRightFingerPresent; |
| 397 | |
| 398 | // Timestamps |
| 399 | unsigned char ucLeftTimestamp; |
| 400 | unsigned char ucRightTimestamp; |
| 401 | |
| 402 | // Double tap state |
| 403 | unsigned char ucLeftTapState; |
| 404 | unsigned char ucRightTapState; |
| 405 | |
| 406 | unsigned int unDigitalIOStates0; |
| 407 | unsigned int unDigitalIOStates1; |
| 408 | |
| 409 | } ValveControllerDebugPacket_t; |
| 410 | |
| 411 | typedef struct |
| 412 | { |
| 413 | unsigned char ucPadNum; |
| 414 | unsigned char ucPad[3]; // need Data to be word aligned |
| 415 | short Data[20]; |
| 416 | unsigned short unNoise; |
| 417 | } ValveControllerTrackpadImage_t; |
| 418 | |
| 419 | typedef struct |
| 420 | { |
| 421 | unsigned char ucPadNum; |
| 422 | unsigned char ucOffset; |
| 423 | unsigned char ucPad[2]; // need Data to be word aligned |
| 424 | short rgData[28]; |
| 425 | } ValveControllerRawTrackpadImage_t; |
| 426 | |
| 427 | // Payload for wireless metadata |
| 428 | typedef struct |
| 429 | { |
| 430 | unsigned char ucEventType; |
| 431 | } SteamControllerWirelessEvent_t; |
| 432 | |
| 433 | typedef struct |
| 434 | { |
| 435 | // Current packet number. |
| 436 | unsigned int unPacketNum; |
| 437 | |
| 438 | // Event codes and state information. |
| 439 | unsigned short sEventCode; |
| 440 | unsigned short unStateFlags; |
| 441 | |
| 442 | // Current battery voltage (mV). |
| 443 | unsigned short sBatteryVoltage; |
| 444 | |
| 445 | // Current battery level (0-100). |
| 446 | unsigned char ucBatteryLevel; |
| 447 | } SteamControllerStatusEvent_t; |
| 448 | |
| 449 | // Deck State payload |
| 450 | typedef struct |
| 451 | { |
| 452 | // If packet num matches that on your prior call, then the controller |
| 453 | // state hasn't been changed since your last call and there is no need to |
| 454 | // process it |
| 455 | Uint32 unPacketNum; |
| 456 | |
| 457 | // Button bitmask and trigger data. |
| 458 | union |
| 459 | { |
| 460 | Uint64 ulButtons; |
| 461 | struct |
| 462 | { |
| 463 | Uint32 ulButtonsL; |
| 464 | Uint32 ulButtonsH; |
| 465 | }; |
| 466 | }; |
| 467 | |
| 468 | // Left pad coordinates |
| 469 | short sLeftPadX; |
| 470 | short sLeftPadY; |
| 471 | |
| 472 | // Right pad coordinates |
| 473 | short sRightPadX; |
| 474 | short sRightPadY; |
| 475 | |
| 476 | // Accelerometer values |
| 477 | short sAccelX; |
| 478 | short sAccelY; |
| 479 | short sAccelZ; |
| 480 | |
| 481 | // Gyroscope values |
| 482 | short sGyroX; |
| 483 | short sGyroY; |
| 484 | short sGyroZ; |
| 485 | |
| 486 | // Gyro quaternions |
| 487 | short sGyroQuatW; |
| 488 | short sGyroQuatX; |
| 489 | short sGyroQuatY; |
| 490 | short sGyroQuatZ; |
| 491 | |
| 492 | // Uncalibrated trigger values |
| 493 | unsigned short sTriggerRawL; |
| 494 | unsigned short sTriggerRawR; |
| 495 | |
| 496 | // Left stick values |
| 497 | short sLeftStickX; |
| 498 | short sLeftStickY; |
| 499 | |
| 500 | // Right stick values |
| 501 | short sRightStickX; |
| 502 | short sRightStickY; |
| 503 | |
| 504 | // Touchpad pressures |
| 505 | unsigned short sPressurePadLeft; |
| 506 | unsigned short sPressurePadRight; |
| 507 | } SteamDeckStatePacket_t; |
| 508 | |
| 509 | |
| 510 | typedef struct |
| 511 | { |
| 512 | ValveInReportHeader_t header; |
| 513 | |
| 514 | union |
| 515 | { |
| 516 | ValveControllerStatePacket_t controllerState; |
| 517 | ValveControllerBLEStatePacket_t controllerBLEState; |
| 518 | ValveControllerDebugPacket_t debugState; |
| 519 | ValveControllerTrackpadImage_t padImage; |
| 520 | ValveControllerRawTrackpadImage_t rawPadImage; |
| 521 | SteamControllerWirelessEvent_t wirelessEvent; |
| 522 | SteamControllerStatusEvent_t statusEvent; |
| 523 | SteamDeckStatePacket_t deckState; |
| 524 | } payload; |
| 525 | |
| 526 | } ValveInReport_t; |
| 527 | |
| 528 | enum EBLEPacketReportNums |
| 529 | { |
| 530 | k_EBLEReportState = 4, |
| 531 | k_EBLEReportStatus = 5, |
| 532 | }; |
| 533 | // Enumeration of data chunks in BLE state packets |
| 534 | enum EBLEOptionDataChunksBitmask |
| 535 | { |
| 536 | // First byte upper nibble |
| 537 | k_EBLEButtonChunk1 = 0x10, |
| 538 | k_EBLEButtonChunk2 = 0x20, |
| 539 | k_EBLEButtonChunk3 = 0x40, |
| 540 | k_EBLELeftJoystickChunk = 0x80, |
| 541 | |
| 542 | // Second full byte |
| 543 | k_EBLELeftTrackpadChunk = 0x100, |
| 544 | k_EBLERightTrackpadChunk = 0x200, |
| 545 | k_EBLEIMUAccelChunk = 0x400, |
| 546 | k_EBLEIMUGyroChunk = 0x800, |
| 547 | k_EBLEIMUQuatChunk = 0x1000, |
| 548 | }; |
| 549 | |
| 550 | // Triton and derivatives do not use the ValveInReport_t structure |
| 551 | |
| 552 | enum ETritonReportIDTypes |
| 553 | { |
| 554 | ID_TRITON_CONTROLLER_STATE = 0x42, |
| 555 | ID_TRITON_BATTERY_STATUS = 0x43, |
| 556 | ID_TRITON_CONTROLLER_STATE_BLE = 0x45, |
| 557 | ID_TRITON_WIRELESS_STATUS_X = 0x46, |
| 558 | ID_TRITON_CONTROLLER_STATE_TIMESTAMP = 0x47, |
| 559 | |
| 560 | ID_TRITON_WIRELESS_STATUS = 0x79, |
| 561 | }; |
| 562 | |
| 563 | enum ETritonWirelessState |
| 564 | { |
| 565 | k_ETritonWirelessStateDisconnect = 1, |
| 566 | k_ETritonWirelessStateConnect = 2, |
| 567 | }; |
| 568 | |
| 569 | typedef struct |
| 570 | { |
| 571 | uint32_t timestamp; |
| 572 | short sAccelX; |
| 573 | short sAccelY; |
| 574 | short sAccelZ; |
| 575 | |
| 576 | short sGyroX; |
| 577 | short sGyroY; |
| 578 | short sGyroZ; |
| 579 | |
| 580 | short sGyroQuatW; |
| 581 | short sGyroQuatX; |
| 582 | short sGyroQuatY; |
| 583 | short sGyroQuatZ; |
| 584 | } TritonMTUIMU_t; |
| 585 | |
| 586 | typedef struct { |
| 587 | uint32_t timestamp; |
| 588 | short sAccelX; |
| 589 | short sAccelY; |
| 590 | short sAccelZ; |
| 591 | |
| 592 | short sGyroX; |
| 593 | short sGyroY; |
| 594 | short sGyroZ; |
| 595 | } TritonMTUIMUNoQuat_t; |
| 596 | |
| 597 | typedef struct |
| 598 | { |
| 599 | uint16_t timestamp; |
| 600 | short sAccelX; |
| 601 | short sAccelY; |
| 602 | short sAccelZ; |
| 603 | |
| 604 | short sGyroX; |
| 605 | short sGyroY; |
| 606 | short sGyroZ; |
| 607 | } TritonMTUIMUNoQuat32usTS_t; |
| 608 | |
| 609 | typedef struct |
| 610 | { |
| 611 | uint8_t seq_num; |
| 612 | uint32_t buttons; |
| 613 | short sTriggerLeft; |
| 614 | short sTriggerRight; |
| 615 | |
| 616 | short sLeftStickX; |
| 617 | short sLeftStickY; |
| 618 | short sRightStickX; |
| 619 | short sRightStickY; |
| 620 | |
| 621 | short sLeftPadX; |
| 622 | short sLeftPadY; |
| 623 | unsigned short unPressureLeft; |
| 624 | |
| 625 | short sRightPadX; |
| 626 | short sRightPadY; |
| 627 | unsigned short unPressureRight; |
| 628 | TritonMTUIMU_t imu; |
| 629 | } TritonMTUFull_t; |
| 630 | |
| 631 | typedef struct { |
| 632 | uint8_t seq_num; |
| 633 | uint32_t buttons; |
| 634 | short sTriggerLeft; |
| 635 | short sTriggerRight; |
| 636 | |
| 637 | short sLeftStickX; |
| 638 | short sLeftStickY; |
| 639 | short sRightStickX; |
| 640 | short sRightStickY; |
| 641 | |
| 642 | short sLeftPadX; |
| 643 | short sLeftPadY; |
| 644 | unsigned short unPressureLeft; |
| 645 | |
| 646 | short sRightPadX; |
| 647 | short sRightPadY; |
| 648 | unsigned short unPressureRight; |
| 649 | TritonMTUIMUNoQuat_t imu; |
| 650 | } TritonMTUNoQuat_t; |
| 651 | |
| 652 | // New Ibex packet that adds a timestamp to the trackpad sampling |
| 653 | // and reduces the size of the IMU timestamp. Timestamps are now 16 bits |
| 654 | typedef struct |
| 655 | { |
| 656 | uint8_t seq_num; |
| 657 | uint32_t buttons; |
| 658 | short sTriggerLeft; |
| 659 | short sTriggerRight; |
| 660 | |
| 661 | short sLeftStickX; |
| 662 | short sLeftStickY; |
| 663 | short sRightStickX; |
| 664 | short sRightStickY; |
| 665 | |
| 666 | unsigned short unTrackpadTimestamp; |
| 667 | short sLeftPadX; |
| 668 | short sLeftPadY; |
| 669 | unsigned short unPressureLeft; |
| 670 | |
| 671 | short sRightPadX; |
| 672 | short sRightPadY; |
| 673 | unsigned short unPressureRight; |
| 674 | |
| 675 | TritonMTUIMUNoQuat32usTS_t imu; |
| 676 | } TritonMTUNoQuat32TS_t; |
| 677 | |
| 678 | enum EChargeState |
| 679 | { |
| 680 | k_EChargeStateReset, |
| 681 | k_EChargeStateDischarging, |
| 682 | k_EChargeStateCharging, |
| 683 | k_EChargeStateSrcValidate, |
| 684 | k_EChargeStateChargingDone, |
| 685 | }; |
| 686 | |
| 687 | typedef struct |
| 688 | { |
| 689 | unsigned char ucChargeState; // EChargeState |
| 690 | unsigned char ucBatteryLevel; |
| 691 | unsigned short sBatteryVoltage; |
| 692 | unsigned short sSystemVoltage; |
| 693 | unsigned short sInputVoltage; |
| 694 | unsigned short sCurrent; |
| 695 | unsigned short sInputCurrent; |
| 696 | unsigned short sTemperature; |
| 697 | } TritonBatteryStatus_t; |
| 698 | |
| 699 | typedef struct |
| 700 | { |
| 701 | unsigned char state; |
| 702 | } TritonWirelessStatus_t; |
| 703 | |
| 704 | #pragma pack() |
| 705 | |
| 706 | #endif // _CONTROLLER_STRUCTS_ |