![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Versão limpa em 04/09/2014. Telnet funcionando.
Dependencies: EthernetInterface mbed-rtos mbed NTPClient
Diff: Codes/Capture.cpp
- Revision:
- 37:51fed2a3e009
- Parent:
- 31:647771325538
- Child:
- 39:9fd8397cbef9
diff -r 66e4deb9c249 -r 51fed2a3e009 Codes/Capture.cpp --- a/Codes/Capture.cpp Fri May 22 21:32:00 2015 +0000 +++ b/Codes/Capture.cpp Thu Jul 30 21:42:06 2015 +0000 @@ -104,7 +104,7 @@ Capture::m_CaptureSemaphore.release(); LPC_GPDMA->DMACIntTCClear = 0xFF; } - +/* bool Capture::ReadRFID(int channel,char *rfid) { @@ -142,4 +142,40 @@ } return false; +} +*/ + +void Capture::ReadRFID(int channel,char *rfid) +{ + + char cmd[4]; + cmd[0] = 'S'; + cmd[1] = '0'+channel; + cmd[2] = '\n'; + cmd[3] = '\0'; + + //send + rfid_serial.puts(cmd); + + //receive + char ch=0; + char ans[10]; + int cnt=0; + int tmout=1000; + while(ch != '\n' && tmout-- && cnt<9) + { + if(rfid_serial.readable()) + { + ch = rfid_serial.getc(); + if(!((ch>='0' && ch<='9') || (ch >= 'A' && ch <= 'F')))ch='0'; + ans[cnt++] = ch; + } + else + wait_ms(1); + + } + ans[cnt-1] = '\0'; + for(int i=0;i<9;i++) + rfid[i] = ans[i]; + } \ No newline at end of file