Simple program to echo serial commands between debug uart and Skywire Modem

Dependencies:   mbed

Committer:
kholland
Date:
Tue Jan 20 20:08:49 2015 +0000
Revision:
0:b7473c389910
Child:
1:bbc6c30d55e2
Simple program to echo serial commands between the debug serial and Skywire modem

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kholland 0:b7473c389910 1 #include "mbed.h"
kholland 0:b7473c389910 2
kholland 0:b7473c389910 3 //------------------------------------
kholland 0:b7473c389910 4 // Hyperterminal configuration
kholland 0:b7473c389910 5 // 115200 bauds, 8-bit data, no parity
kholland 0:b7473c389910 6 //------------------------------------
kholland 0:b7473c389910 7
kholland 0:b7473c389910 8 Serial pc(USBTX, USBRX);
kholland 0:b7473c389910 9 Serial skywire(PA_9, PA_10); //Nucleo Boards
kholland 0:b7473c389910 10 //Serial skywire(PTC17, PTC16); //K64 FRDM
kholland 0:b7473c389910 11
kholland 0:b7473c389910 12 DigitalOut myled(LED1);
kholland 0:b7473c389910 13
kholland 0:b7473c389910 14 DigitalOut skywire_en(PA_6); //Nucleo
kholland 0:b7473c389910 15 DigitalOut skywire_rts(PA_7);
kholland 0:b7473c389910 16
kholland 0:b7473c389910 17 //DigitalOut skywire_en(PTD3); //K64 FRDM
kholland 0:b7473c389910 18 //DigitalOut skywire_rts(PTD2);
kholland 0:b7473c389910 19
kholland 0:b7473c389910 20 char c;
kholland 0:b7473c389910 21
kholland 0:b7473c389910 22 int main()
kholland 0:b7473c389910 23 {
kholland 0:b7473c389910 24 skywire.baud(115200);
kholland 0:b7473c389910 25 pc.baud(115200);
kholland 0:b7473c389910 26 skywire_rts=0;
kholland 0:b7473c389910 27 pc.printf("Hello World !\n");
kholland 0:b7473c389910 28 myled=0;
kholland 0:b7473c389910 29 skywire_en=0;
kholland 0:b7473c389910 30 wait(1);
kholland 0:b7473c389910 31 skywire_en=1;
kholland 0:b7473c389910 32 wait(1);
kholland 0:b7473c389910 33
kholland 0:b7473c389910 34 myled=1;
kholland 0:b7473c389910 35 while(1) {
kholland 0:b7473c389910 36 if(skywire.readable()) {
kholland 0:b7473c389910 37 c = skywire.getc();
kholland 0:b7473c389910 38 //skywire.putc(c);
kholland 0:b7473c389910 39 pc.putc(c);
kholland 0:b7473c389910 40 }
kholland 0:b7473c389910 41 if(pc.readable()) {
kholland 0:b7473c389910 42 c = pc.getc();
kholland 0:b7473c389910 43 skywire.putc(c);
kholland 0:b7473c389910 44 //pc.putc(c);
kholland 0:b7473c389910 45 }
kholland 0:b7473c389910 46 }
kholland 0:b7473c389910 47 }
kholland 0:b7473c389910 48
kholland 0:b7473c389910 49