Versão do protegemed que calcula o tempo em ms da fuga, calcula o numero de onverflow (valores muito baixo) e underflow (valores muito altos). Além disso, calcula um valor médio a partir dos valores capturados e não apenas pela fft.

Dependencies:   EthernetInterface mbed-rtos mbed

Revision:
1:917ca6b5d9d9
Parent:
0:c64e1194230b
Child:
2:86c3cb25577b
diff -r c64e1194230b -r 917ca6b5d9d9 Codes/Capture.cpp
--- a/Codes/Capture.cpp	Wed Jul 09 21:16:23 2014 +0000
+++ b/Codes/Capture.cpp	Fri Jul 18 20:24:45 2014 +0000
@@ -10,6 +10,7 @@
 int Capture::m_BufferIndex;
 dmaLinkedListNode Capture::m_Nodes[2] __attribute__((section("AHBSRAM0"))); //this list holds the buffer configuration for the DMA peripheral
 unsigned short int Capture::m_AdcBuffers[2][NUMBER_OF_SAMPLES][NUMBER_OF_CHANNELS] __attribute__((section("AHBSRAM0")));
+//Serial rfid_serial(p28,p27);
 
 //This function prepares the capture buffers and starts the DMA peripheral
 void Capture::Start()
@@ -82,4 +83,39 @@
 
     Capture::m_CaptureSemaphore.release();
     LPC_GPDMA->DMACIntTCClear = 0xFF;
+}
+
+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<8;i++)
+        rfid[i] = ans[i];
+    */
 }
\ No newline at end of file