mbed os with nrf51 internal bandgap enabled to read battery level
Dependents: BLE_file_test BLE_Blink ExternalEncoder
features/unsupported/tests/mbed/echo/main.cpp@0:f269e3021894, 2016-10-23 (annotated)
- Committer:
- elessair
- Date:
- Sun Oct 23 15:10:02 2016 +0000
- Revision:
- 0:f269e3021894
Initial commit
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 | } |