Rtos API example

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_tx_auto);
00009     MBED_HOSTTEST_DESCRIPTION(Serial NC TX);
00010     MBED_HOSTTEST_START("MBED_38");
00011 
00012     // Wait until we receive start signal from host test
00013     char c = pc->getc();
00014     delete pc;
00015 
00016     // If signal is correct, start the test
00017     if (c == 'S') {
00018       Serial *pc = new Serial(USBTX, NC);
00019       pc->printf("TX OK - Expected\r\n");
00020       wait(0.5);  // wait for characters to finish transmitting
00021 
00022       delete pc;
00023 
00024       pc = new Serial(NC, USBRX);
00025       pc->printf("TX OK - Unexpected\r\n");
00026       wait(0.5);  // wait for characters to finish transmitting
00027       delete pc;
00028     }
00029 
00030     while (1) {
00031     }
00032 }