project to demonstrate a problem with K64F serial
Dependencies: EthernetInterface WebSocketClient mbed-rtos mbed
main.cpp@0:07c16f3f860a, 2014-06-22 (annotated)
- Committer:
- emh203
- Date:
- Sun Jun 22 20:04:24 2014 +0000
- Revision:
- 0:07c16f3f860a
1st commit to demonstrate a problem
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emh203 | 0:07c16f3f860a | 1 | #include "mbed.h" |
emh203 | 0:07c16f3f860a | 2 | |
emh203 | 0:07c16f3f860a | 3 | DigitalOut myled(LED_GREEN); |
emh203 | 0:07c16f3f860a | 4 | Serial pc(USBTX, USBRX); |
emh203 | 0:07c16f3f860a | 5 | |
emh203 | 0:07c16f3f860a | 6 | |
emh203 | 0:07c16f3f860a | 7 | void SerialPC_RxIRQ() |
emh203 | 0:07c16f3f860a | 8 | { |
emh203 | 0:07c16f3f860a | 9 | while(pc.readable()) |
emh203 | 0:07c16f3f860a | 10 | { |
emh203 | 0:07c16f3f860a | 11 | |
emh203 | 0:07c16f3f860a | 12 | pc.putc(pc.getc()); |
emh203 | 0:07c16f3f860a | 13 | |
emh203 | 0:07c16f3f860a | 14 | } |
emh203 | 0:07c16f3f860a | 15 | } |
emh203 | 0:07c16f3f860a | 16 | |
emh203 | 0:07c16f3f860a | 17 | int main() |
emh203 | 0:07c16f3f860a | 18 | { |
emh203 | 0:07c16f3f860a | 19 | int i = 0; |
emh203 | 0:07c16f3f860a | 20 | pc.printf("\nHello World!\n"); |
emh203 | 0:07c16f3f860a | 21 | |
emh203 | 0:07c16f3f860a | 22 | // pc.attach(&SerialPC_RxIRQ ,pc.RxIrq); |
emh203 | 0:07c16f3f860a | 23 | |
emh203 | 0:07c16f3f860a | 24 | |
emh203 | 0:07c16f3f860a | 25 | while (true) { |
emh203 | 0:07c16f3f860a | 26 | |
emh203 | 0:07c16f3f860a | 27 | if(pc.readable()) |
emh203 | 0:07c16f3f860a | 28 | { |
emh203 | 0:07c16f3f860a | 29 | pc.putc(pc.getc()); |
emh203 | 0:07c16f3f860a | 30 | } |
emh203 | 0:07c16f3f860a | 31 | |
emh203 | 0:07c16f3f860a | 32 | myled = !myled; |
emh203 | 0:07c16f3f860a | 33 | } |
emh203 | 0:07c16f3f860a | 34 | } |
emh203 | 0:07c16f3f860a | 35 | |
emh203 | 0:07c16f3f860a | 36 |