示例#1
0
    .bNumConfigurations = 0x01
};

//------------- HID Report Descriptor -------------//
#if CFG_TUD_HID
enum
{
  REPORT_ID_KEYBOARD = 1,
  REPORT_ID_MOUSE
};

uint8_t const desc_hid_report[] =
{
  TUD_HID_REPORT_DESC_KEYBOARD( HID_REPORT_ID(REPORT_ID_KEYBOARD), ),
  TUD_HID_REPORT_DESC_MOUSE   ( HID_REPORT_ID(REPORT_ID_MOUSE), )
};

// Invoked when received GET HID REPORT DESCRIPTOR
// Application return pointer to descriptor
// Descriptor contents must exist long enough for transfer to complete
uint8_t const * tud_hid_descriptor_report_cb(void)
{
  return desc_hid_report;
}

#endif

//------------- Configuration Descriptor -------------//
enum
{
示例#2
0
  .bDeviceProtocol = 0,
  .bMaxPacketSize0 = 64,
  .idVendor = 0x1209,
  .idProduct = 0xCC86,
  .bcdDevice = 0x0100,
  .iManufacturer = 1,
  .iProduct = 2,
  .iSerialNumber = 3,
  .bNumConfigurations = 1,
};

static const uint8_t hid_report_descriptor[] = {
  0x06, 0x00, 0xff,
  HID_USAGE   (0x01),
  HID_COLLECTION    (HID_COLLECTION_APPLICATION),
    HID_REPORT_ID(1),
    HID_LOGICAL_MINIMUM     (0),
    HID_LOGICAL_MAXIMUM     (255),
    HID_REPORT_SIZE   (8),
    HID_REPORT_COUNT  (9),
    HID_USAGE   (0x01),
    HID_INPUT (0x02),
  HID_END_COLLECTION,
  0x06, 0x00, 0xff,
  HID_USAGE   (0x01),
  HID_COLLECTION    (HID_COLLECTION_APPLICATION),
    HID_REPORT_ID(2),
    HID_LOGICAL_MINIMUM     (0),
    HID_LOGICAL_MAXIMUM     (255),
    HID_REPORT_SIZE   (8),
    HID_REPORT_COUNT  (MAX_PACKET_SIZE),