Production Test Program (PTP) for the LPC4088 Experiment Base Board
Dependencies: EALib I2S LM75B SDFileSystem mbed
main.cpp
00001 /****************************************************************************** 00002 * Includes 00003 *****************************************************************************/ 00004 #include "mbed.h" 00005 00006 #include "TestRGBLed.h" 00007 #include "TestFileSystemMCI.h" 00008 #include "TestFileSystemSPI.h" 00009 #include "TestAcc.h" 00010 #include "TestTemperature.h" 00011 #include "TestTrimpot.h" 00012 #include "TestJoystick.h" 00013 #include "TestAudio.h" 00014 #include "TestShiftreg.h" 00015 #include "TestDisplay.h" 00016 00017 /****************************************************************************** 00018 * Typedefs and defines 00019 *****************************************************************************/ 00020 00021 00022 /****************************************************************************** 00023 * Local variables 00024 *****************************************************************************/ 00025 00026 DigitalOut myled(LED1); 00027 00028 /****************************************************************************** 00029 * Local functions 00030 *****************************************************************************/ 00031 00032 00033 static void setupSerial(int baudrate) 00034 { 00035 // This works because both the default serial (used by printf) and the s instance 00036 // (used by s.printf) would use the same underlying UART code so setting the baudrate 00037 // in one affects the other. 00038 Serial s(USBTX, USBRX); 00039 s.baud(baudrate); 00040 } 00041 00042 int main() { 00043 setupSerial(115200); 00044 printf("\n" 00045 "---\n" 00046 "Production Test Program: LPC4088 Experiment Base Board\n" 00047 "Build Date: " __DATE__ " at " __TIME__ "\n" 00048 "\n"); 00049 00050 // run all tests 00051 int failed = 0; 00052 00053 TestRGBLed rgb; 00054 TestFileSystemMCI mcifs; 00055 TestAcc acc; 00056 // TestFileSystemSPI spifs; 00057 TestTemperature temp; 00058 TestTrimpot trim; 00059 TestJoystick joy; 00060 TestShiftreg shift; 00061 TestDisplay display; 00062 TestAudio audio; 00063 00064 /* NOTE: Audio must be initialized AFTER the display as they both reference the same pins 00065 (P0_4, P0_5, P0_6, P0_7, P0_8, P0_9). However the display only uses those pins 00066 for 24-bit color depth and we only use 16-bit in this demo. */ 00067 00068 //startup flash behaviour 00069 rgb.showStartupPattern(); 00070 00071 if (!mcifs.runTest()) { 00072 failed++; 00073 } 00074 00075 // if (!spifs.runTest()) { 00076 // failed++; 00077 // } 00078 00079 if (!acc.runTest()) { 00080 failed++; 00081 } 00082 00083 if (!temp.runTest()) { 00084 failed++; 00085 } 00086 00087 if (!trim.runTest()) { 00088 failed++; 00089 } 00090 00091 if (!joy.runTest()) { 00092 failed++; 00093 } 00094 00095 if (!rgb.runTest()) { 00096 failed++; 00097 } 00098 00099 if (!audio.runTest()) { 00100 failed++; 00101 } 00102 00103 if (!display.runTest()) { 00104 failed++; 00105 } 00106 00107 if (failed == 0) { 00108 printf("\n\n---\nTest PASSED\n\n"); 00109 printf("NOTE: The display as well as the shift register LEDs\n" 00110 " must be manually checked as well\n\n"); 00111 } else { 00112 printf("\n\n---\nTest FAILED (%d failed parts)\n\n", failed); 00113 } 00114 rgb.showStatus(failed == 0); 00115 display.showStatus(failed == 0); 00116 00117 while(1) { 00118 shift.runTest(); 00119 myled = 1; 00120 wait(0.2); 00121 myled = 0; 00122 wait(0.2); 00123 } 00124 }
Generated on Sun Jul 17 2022 08:29:10 by 1.7.2