|
|
@@ -42,6 +42,35 @@ TU_ATTR_WEAK uint8_t const *tud_descriptor_device_cb(void)
|
|
|
return (uint8_t const *) &desc_device;
|
|
|
}
|
|
|
|
|
|
+//--------------------------------------------------------------------+
|
|
|
+// HID Report Descriptor
|
|
|
+//--------------------------------------------------------------------+
|
|
|
+
|
|
|
+static uint8_t const desc_hid_report[] =
|
|
|
+{
|
|
|
+#ifdef PKG_TINYUSB_DEVICE_HID_KEYBOARD
|
|
|
+ TUD_HID_REPORT_DESC_KEYBOARD(HID_REPORT_ID(REPORT_ID_KEYBOARD)),
|
|
|
+#endif
|
|
|
+#ifdef PKG_TINYUSB_DEVICE_HID_MOUSE
|
|
|
+ TUD_HID_REPORT_DESC_MOUSE(HID_REPORT_ID(REPORT_ID_MOUSE)),
|
|
|
+#endif
|
|
|
+#ifdef PKG_TINYUSB_DEVICE_HID_CONSUMER
|
|
|
+ TUD_HID_REPORT_DESC_CONSUMER(HID_REPORT_ID(REPORT_ID_CONSUMER_CONTROL)),
|
|
|
+#endif
|
|
|
+#ifdef PKG_TINYUSB_DEVICE_HID_GAMEPAD
|
|
|
+ TUD_HID_REPORT_DESC_GAMEPAD(HID_REPORT_ID(REPORT_ID_GAMEPAD))
|
|
|
+#endif
|
|
|
+};
|
|
|
+
|
|
|
+// Invoked when received GET HID REPORT DESCRIPTOR
|
|
|
+// Application return pointer to descriptor
|
|
|
+// Descriptor contents must exist long enough for transfer to complete
|
|
|
+TU_ATTR_WEAK uint8_t const *tud_hid_descriptor_report_cb(uint8_t instance)
|
|
|
+{
|
|
|
+ (void)instance;
|
|
|
+ return desc_hid_report;
|
|
|
+}
|
|
|
+
|
|
|
//--------------------------------------------------------------------+
|
|
|
// Configuration Descriptor
|
|
|
//--------------------------------------------------------------------+
|
|
|
@@ -138,32 +167,3 @@ TU_ATTR_WEAK uint16_t const *tud_descriptor_string_cb(uint8_t index, uint16_t la
|
|
|
|
|
|
return desc_str;
|
|
|
}
|
|
|
-
|
|
|
-//--------------------------------------------------------------------+
|
|
|
-// HID Report Descriptor
|
|
|
-//--------------------------------------------------------------------+
|
|
|
-
|
|
|
-static uint8_t const desc_hid_report[] =
|
|
|
-{
|
|
|
-#ifdef PKG_TINYUSB_DEVICE_HID_KEYBOARD
|
|
|
- TUD_HID_REPORT_DESC_KEYBOARD(HID_REPORT_ID(REPORT_ID_KEYBOARD)),
|
|
|
-#endif
|
|
|
-#ifdef PKG_TINYUSB_DEVICE_HID_MOUSE
|
|
|
- TUD_HID_REPORT_DESC_MOUSE(HID_REPORT_ID(REPORT_ID_MOUSE)),
|
|
|
-#endif
|
|
|
-#ifdef PKG_TINYUSB_DEVICE_HID_CONSUMER
|
|
|
- TUD_HID_REPORT_DESC_CONSUMER(HID_REPORT_ID(REPORT_ID_CONSUMER_CONTROL)),
|
|
|
-#endif
|
|
|
-#ifdef PKG_TINYUSB_DEVICE_HID_GAMEPAD
|
|
|
- TUD_HID_REPORT_DESC_GAMEPAD(HID_REPORT_ID(REPORT_ID_GAMEPAD))
|
|
|
-#endif
|
|
|
-};
|
|
|
-
|
|
|
-// Invoked when received GET HID REPORT DESCRIPTOR
|
|
|
-// Application return pointer to descriptor
|
|
|
-// Descriptor contents must exist long enough for transfer to complete
|
|
|
-TU_ATTR_WEAK uint8_t const *tud_hid_descriptor_report_cb(uint8_t instance)
|
|
|
-{
|
|
|
- (void)instance;
|
|
|
- return desc_hid_report;
|
|
|
-}
|