Preliminary main mbed library for nexpaq development
libraries/tests/mbed/echo/main.cpp@0:6c56fb4bc5f0, 2016-11-04 (annotated)
- Committer:
- nexpaq
- Date:
- Fri Nov 04 20:27:58 2016 +0000
- Revision:
- 0:6c56fb4bc5f0
Moving to library for sharing updates
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nexpaq | 0:6c56fb4bc5f0 | 1 | #include "mbed.h" |
nexpaq | 0:6c56fb4bc5f0 | 2 | #include "test_env.h" |
nexpaq | 0:6c56fb4bc5f0 | 3 | |
nexpaq | 0:6c56fb4bc5f0 | 4 | #define TXPIN USBTX |
nexpaq | 0:6c56fb4bc5f0 | 5 | #define RXPIN USBRX |
nexpaq | 0:6c56fb4bc5f0 | 6 | |
nexpaq | 0:6c56fb4bc5f0 | 7 | |
nexpaq | 0:6c56fb4bc5f0 | 8 | namespace { |
nexpaq | 0:6c56fb4bc5f0 | 9 | const int BUFFER_SIZE = 48; |
nexpaq | 0:6c56fb4bc5f0 | 10 | char buffer[BUFFER_SIZE] = {0}; |
nexpaq | 0:6c56fb4bc5f0 | 11 | } |
nexpaq | 0:6c56fb4bc5f0 | 12 | |
nexpaq | 0:6c56fb4bc5f0 | 13 | int main() { |
nexpaq | 0:6c56fb4bc5f0 | 14 | MBED_HOSTTEST_TIMEOUT(20); |
nexpaq | 0:6c56fb4bc5f0 | 15 | MBED_HOSTTEST_SELECT(echo); |
nexpaq | 0:6c56fb4bc5f0 | 16 | MBED_HOSTTEST_DESCRIPTION(Serial Echo at 115200); |
nexpaq | 0:6c56fb4bc5f0 | 17 | MBED_HOSTTEST_START("MBED_A9"); |
nexpaq | 0:6c56fb4bc5f0 | 18 | |
nexpaq | 0:6c56fb4bc5f0 | 19 | Serial pc(TXPIN, RXPIN); |
nexpaq | 0:6c56fb4bc5f0 | 20 | pc.baud(115200); |
nexpaq | 0:6c56fb4bc5f0 | 21 | |
nexpaq | 0:6c56fb4bc5f0 | 22 | while (1) { |
nexpaq | 0:6c56fb4bc5f0 | 23 | pc.gets(buffer, BUFFER_SIZE - 1); |
nexpaq | 0:6c56fb4bc5f0 | 24 | pc.printf("%s", buffer); |
nexpaq | 0:6c56fb4bc5f0 | 25 | } |
nexpaq | 0:6c56fb4bc5f0 | 26 | } |