/* --------------------------------------------------------------------------- * testLED.c (c) 2008 Micro-key bv * --------------------------------------------------------------------------- * Micro-key bv * Industrieweg 28, 9804 TG Noordhorn * Postbus 92, 9800 AB Zuidhorn * The Netherlands * Tel: +31 594 503020 * Fax: +31 594 505825 * Email: support@microkey.nl * Web: www.microkey.nl * --------------------------------------------------------------------------- * Description: * --------------------------------------------------------------------------- * Version(s): 0.1, Mei 16, 2008, MMi * Creation. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * System include files * --------------------------------------------------------------------------- */ #include "LPC23xx.h" #include "types.h" /* FreeRTOS includes */ #include "FreeRTOS.h" #include "task.h" /* --------------------------------------------------------------------------- * Application include files * --------------------------------------------------------------------------- */ #include "testLED.h" #include "serial.h" #include "SerOut.h" #include "dio.h" #include "leds.h" #include "taskfunctions.h" #include "ledfunctions.h" /* --------------------------------------------------------------------------- * Local constant and macro definitions * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Global variable definitions * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Local variable definitions * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Local function definitions * --------------------------------------------------------------------------- */ BOOLEAN testledStart (void) { BOOLEAN testledResult = FALSE; testledResult = doledTest (); return (testledResult); } BOOLEAN doledTest (void) { UINT8 buffer; UINT8 captureDio; BOOLEAN ledTest = TRUE; BOOLEAN receive = FALSE; captureDio = dioCapture(); /* Set all DIOs to HIGH */ dioWrite (0, 0, TRUE); dioWrite (0, 1, TRUE); dioWrite (0, 2, TRUE); dioWrite (0, 3, TRUE); dioWrite (0, 4, TRUE); dioWrite (0, 5, TRUE); dioWrite (0, 6, TRUE); dioWrite (0, 7, TRUE); ledSet (LED0, 1); /* Set RED Status LED to HIGH */ if (d_gLED == pdPASS) /* Check for existing LED Task */ { vTaskSuspend (gLED); /* Suspend existing Task */ } ledSet (LED1, 1); /* Set GREEN Status LED to HIGH */ FIO0DIR |= (1 << 13); /* Set USB_LED PIN as GP Output */ FIO0CLR1 |= (1 << 5); /* Drive USB_LED PIN to ZERO */ sendString (SerOutPort, TRUE, noteMessage, "\tAre all LEDs turned on? ", "\n\r\tPRESS y (YES) oder n (NO): ", NewLine); do /* do-while loop for String input */ { receive = serGet(SerOutPort, &buffer); } while ((buffer != 121) && (buffer != 110)); if (buffer == 121) /* 121 = y (ScanCode) */ { ledTest = TRUE; } else if (buffer == 110) /* 110 = n (ScanCode) */ { ledTest = FALSE; } vTaskResume (gLED); /* Resume ActiveLED Task */ FIO0SET1 |= (1 << 5); /* Drive USB_LED PIN to HIGH */ dioResume(captureDio); return (ledTest); }