Fixed inability to enumerate any devices while in host mode (broken in a previous...
[pub/USBasp.git] / Demos / OTG / TestApp / TestApp.c
index a66a728..4dc9b44 100644 (file)
 \r
 #include "TestApp.h"\r
 \r
-/* Project Tags, for reading out using the ButtLoad project */\r
-BUTTLOADTAG(ProjName,    "LUFA Test App");\r
-BUTTLOADTAG(BuildTime,   __TIME__);\r
-BUTTLOADTAG(BuildDate,   __DATE__);\r
-BUTTLOADTAG(LUFAVersion, "LUFA V" LUFA_VERSION_STRING);\r
-\r
 /* Scheduler Task List */\r
 TASK_LIST\r
 {\r
-       { Task: TestApp_CheckJoystick, TaskStatus: TASK_RUN  },\r
-       { Task: TestApp_CheckHWB     , TaskStatus: TASK_RUN  },\r
-       { Task: TestApp_CheckTemp    , TaskStatus: TASK_RUN  },\r
-       { Task: USB_USBTask          , TaskStatus: TASK_RUN  },\r
+       { .Task = TestApp_CheckJoystick, .TaskStatus = TASK_RUN  },\r
+       { .Task = TestApp_CheckButton  , .TaskStatus = TASK_RUN  },\r
+       { .Task = TestApp_CheckTemp    , .TaskStatus = TASK_RUN  },\r
+       { .Task = USB_USBTask          , .TaskStatus = TASK_RUN  },\r
 };\r
 \r
 /** Main program entry point. This routine configures the hardware required by the application, then\r
@@ -69,7 +63,7 @@ int main(void)
        Temperature_Init();\r
        Joystick_Init();\r
        LEDs_Init();\r
-       HWB_Init();\r
+       Buttons_Init();\r
        \r
        /* Millisecond timer initialization, with output compare interrupt enabled */\r
        OCR0A  = 0x7D;\r
@@ -80,7 +74,7 @@ int main(void)
        /* Turn on interrupts */\r
        sei();\r
 \r
-    /* Startup message via USART */\r
+    /* Start-up message via USART */\r
        puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY\r
               "LUFA Demo running.\r\n" ESC_INVERSE_OFF));\r
 \r
@@ -130,30 +124,30 @@ TASK(TestApp_CheckJoystick)
  */\r
 TASK(TestApp_CheckTemp)\r
 {\r
-       static SchedulerDelayCounter_t DelayCounter = 10000; // Force immediate run on startup\r
+       static SchedulerDelayCounter_t DelayCounter = 10000; // Force immediate run on start-up\r
 \r
        /* Task runs every 10000 ticks, 10 seconds for this demo */\r
        if (Scheduler_HasDelayElapsed(10000, &DelayCounter))\r
        {\r
                printf_P(PSTR("Current temperature: %d Degrees Celcius\r\n\r\n"),\r
-                        (int)Temperature_GetTemperature());\r
+                        (int8_t)Temperature_GetTemperature());\r
 \r
                /* Reset the delay counter, ready to count another 10000 tick interval */\r
                Scheduler_ResetDelay(&DelayCounter);\r
        }       \r
 }\r
 \r
-/** Task responsible for checking the HWB button position, and start-stopping other tasks and the USB\r
+/** Task responsible for checking the board's first button' position, and start-stopping other tasks and the USB\r
  *  interface in response to user joystick movements.\r
  */\r
-TASK(TestApp_CheckHWB)\r
+TASK(TestApp_CheckButton)\r
 {\r
        static SchedulerDelayCounter_t DelayCounter = 0;\r
        static bool                    IsPressed;\r
        static bool                    BlockingJoystickTask;\r
        \r
-       /* Check if HWB pressed (start USB) */\r
-       if (HWB_GetStatus() == true)\r
+       /* Check if board button pressed (start USB) */\r
+       if (Buttons_GetStatus() & BUTTONS_BUTTON1)\r
        {\r
                /* Debounce - check 100 ticks later to see if button is still being pressed */\r
                if ((IsPressed == false) && (Scheduler_HasDelayElapsed(100, &DelayCounter)))\r
@@ -161,7 +155,7 @@ TASK(TestApp_CheckHWB)
                        /* Set flag, indicating that current pressed state has been handled */\r
                        IsPressed = true;\r
                        \r
-                       /* First start of the USB interface permenantly blocks the joystick task */\r
+                       /* First start of the USB interface permanently blocks the joystick task */\r
                        if (BlockingJoystickTask == false)\r
                        {\r
                                Scheduler_SetTaskMode(TestApp_CheckJoystick, TASK_STOP);\r
@@ -191,7 +185,7 @@ TASK(TestApp_CheckHWB)
        }\r
     else\r
     {\r
-               /* HWB not pressed - reset debounce interval counter and press handled flag */\r
+               /* Board button not pressed - reset debounce interval counter and press handled flag */\r
                Scheduler_ResetDelay(&DelayCounter);\r
                IsPressed = false;\r
        }\r