X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/7665bf323e76ed1ebcfd137e2ab0bd356b43a5e8..31d8ebebc0796873f7c70db80a04acdcbb307ed8:/Demos/OTG/TestApp/TestApp.c diff --git a/Demos/OTG/TestApp/TestApp.c b/Demos/OTG/TestApp/TestApp.c index dc10aadfc..562348bf8 100644 --- a/Demos/OTG/TestApp/TestApp.c +++ b/Demos/OTG/TestApp/TestApp.c @@ -43,8 +43,7 @@ int main(void) { SetupHardware(); - puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY - "LUFA Demo running.\r\n" ESC_INVERSE_OFF)); + puts_P(PSTR(ESC_FG_CYAN "LUFA Demo running.\r\n" ESC_FG_WHITE)); for (;;) { @@ -52,7 +51,7 @@ int main(void) CheckButton(); CheckTemperature(); - /* Clear output-compare flag (logic 1 clears the flag) */ + /* Clear millisecond timer's Output Compare flag (logic 1 clears the flag) */ TIFR0 |= (1 << OCF0A); USB_USBTask(); @@ -115,11 +114,12 @@ void CheckTemperature(void) { static uint16_t MSElapsed = 0; + /* Timer 0's compare flag is set every millisecond */ if (TIFR0 & (1 << OCF0A)) MSElapsed++; /* Task runs every 10000 ticks, 10 seconds for this demo */ - if (MSElapsed == 1000) + if (MSElapsed == 10000) { printf_P(PSTR("Current temperature: %d Degrees Celcius\r\n\r\n"), (int8_t)Temperature_GetTemperature()); @@ -136,6 +136,7 @@ void CheckButton(void) static uint16_t DebounceMSElapsed = 0; static bool IsPressed; + /* Timer 0's compare flag is set every millisecond */ if (TIFR0 & (1 << OCF0A)) DebounceMSElapsed++; @@ -148,11 +149,11 @@ void CheckButton(void) if (USB_IsInitialized == true) { USB_ShutDown(); - puts_P(PSTR(ESC_BG_WHITE "USB Power Off.\r\n")); + puts_P(PSTR(ESC_FG_YELLOW "USB Power Off.\r\n" ESC_FG_WHITE)); } else { - puts_P(PSTR(ESC_BG_YELLOW "USB Power On.\r\n")); + puts_P(PSTR(ESC_FG_YELLOW "USB Power On.\r\n" ESC_FG_WHITE)); USB_Init(USB_MODE_UID, USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL); } }