mbed-os
Fork of mbed-os by
features/unsupported/tests/mbed/echo/main.cpp@1:3deb71413561, 2017-07-20 (annotated)
- Committer:
- xuaner
- Date:
- Thu Jul 20 14:26:57 2017 +0000
- Revision:
- 1:3deb71413561
- Parent:
- 0:f269e3021894
mbed_os
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
elessair | 0:f269e3021894 | 1 | #include "mbed.h" |
elessair | 0:f269e3021894 | 2 | #include "test_env.h" |
elessair | 0:f269e3021894 | 3 | |
elessair | 0:f269e3021894 | 4 | #define TXPIN USBTX |
elessair | 0:f269e3021894 | 5 | #define RXPIN USBRX |
elessair | 0:f269e3021894 | 6 | |
elessair | 0:f269e3021894 | 7 | |
elessair | 0:f269e3021894 | 8 | namespace { |
elessair | 0:f269e3021894 | 9 | const int BUFFER_SIZE = 48; |
elessair | 0:f269e3021894 | 10 | char buffer[BUFFER_SIZE] = {0}; |
elessair | 0:f269e3021894 | 11 | } |
elessair | 0:f269e3021894 | 12 | |
elessair | 0:f269e3021894 | 13 | int main() { |
elessair | 0:f269e3021894 | 14 | MBED_HOSTTEST_TIMEOUT(20); |
elessair | 0:f269e3021894 | 15 | MBED_HOSTTEST_SELECT(echo); |
elessair | 0:f269e3021894 | 16 | MBED_HOSTTEST_DESCRIPTION(Serial Echo at 115200); |
elessair | 0:f269e3021894 | 17 | MBED_HOSTTEST_START("MBED_A9"); |
elessair | 0:f269e3021894 | 18 | |
elessair | 0:f269e3021894 | 19 | Serial pc(TXPIN, RXPIN); |
elessair | 0:f269e3021894 | 20 | pc.baud(115200); |
elessair | 0:f269e3021894 | 21 | |
elessair | 0:f269e3021894 | 22 | while (1) { |
elessair | 0:f269e3021894 | 23 | pc.gets(buffer, BUFFER_SIZE - 1); |
elessair | 0:f269e3021894 | 24 | pc.printf("%s", buffer); |
elessair | 0:f269e3021894 | 25 | } |
elessair | 0:f269e3021894 | 26 | } |