tempcommit 13/05

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers uartPassThrough.cpp Source File

uartPassThrough.cpp

00001 #include "mbed.h"
00002  
00003 RawSerial  pc1(USBTX, USBRX);
00004 RawSerial  dev(D1, D0);
00005 DigitalOut CS(D10);
00006  
00007 void dev_recv()
00008 {
00009     while(dev.readable()) {
00010         pc1.putc(dev.getc());
00011     }
00012 }
00013  
00014 void pc_recv()
00015 {
00016     while(pc1.readable()) {
00017         dev.putc(pc1.getc());
00018     }
00019 }
00020  
00021 int mai()
00022 {
00023     CS=1;
00024     pc1.baud(9600);
00025     dev.baud(9600);
00026  
00027     while(1) {
00028         pc_recv();
00029         dev_recv();
00030     }
00031 }