+\r
+/** Processes a read HID report from an attached keyboard, extracting out elements via the HID parser results\r
+ *  as required and prints pressed characters to the serial port. Each time a key is typed, a board LED is toggled.\r
+ *\r
+ *  \param KeyboardReport  Pointer to a HID report from an attached keyboard device\r
+ */\r
+void ProcessKeyboardReport(uint8_t* KeyboardReport)\r
+{\r
+       /* Check each HID report item in turn, looking for keyboard scan code reports */\r
+       for (uint8_t ReportNumber = 0; ReportNumber < HIDReportInfo.TotalReportItems; ReportNumber++)\r
+       {\r
+               /* Create a temporary item pointer to the next report item */\r
+               HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];\r
+\r
+               /* Check if the current report item is a keyboard scancode */\r
+               if ((ReportItem->Attributes.Usage.Page      == USAGE_PAGE_KEYBOARD) &&\r
+                       (ReportItem->Attributes.BitSize         == 8)                   &&\r
+                       (ReportItem->Attributes.Logical.Maximum > 1)                    &&\r
+                       (ReportItem->ItemType                   == REPORT_ITEM_TYPE_In))\r
+               {\r
+                       /* Retrieve the keyboard scancode from the report data retrieved from the device */\r
+                       bool FoundData = USB_GetHIDReportItemInfo(KeyboardReport, ReportItem);\r
+                       \r
+                       /* For multi-report devices - if the requested data was not in the issued report, continue */\r
+                       if (!(FoundData))\r
+                         continue;\r
+                       \r
+                       /* Key code is an unsigned char in length, cast to the appropriate type */\r
+                       uint8_t KeyCode = (uint8_t)ReportItem->Value;\r
+\r
+                       /* If scancode is non-zero, a key is being pressed */\r
+                       if (KeyCode)\r
+                       {\r
+                               /* Toggle status LED to indicate keypress */\r
+                               if (LEDs_GetLEDs() & LEDS_LED2)\r
+                                 LEDs_TurnOffLEDs(LEDS_LED2);\r
+                               else\r
+                                 LEDs_TurnOnLEDs(LEDS_LED2);\r
+\r
+                               char PressedKey = 0;\r
+\r
+                               /* Convert scancode to printable character if alphanumeric */\r
+                               if ((KeyCode >= 0x04) && (KeyCode <= 0x1D))\r
+                                 PressedKey = (KeyCode - 0x04) + 'A';\r
+                               else if ((KeyCode >= 0x1E) && (KeyCode <= 0x27))\r
+                                 PressedKey = (KeyCode - 0x1E) + '0';\r
+                               else if (KeyCode == 0x2C)\r
+                                 PressedKey = ' ';                                             \r
+                               else if (KeyCode == 0x28)\r
+                                 PressedKey = '\n';\r
+                                        \r
+                               /* Print the pressed key character out through the serial port if valid */\r
+                               if (PressedKey)\r
+                                 putchar(PressedKey);\r
+                       }\r
+                       \r
+                       /* Once a scancode is found, stop scanning through the report items */\r
+                       break;\r
+               }\r
+       }\r
+}\r