Remove serial driver use from the AVRISP project now that it is no longer needed.
[pub/USBasp.git] / Demos / Host / LowLevel / KeyboardHost / KeyboardHost.c
index f40e7b9..1d8a06e 100644 (file)
@@ -37,7 +37,7 @@
 #include "KeyboardHost.h"\r
 \r
 /** Main program entry point. This routine configures the hardware required by the application, then\r
- *  starts the scheduler to run the application tasks.\r
+ *  enters a loop to run the application tasks in sequence.\r
  */\r
 int main(void)\r
 {\r
@@ -101,8 +101,8 @@ void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
 {\r
        USB_ShutDown();\r
 \r
-       puts_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"));\r
-       printf_P(PSTR(" -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);\r
+       printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"\r
+                                " -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);\r
 \r
        LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
        for(;;);\r
@@ -113,10 +113,10 @@ void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
  */\r
 void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
 {\r
-       puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));\r
-       printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);\r
-       printf_P(PSTR(" -- Sub Error Code %d\r\n"), SubErrorCode);\r
-       printf_P(PSTR(" -- In State %d\r\n" ESC_FG_WHITE), USB_HostState);\r
+       printf_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"\r
+                                " -- Error Code %d\r\n"\r
+                                " -- Sub Error Code %d\r\n"\r
+                                " -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);\r
 \r
        LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
@@ -161,13 +161,13 @@ void ReadNextReport(void)
                        char PressedKey = 0;\r
 \r
                        /* Retrieve pressed key character if alphanumeric */\r
-                       if ((KeyboardReport.KeyCode >= 0x04) && (KeyboardReport.KeyCode <= 0x1D))\r
-                         PressedKey = (KeyboardReport.KeyCode - 0x04) + 'A';\r
-                       else if ((KeyboardReport.KeyCode >= 0x1E) && (KeyboardReport.KeyCode <= 0x27))\r
-                         PressedKey = (KeyboardReport.KeyCode - 0x1E) + '0';\r
-                       else if (KeyboardReport.KeyCode == 0x2C)\r
+                       if ((KeyboardReport.KeyCode[0] >= 0x04) && (KeyboardReport.KeyCode[0] <= 0x1D))\r
+                         PressedKey = (KeyboardReport.KeyCode[0] - 0x04) + 'A';\r
+                       else if ((KeyboardReport.KeyCode[0] >= 0x1E) && (KeyboardReport.KeyCode[0] <= 0x27))\r
+                         PressedKey = (KeyboardReport.KeyCode[0] - 0x1E) + '0';\r
+                       else if (KeyboardReport.KeyCode[0] == 0x2C)\r
                          PressedKey = ' ';                                             \r
-                       else if (KeyboardReport.KeyCode == 0x28)\r
+                       else if (KeyboardReport.KeyCode[0] == 0x28)\r
                          PressedKey = '\n';\r
                                 \r
                        /* Print the pressed key character out through the serial port if valid */\r
@@ -216,8 +216,8 @@ void Keyboard_HID_Task(void)
                        /* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */\r
                        if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)\r
                        {\r
-                               puts_P(PSTR(ESC_FG_RED "Control Error (Set Configuration).\r\n"));\r
-                               printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
+                               printf_P(PSTR(ESC_FG_RED "Control Error (Set Configuration).\r\n"\r
+                                                        " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
 \r
                                /* Indicate error status */\r
                                LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
@@ -243,8 +243,8 @@ void Keyboard_HID_Task(void)
                        /* Send the request, display error and wait for device detach if request fails */\r
                        if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
                        {\r
-                               puts_P(PSTR(ESC_FG_RED "Control Error (Set Protocol).\r\n"));\r
-                               printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
+                               printf_P(PSTR(ESC_FG_RED "Control Error (Set Protocol).\r\n"\r
+                                                        " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
 \r
                                /* Indicate error status */\r
                                LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r