Chris Styles
/
mbedISP
main.cpp@0:3ce7085022d1, 2009-11-26 (annotated)
- Committer:
- chris
- Date:
- Thu Nov 26 10:14:48 2009 +0000
- Revision:
- 0:3ce7085022d1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:3ce7085022d1 | 1 | #include "mbed.h" |
chris | 0:3ce7085022d1 | 2 | |
chris | 0:3ce7085022d1 | 3 | DigitalOut led1(LED1); |
chris | 0:3ce7085022d1 | 4 | DigitalOut led2(LED2); |
chris | 0:3ce7085022d1 | 5 | |
chris | 0:3ce7085022d1 | 6 | Serial pc (USBTX,USBRX); |
chris | 0:3ce7085022d1 | 7 | Serial target (p28,p27); |
chris | 0:3ce7085022d1 | 8 | |
chris | 0:3ce7085022d1 | 9 | int main() { |
chris | 0:3ce7085022d1 | 10 | |
chris | 0:3ce7085022d1 | 11 | pc.baud(115200); |
chris | 0:3ce7085022d1 | 12 | target.baud(115200); |
chris | 0:3ce7085022d1 | 13 | |
chris | 0:3ce7085022d1 | 14 | while (1) { |
chris | 0:3ce7085022d1 | 15 | |
chris | 0:3ce7085022d1 | 16 | if (pc.readable()) { |
chris | 0:3ce7085022d1 | 17 | target.putc(pc.getc()); |
chris | 0:3ce7085022d1 | 18 | led1 = !led1; |
chris | 0:3ce7085022d1 | 19 | } |
chris | 0:3ce7085022d1 | 20 | |
chris | 0:3ce7085022d1 | 21 | if (target.readable()) { |
chris | 0:3ce7085022d1 | 22 | pc.putc(target.getc()); |
chris | 0:3ce7085022d1 | 23 | led2 = !led2; |
chris | 0:3ce7085022d1 | 24 | } |
chris | 0:3ce7085022d1 | 25 | } |
chris | 0:3ce7085022d1 | 26 | } |
chris | 0:3ce7085022d1 | 27 |