Add missing function parameter to the new HID_Host_SetIdlePeriod() function.
[pub/USBasp.git] / Demos / Host / LowLevel / KeyboardHostWithParser / KeyboardHostWithParser.c
index 356aba8..ac70900 100644 (file)
@@ -66,9 +66,12 @@ void SetupHardware(void)
        clock_prescale_set(clock_div_1);
 
        /* Hardware Initialization */
-       SerialStream_Init(9600, false);
+       Serial_Init(9600, false);
        LEDs_Init();
        USB_Init();
+
+       /* Create a stdio stream for the serial port for stdin and stdout */
+       Serial_CreateStream(NULL);
 }
 
 /** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
@@ -100,7 +103,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void)
 /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
 void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
 {
-       USB_ShutDown();
+       USB_Disable();
 
        printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"
                                 " -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);
@@ -188,24 +191,6 @@ void Keyboard_HID_Task(void)
                                break;
                        }
 
-                       printf("Total Reports: %d\r\n", HIDReportInfo.TotalDeviceReports);
-
-                       for (uint8_t i = 0; i < HIDReportInfo.TotalDeviceReports; i++)
-                       {
-                               HID_ReportSizeInfo_t* CurrReportIDInfo = &HIDReportInfo.ReportIDSizes[i];
-
-                               uint8_t ReportSizeInBits      = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_In];
-                               uint8_t ReportSizeOutBits     = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Out];
-                               uint8_t ReportSizeFeatureBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Feature];
-
-                               /* Print out the byte sizes of each report within the device */
-                               printf_P(PSTR("  + Report ID %d - In: %d bytes, Out: %d bytes, Feature: %d bytes\r\n"),
-                                        CurrReportIDInfo->ReportID,
-                                        ((ReportSizeInBits      >> 3) + ((ReportSizeInBits      & 0x07) != 0)),
-                                        ((ReportSizeOutBits     >> 3) + ((ReportSizeOutBits     & 0x07) != 0)),
-                                        ((ReportSizeFeatureBits >> 3) + ((ReportSizeFeatureBits & 0x07) != 0)));
-                       }
-
                        puts_P(PSTR("Keyboard Enumerated.\r\n"));
 
                        USB_HostState = HOST_STATE_Configured;
@@ -284,9 +269,13 @@ void ProcessKeyboardReport(uint8_t* KeyboardReport)
                                        PressedKey = (KeyCode - HID_KEYBOARD_SC_A) + 'A';
                                }
                                else if ((KeyCode >= HID_KEYBOARD_SC_1_AND_EXCLAMATION) &
-                                                (KeyCode <= HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS))
+                                                (KeyCode  < HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS))
+                               {
+                                       PressedKey = (KeyCode - HID_KEYBOARD_SC_1_AND_EXCLAMATION) + '1';
+                               }
+                               else if (KeyCode == HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS)
                                {
-                                       PressedKey = (KeyCode - HID_KEYBOARD_SC_1_AND_EXCLAMATION) + '0';
+                                       PressedKey = '0';                                               
                                }
                                else if (KeyCode == HID_KEYBOARD_SC_SPACE)
                                {