1 /* 2 * Copyright 2020, Jérôme Duval, jerome.duval@gmail.com. 3 * Copyright 2008-2011, Michael Lotz <mmlr@mlotz.ch> 4 * Copyright 2023 Vladimir Serbinenko <phcoder@gmail.com> 5 * Distributed under the terms of the MIT license. 6 */ 7 #ifndef I2C_HID_PROTOCOL_H 8 #define I2C_HID_PROTOCOL_H 9 10 /* 5.1.1 - HID Descriptor Format */ 11 typedef struct i2c_hid_descriptor { 12 uint16 wHIDDescLength; 13 uint16 bcdVersion; 14 uint16 wReportDescLength; 15 uint16 wReportDescRegister; 16 uint16 wInputRegister; 17 uint16 wMaxInputLength; 18 uint16 wOutputRegister; 19 uint16 wMaxOutputLength; 20 uint16 wCommandRegister; 21 uint16 wDataRegister; 22 uint16 wVendorID; 23 uint16 wProductID; 24 uint16 wVersionID; 25 uint32 reserved; 26 } _PACKED i2c_hid_descriptor; 27 28 29 enum { 30 I2C_HID_CMD_RESET = 0x1, 31 I2C_HID_CMD_GET_REPORT = 0x2, 32 I2C_HID_CMD_SET_REPORT = 0x3, 33 I2C_HID_CMD_GET_IDLE = 0x4, 34 I2C_HID_CMD_SET_IDLE = 0x5, 35 I2C_HID_CMD_GET_PROTOCOL = 0x6, 36 I2C_HID_CMD_SET_PROTOCOL = 0x7, 37 I2C_HID_CMD_SET_POWER = 0x8, 38 }; 39 40 enum { 41 I2C_HID_POWER_ON = 0x0, 42 I2C_HID_POWER_OFF = 0x1, 43 }; 44 45 #endif // I2C_HID_PROTOCOL_H 46