Switch to using the standard printf() format specifiers in the HIDReportViewer project.
authorDean Camera <dean@fourwalledcubicle.com>
Sun, 19 Jun 2011 04:29:03 +0000 (04:29 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sun, 19 Jun 2011 04:29:03 +0000 (04:29 +0000)
Projects/Incomplete/HIDReportViewer/HIDReportViewer.c
Projects/Incomplete/HIDReportViewer/HIDReportViewer.h

index 6063f77..8c51907 100644 (file)
@@ -117,7 +117,7 @@ int main(void)
                        case HOST_STATE_Configured:\r
                                LEDs_SetAllLEDs(LEDMASK_USB_BUSY);\r
                                \r
-                               printf_P(PSTR("\r\n\r\nTotal Reports: %d\r\n"), HIDReportInfo.TotalDeviceReports);\r
+                               printf_P(PSTR("\r\n\r\nTotal Reports: %" PRId8 "\r\n"), HIDReportInfo.TotalDeviceReports);\r
                                for (uint8_t ReportIndex = 0; ReportIndex < HIDReportInfo.TotalDeviceReports; ReportIndex++)\r
                                {\r
                                        HID_ReportSizeInfo_t* CurrReportIDInfo = &HIDReportInfo.ReportIDSizes[ReportIndex];\r
@@ -127,7 +127,7 @@ int main(void)
                                        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 %d - In: %d bytes, Out: %d bytes, Feature: %d bytes\r\n"),\r
+                                       printf_P(PSTR("  + Report ID %" PRId8 " - In: %" PRId8 " bytes, Out: %" PRId8 " bytes, Feature: %" PRId8 " bytes\r\n"),\r
                                                 CurrReportIDInfo->ReportID,\r
                                                         ((ReportSizeInBits      >> 3) + ((ReportSizeInBits      & 0x07) != 0)),\r
                                                         ((ReportSizeOutBits     >> 3) + ((ReportSizeOutBits     & 0x07) != 0)),\r
@@ -137,22 +137,22 @@ int main(void)
                                printf_P(PSTR("\r\n\r\nReport Items: %d\r\n"), HIDReportInfo.TotalDeviceReports);\r
                                for (uint8_t ItemIndex = 0; ItemIndex < HIDReportInfo.TotalReportItems; ItemIndex++)\r
                                {\r
-                                       HID_ReportItem_t* RItem = &HIDReportInfo.ReportItems[ItemIndex];\r
+                                       const HID_ReportItem_t* RItem = &HIDReportInfo.ReportItems[ItemIndex];\r
 \r
-                                       printf_P(PSTR("  + Item %d:\r\n"\r
-                                                     "    - Report ID:          0x%02X\r\n"\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%02X\r\n"\r
-                                                     "    - Item Offset (Bits): 0x%02X\r\n"\r
-                                                     "    - Item Size (Bits):   0x%02X\r\n"\r
-                                                     "    - Usage Page:         0x%04X\r\n"\r
-                                                     "    - Usage:              0x%04X\r\n"\r
-                                                     "    - Unit Type:          0x%04X\r\n"\r
-                                                     "    - Unit Exponent:      0x%02X\r\n"\r
-                                                     "    - Logical Minimum:    0x%04X\r\n"\r
-                                                     "    - Logical Maximum:    0x%04X\r\n"\r
-                                                     "    - Physical Minimum:   0x%04X\r\n"\r
-                                                     "    - Physical Maximum:   0x%04X\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" PRIX32 "\r\n"\r
+                                                     "    - Usage:              0x%04" PRIX32 "\r\n"\r
+                                                     "    - Unit Type:          0x%04" PRIX32 "\r\n"\r
+                                                     "    - Unit Exponent:      0x%02" PRIX8  "\r\n"\r
+                                                     "    - Logical Minimum:    0x%04" PRIX32 "\r\n"\r
+                                                     "    - Logical Maximum:    0x%04" PRIX32 "\r\n"\r
+                                                     "    - Physical Minimum:   0x%04" PRIX32 "\r\n"\r
+                                                     "    - Physical Maximum:   0x%04" PRIX32 "\r\n"\r
                                                      "    - Collection Path:\r\n"),\r
                                                 ItemIndex,\r
                                                 RItem->ReportID,\r
@@ -169,20 +169,20 @@ int main(void)
                                                 RItem->Attributes.Physical.Minimum,\r
                                                 RItem->Attributes.Physical.Maximum);\r
                                        \r
-                                       HID_CollectionPath_t* CollectionPath  = RItem->CollectionPath;\r
-                                       uint8_t               CollectionDepth = 6;\r
+                                       const HID_CollectionPath_t* CollectionPath  = RItem->CollectionPath;\r
+                                       uint8_t                     CollectionDepth = 6;\r
                                        \r
                                        while (CollectionPath != NULL)\r
                                        {\r
                                                for (uint8_t i = 0; i < CollectionDepth; i++)\r
                                                  putchar(' ');\r
 \r
-                                               printf_P(PSTR("- Type: 0x%02X\r\n"), CollectionPath->Type);\r
+                                               printf_P(PSTR("- Type: 0x%02" PRIX8 "\r\n"), CollectionPath->Type);\r
                                        \r
                                                for (uint8_t i = 0; i < CollectionDepth; i++)\r
                                                  putchar(' ');\r
 \r
-                                               printf_P(PSTR("- Usage: 0x%02X\r\n"), CollectionPath->Usage);\r
+                                               printf_P(PSTR("- Usage: 0x%02" PRIX8 "\r\n"), CollectionPath->Usage);\r
 \r
                                                CollectionDepth += 3;\r
                                                CollectionPath   = CollectionPath->Parent;\r
index db96a1e..f4e131f 100644 (file)
@@ -43,6 +43,7 @@
                #include <avr/power.h>\r
                #include <avr/interrupt.h>\r
                #include <stdio.h>\r
+               #include <inttypes.h>\r
 \r
                #include <LUFA/Version.h>\r
                #include <LUFA/Drivers/Misc/TerminalCodes.h>\r