FTDI Simulator
Dependencies: mbed
Fork of Wifly_configure by
Revision 3:cb83f5431e08, committed 2017-02-03
- Comitter:
- defrost
- Date:
- Fri Feb 03 14:56:42 2017 +0000
- Parent:
- 2:8b5ff73de8f0
- Commit message:
- - Latest version;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Jan 25 22:25:06 2017 +0000 +++ b/main.cpp Fri Feb 03 14:56:42 2017 +0000 @@ -10,6 +10,7 @@ int br = 9600; int bufflen = 0; char buff[256]; + char msg_buff[256]; char incomingBuff[4096]; int incomingbufflen = 0; int ii,jj; @@ -29,12 +30,23 @@ pc.printf("%c", c); if(c == 13){ - // Send a whole string: + // wait for a gap in transmission: + wait_us((1.0f/((float) br))*20.0f*1000000.0f); + while(wifi.readable()){ + pc.putc(wifi.getc()); + wait_us((1.0f/((float) br))*20.0f*1000000.0f); + } + // Send a whole string: for(ii=0;ii<bufflen;ii++){ wifi.putc(buff[ii]); + if(buff[ii] == 13){ + msg_buff[ii] = '\0'; + }else{ + msg_buff[ii] = buff[ii]; + } } bufflen = 0; - pc.printf("\r"); + pc.printf("[FTDI : INFO] Sent: %s\n\r",msg_buff); } /*pc.printf("%c",c); @@ -43,7 +55,7 @@ }*/ } while(wifi.readable()){ - if(bufflen == 0){ + /*if(bufflen == 0){ if(incomingbufflen == 0){ pc.putc(wifi.getc()); }else{ @@ -60,7 +72,8 @@ } // data is lost wifi.getc(); - } + }*/ + pc.putc(wifi.getc()); } } }