mbed-os

Fork of mbed-os by erkin yucel

features/unsupported/tests/mbed/echo/main.cpp

Committer:
elessair
Date:
2016-10-23
Revision:
0:f269e3021894

File content as of revision 0:f269e3021894:

#include "mbed.h"
#include "test_env.h"

#define TXPIN     USBTX
#define RXPIN     USBRX


namespace {
    const int BUFFER_SIZE = 48;
    char buffer[BUFFER_SIZE] = {0};
}

int main() {
    MBED_HOSTTEST_TIMEOUT(20);
    MBED_HOSTTEST_SELECT(echo);
    MBED_HOSTTEST_DESCRIPTION(Serial Echo at 115200);
    MBED_HOSTTEST_START("MBED_A9");

    Serial pc(TXPIN, RXPIN);
    pc.baud(115200);

    while (1) {
        pc.gets(buffer, BUFFER_SIZE - 1);
        pc.printf("%s", buffer);
    }
}