Latest mbed source. 2015-10-19
main.cpp@0:18ea5db32501, 2015-02-12 (annotated)
- Committer:
- mfiore
- Date:
- Thu Feb 12 13:38:55 2015 +0000
- Revision:
- 0:18ea5db32501
- Child:
- 1:8944a6b71daf
initial commit. passthrough between USB debug port and external serial port at 230400 baud
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mfiore | 0:18ea5db32501 | 1 | #include "mbed.h" |
mfiore | 0:18ea5db32501 | 2 | |
mfiore | 0:18ea5db32501 | 3 | int main() { |
mfiore | 0:18ea5db32501 | 4 | // USB debug port |
mfiore | 0:18ea5db32501 | 5 | Serial usb(USBTX, USBRX); |
mfiore | 0:18ea5db32501 | 6 | // external serial port |
mfiore | 0:18ea5db32501 | 7 | Serial ext(PA_2, PA_3); |
mfiore | 0:18ea5db32501 | 8 | |
mfiore | 0:18ea5db32501 | 9 | usb.baud(230400); |
mfiore | 0:18ea5db32501 | 10 | ext.baud(230400); |
mfiore | 0:18ea5db32501 | 11 | |
mfiore | 0:18ea5db32501 | 12 | while (true) { |
mfiore | 0:18ea5db32501 | 13 | if (usb.readable()) |
mfiore | 0:18ea5db32501 | 14 | ext.putc(usb.getc()); |
mfiore | 0:18ea5db32501 | 15 | if (ext.readable()) |
mfiore | 0:18ea5db32501 | 16 | usb.putc(ext.getc()); |
mfiore | 0:18ea5db32501 | 17 | } |
mfiore | 0:18ea5db32501 | 18 | } |