dhgdh

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by joey shelton

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "test_env.h"
00003 
00004 int main() {
00005     Serial *pc = new Serial(USBTX, USBRX);
00006 
00007     MBED_HOSTTEST_TIMEOUT(20);
00008     MBED_HOSTTEST_SELECT(serial_nc_rx_auto);
00009     MBED_HOSTTEST_DESCRIPTION(Serial NC RX);
00010     MBED_HOSTTEST_START("MBED_37");
00011 
00012     char c = pc->getc();
00013 
00014 
00015     // This should be true, sync the start of test
00016     if (c == 'S') {
00017         pc->printf("RX OK - Start NC test\r\n");
00018 
00019         // disconnect TX and  get char
00020         delete pc;
00021         pc = new Serial(NC, USBRX);
00022         c = pc->getc();
00023         if (c == 'E') {
00024             // ok disconnect Rx and answer to host
00025             delete pc;
00026             pc = new Serial(USBTX, NC);
00027             pc->printf("RX OK - Expected\r\n");
00028 
00029             c = pc->getc();
00030             // This should be false/not get here
00031             if (c == 'U') {
00032                 pc->printf("RX OK - Unexpected\r\n");
00033             }
00034         }
00035         delete pc;
00036     }
00037 
00038     while (1) {
00039     }
00040 }