+/** Prints a summary of the device's HID report sizes from the HID parser output to the serial port\r
+ * for display to the user.\r
+ */\r
+void OutputReportSizes(void)\r
+{\r
+ printf_P(PSTR("\r\n\r\nTotal Device Reports: %" PRId8 "\r\n"), HIDReportInfo.TotalDeviceReports);\r
+\r
+ for (uint8_t ReportIndex = 0; ReportIndex < HIDReportInfo.TotalDeviceReports; ReportIndex++)\r
+ {\r
+ const HID_ReportSizeInfo_t* CurrReportIDInfo = &HIDReportInfo.ReportIDSizes[ReportIndex];\r
+\r
+ uint8_t ReportSizeInBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_In];\r
+ uint8_t ReportSizeOutBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Out];\r
+ uint8_t ReportSizeFeatureBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Feature];\r
+\r
+ /* Print out the byte sizes of each report within the device */\r
+ printf_P(PSTR(" + Report ID 0x%02" PRIX8 "\r\n"\r
+ " - Input Data: %" PRId8 " bits (%" PRId8 " bytes)\r\n"\r
+ " - Output Data: %" PRId8 " bits (%" PRId8 " bytes)\r\n"\r
+ " - Feature Data: %" PRId8 " bits (%" PRId8 " bytes)\r\n"),\r
+ CurrReportIDInfo->ReportID,\r
+ ReportSizeInBits,\r
+ ((ReportSizeInBits >> 3) + ((ReportSizeInBits & 0x07) != 0)),\r
+ ReportSizeOutBits,\r
+ ((ReportSizeOutBits >> 3) + ((ReportSizeOutBits & 0x07) != 0)),\r
+ ReportSizeFeatureBits,\r
+ ((ReportSizeFeatureBits >> 3) + ((ReportSizeFeatureBits & 0x07) != 0)));\r
+ }\r
+}\r
+\r
+/** Prints a summary of the device's parsed and stored report items along with their attributes\r
+ * to the serial port for display to the user.\r
+ */\r
+void OutputParsedReportItems(void)\r
+{\r
+ printf_P(PSTR("\r\nReport Items (%" PRId8 " in Table):\r\n"), HIDReportInfo.TotalReportItems);\r
+\r
+ for (uint8_t ItemIndex = 0; ItemIndex < HIDReportInfo.TotalReportItems; ItemIndex++)\r
+ {\r
+ const HID_ReportItem_t* RItem = &HIDReportInfo.ReportItems[ItemIndex];\r
+\r
+ printf_P(PSTR(" + Item %" PRId8 ":\r\n"\r
+ " - Report ID: 0x%02" PRIX8 "\r\n"\r
+ " - Data Direction: %s\r\n"\r
+ " - Item Flags: 0x%02" PRIX8 "\r\n"\r
+ " - Item Offset (Bits): 0x%02" PRIX8 "\r\n"\r
+ " - Item Size (Bits): 0x%02" PRIX8 "\r\n"\r
+ " - Usage Page: 0x%04" PRIX16 "\r\n"\r
+ " - Usage: 0x%04" PRIX16 "\r\n"\r
+ " - Unit Type: 0x%08" PRIX32 "\r\n"\r
+ " - Unit Exponent: 0x%02" PRIX8 "\r\n"\r
+ " - Logical Minimum: 0x%08" PRIX32 "\r\n"\r
+ " - Logical Maximum: 0x%08" PRIX32 "\r\n"\r
+ " - Physical Minimum: 0x%08" PRIX32 "\r\n"\r
+ " - Physical Maximum: 0x%08" PRIX32 "\r\n"\r
+ " - Collection Path:\r\n"),\r
+ ItemIndex,\r
+ RItem->ReportID,\r
+ ((RItem->ItemType == HID_REPORT_ITEM_In) ? "IN" : ((RItem->ItemType == HID_REPORT_ITEM_Out) ? "OUT" : "FEATURE")),\r
+ RItem->ItemFlags,\r
+ RItem->BitOffset,\r
+ RItem->Attributes.BitSize,\r
+ RItem->Attributes.Usage.Page,\r
+ RItem->Attributes.Usage.Usage,\r
+ RItem->Attributes.Unit.Type,\r
+ RItem->Attributes.Unit.Exponent,\r
+ RItem->Attributes.Logical.Minimum,\r
+ RItem->Attributes.Logical.Maximum,\r
+ RItem->Attributes.Physical.Minimum,\r
+ RItem->Attributes.Physical.Maximum);\r
+ \r
+ OutputCollectionPath(RItem->CollectionPath);\r
+ }\r
+}\r
+\r
+/** Prints the HID Collection path (along with each node's attributes) to the serial port\r
+ * for display to the user, from the given starting node to the root node.\r
+ *\r
+ * \param[in] CollectionPath Starting HID Collection node to print\r
+ */\r
+void OutputCollectionPath(const HID_CollectionPath_t* const CollectionPath)\r
+{\r
+ const HID_CollectionPath_t* CurrentNode = CollectionPath;\r
+\r
+ while (CurrentNode != NULL)\r
+ {\r
+ printf_P(PSTR(" |\r\n"\r
+ " - Type: 0x%02" PRIX8 "\r\n"\r
+ " - Usage: 0x%02" PRIX8 "\r\n"),\r
+ CurrentNode->Type, CurrentNode->Usage);\r
+ \r
+ CurrentNode = CurrentNode->Parent;\r
+ }\r
+ \r
+ printf_P(PSTR(" |\r\n"\r
+ " END\r\n"));\r
+}\r
+\r