UART test for the CORE-1000
Dependencies: mbed
main.cpp@0:7c5a7244a344, 2019-01-09 (annotated)
- Committer:
- odb
- Date:
- Wed Jan 09 04:23:27 2019 +0000
- Revision:
- 0:7c5a7244a344
UART test for the CORE-1000
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
odb | 0:7c5a7244a344 | 1 | #include <mbed.h> |
odb | 0:7c5a7244a344 | 2 | |
odb | 0:7c5a7244a344 | 3 | |
odb | 0:7c5a7244a344 | 4 | //const char hometown[15] = "Coreone tech"; |
odb | 0:7c5a7244a344 | 5 | //const char banner[37] = "Serial Communication Test"; |
odb | 0:7c5a7244a344 | 6 | const char PROMPT = '>'; |
odb | 0:7c5a7244a344 | 7 | DigitalOut myled(LED1); |
odb | 0:7c5a7244a344 | 8 | //Serial pc(USBTX, USBRX); // tx, rx |
odb | 0:7c5a7244a344 | 9 | Serial pc(PA_11, PA_12); // tx, rx |
odb | 0:7c5a7244a344 | 10 | int main() { |
odb | 0:7c5a7244a344 | 11 | pc.baud(115200); |
odb | 0:7c5a7244a344 | 12 | // displayBanner(); |
odb | 0:7c5a7244a344 | 13 | // newline(); |
odb | 0:7c5a7244a344 | 14 | pc.putc(PROMPT); |
odb | 0:7c5a7244a344 | 15 | while(1) |
odb | 0:7c5a7244a344 | 16 | { |
odb | 0:7c5a7244a344 | 17 | if(pc.readable()) |
odb | 0:7c5a7244a344 | 18 | { |
odb | 0:7c5a7244a344 | 19 | |
odb | 0:7c5a7244a344 | 20 | char c = pc.getc(); |
odb | 0:7c5a7244a344 | 21 | printf("%c\n\r", c); |
odb | 0:7c5a7244a344 | 22 | myled = !myled; |
odb | 0:7c5a7244a344 | 23 | } |
odb | 0:7c5a7244a344 | 24 | pc.printf("test\n\r"); |
odb | 0:7c5a7244a344 | 25 | } |
odb | 0:7c5a7244a344 | 26 | } |