Production Test Program (PTP) for the LPC4088 Experiment Base Board

Dependencies:   EALib I2S LM75B SDFileSystem mbed

Committer:
embeddedartists
Date:
Thu Aug 28 09:36:13 2014 +0000
Revision:
2:2f4b7535ceb3
Parent:
1:47680ec5d783
Child:
3:7ef908e84ae1
Moved each test into separate classes.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 0:0d5190d379d3 1 /******************************************************************************
embeddedartists 0:0d5190d379d3 2 * Includes
embeddedartists 0:0d5190d379d3 3 *****************************************************************************/
embeddedartists 0:0d5190d379d3 4 #include "mbed.h"
embeddedartists 0:0d5190d379d3 5
embeddedartists 2:2f4b7535ceb3 6 #include "TestRGBLed.h"
embeddedartists 2:2f4b7535ceb3 7 #include "TestFileSystemMCI.h"
embeddedartists 2:2f4b7535ceb3 8 #include "TestFileSystemSPI.h"
embeddedartists 2:2f4b7535ceb3 9 #include "TestAcc.h"
embeddedartists 2:2f4b7535ceb3 10 #include "TestTemperature.h"
embeddedartists 2:2f4b7535ceb3 11 #include "TestTrimpot.h"
embeddedartists 2:2f4b7535ceb3 12 #include "TestJoystick.h"
embeddedartists 2:2f4b7535ceb3 13 #include "TestAudio.h"
embeddedartists 2:2f4b7535ceb3 14 #include "TestShiftreg.h"
embeddedartists 2:2f4b7535ceb3 15 #include "TestDisplay.h"
embeddedartists 0:0d5190d379d3 16
embeddedartists 0:0d5190d379d3 17 /******************************************************************************
embeddedartists 0:0d5190d379d3 18 * Typedefs and defines
embeddedartists 0:0d5190d379d3 19 *****************************************************************************/
embeddedartists 0:0d5190d379d3 20
embeddedartists 0:0d5190d379d3 21
embeddedartists 0:0d5190d379d3 22 /******************************************************************************
embeddedartists 0:0d5190d379d3 23 * Local variables
embeddedartists 0:0d5190d379d3 24 *****************************************************************************/
embeddedartists 0:0d5190d379d3 25
embeddedartists 0:0d5190d379d3 26 DigitalOut myled(LED1);
embeddedartists 0:0d5190d379d3 27
embeddedartists 0:0d5190d379d3 28 /******************************************************************************
embeddedartists 0:0d5190d379d3 29 * Local functions
embeddedartists 0:0d5190d379d3 30 *****************************************************************************/
embeddedartists 0:0d5190d379d3 31
embeddedartists 1:47680ec5d783 32
embeddedartists 1:47680ec5d783 33 static void setupSerial(int baudrate)
embeddedartists 1:47680ec5d783 34 {
embeddedartists 1:47680ec5d783 35 // This works because both the default serial (used by printf) and the s instance
embeddedartists 1:47680ec5d783 36 // (used by s.printf) would use the same underlying UART code so setting the baudrate
embeddedartists 1:47680ec5d783 37 // in one affects the other.
embeddedartists 1:47680ec5d783 38 Serial s(USBTX, USBRX);
embeddedartists 1:47680ec5d783 39 s.baud(baudrate);
embeddedartists 1:47680ec5d783 40 }
embeddedartists 1:47680ec5d783 41
embeddedartists 0:0d5190d379d3 42 int main() {
embeddedartists 1:47680ec5d783 43 setupSerial(115200);
embeddedartists 1:47680ec5d783 44 printf("\n"
embeddedartists 1:47680ec5d783 45 "---\n"
embeddedartists 1:47680ec5d783 46 "Production Test Program: LPC4088 Experiment Base Board\n"
embeddedartists 1:47680ec5d783 47 "Build Date: " __DATE__ " at " __TIME__ "\n"
embeddedartists 1:47680ec5d783 48 "\n");
embeddedartists 0:0d5190d379d3 49
embeddedartists 2:2f4b7535ceb3 50 // run all tests
embeddedartists 2:2f4b7535ceb3 51 int failed = 0;
embeddedartists 0:0d5190d379d3 52
embeddedartists 2:2f4b7535ceb3 53 TestRGBLed rgb;
embeddedartists 2:2f4b7535ceb3 54 TestFileSystemMCI mcifs;
embeddedartists 2:2f4b7535ceb3 55 TestAcc acc;
embeddedartists 2:2f4b7535ceb3 56 // TestFileSystemSPI spifs;
embeddedartists 2:2f4b7535ceb3 57 TestTemperature temp;
embeddedartists 2:2f4b7535ceb3 58 TestTrimpot trim;
embeddedartists 2:2f4b7535ceb3 59 TestJoystick joy;
embeddedartists 2:2f4b7535ceb3 60 TestAudio audio;
embeddedartists 2:2f4b7535ceb3 61 TestShiftreg shift;
embeddedartists 2:2f4b7535ceb3 62 TestDisplay display;
embeddedartists 2:2f4b7535ceb3 63
embeddedartists 2:2f4b7535ceb3 64 //startup flash behaviour
embeddedartists 2:2f4b7535ceb3 65 rgb.showStartupPattern();
embeddedartists 2:2f4b7535ceb3 66
embeddedartists 2:2f4b7535ceb3 67 if (!mcifs.runTest()) {
embeddedartists 2:2f4b7535ceb3 68 failed++;
embeddedartists 2:2f4b7535ceb3 69 }
embeddedartists 2:2f4b7535ceb3 70
embeddedartists 2:2f4b7535ceb3 71 // if (!spifs.runTest()) {
embeddedartists 2:2f4b7535ceb3 72 // failed++;
embeddedartists 2:2f4b7535ceb3 73 // }
embeddedartists 0:0d5190d379d3 74
embeddedartists 2:2f4b7535ceb3 75 if (!acc.runTest()) {
embeddedartists 2:2f4b7535ceb3 76 failed++;
embeddedartists 2:2f4b7535ceb3 77 }
embeddedartists 2:2f4b7535ceb3 78
embeddedartists 2:2f4b7535ceb3 79 if (!temp.runTest()) {
embeddedartists 2:2f4b7535ceb3 80 failed++;
embeddedartists 2:2f4b7535ceb3 81 }
embeddedartists 2:2f4b7535ceb3 82
embeddedartists 2:2f4b7535ceb3 83 if (!trim.runTest()) {
embeddedartists 2:2f4b7535ceb3 84 failed++;
embeddedartists 2:2f4b7535ceb3 85 }
embeddedartists 0:0d5190d379d3 86
embeddedartists 2:2f4b7535ceb3 87 if (!joy.runTest()) {
embeddedartists 2:2f4b7535ceb3 88 failed++;
embeddedartists 2:2f4b7535ceb3 89 }
embeddedartists 2:2f4b7535ceb3 90
embeddedartists 2:2f4b7535ceb3 91 if (!rgb.runTest()) {
embeddedartists 2:2f4b7535ceb3 92 failed++;
embeddedartists 2:2f4b7535ceb3 93 }
embeddedartists 2:2f4b7535ceb3 94
embeddedartists 2:2f4b7535ceb3 95 if (!audio.runTest()) {
embeddedartists 2:2f4b7535ceb3 96 failed++;
embeddedartists 2:2f4b7535ceb3 97 }
embeddedartists 1:47680ec5d783 98
embeddedartists 2:2f4b7535ceb3 99 if (!display.runTest()) {
embeddedartists 2:2f4b7535ceb3 100 failed++;
embeddedartists 2:2f4b7535ceb3 101 }
embeddedartists 2:2f4b7535ceb3 102
embeddedartists 2:2f4b7535ceb3 103 if (failed == 0) {
embeddedartists 2:2f4b7535ceb3 104 printf("\n\n---\nTest PASSED\n\n");
embeddedartists 2:2f4b7535ceb3 105 printf("NOTE: The display as well as the shift register LEDs\n"
embeddedartists 2:2f4b7535ceb3 106 " must be manually checked as well\n\n");
embeddedartists 2:2f4b7535ceb3 107 } else {
embeddedartists 2:2f4b7535ceb3 108 printf("\n\n---\nTest FAILED (%d failed parts)\n\n", failed);
embeddedartists 2:2f4b7535ceb3 109 }
embeddedartists 2:2f4b7535ceb3 110 rgb.showStatus(failed == 0);
embeddedartists 2:2f4b7535ceb3 111 display.showStatus(failed == 0);
embeddedartists 0:0d5190d379d3 112
embeddedartists 0:0d5190d379d3 113 while(1) {
embeddedartists 2:2f4b7535ceb3 114 shift.runTest();
embeddedartists 0:0d5190d379d3 115 myled = 1;
embeddedartists 0:0d5190d379d3 116 wait(0.2);
embeddedartists 0:0d5190d379d3 117 myled = 0;
embeddedartists 0:0d5190d379d3 118 wait(0.2);
embeddedartists 0:0d5190d379d3 119 }
embeddedartists 0:0d5190d379d3 120 }