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
Headers/Capture.h@2:86c3cb25577b, 2014-07-21 (annotated)
- Committer:
- rebonatto
- Date:
- Mon Jul 21 00:58:34 2014 +0000
- Revision:
- 2:86c3cb25577b
- Parent:
- 1:917ca6b5d9d9
Problemas com objeto para aquisi??o da rfid (serial)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rebonatto | 0:c64e1194230b | 1 | /* |
rebonatto | 0:c64e1194230b | 2 | * capture.h |
rebonatto | 0:c64e1194230b | 3 | * |
rebonatto | 0:c64e1194230b | 4 | * Created on: |
rebonatto | 0:c64e1194230b | 5 | * Author: |
rebonatto | 0:c64e1194230b | 6 | */ |
rebonatto | 0:c64e1194230b | 7 | |
rebonatto | 0:c64e1194230b | 8 | #ifndef CAPTURE_H |
rebonatto | 0:c64e1194230b | 9 | #define CAPTURE_H |
rebonatto | 0:c64e1194230b | 10 | |
rebonatto | 0:c64e1194230b | 11 | #include <stdio.h> |
rebonatto | 0:c64e1194230b | 12 | #include <string.h> |
rebonatto | 0:c64e1194230b | 13 | #include <math.h> |
rebonatto | 0:c64e1194230b | 14 | |
rebonatto | 0:c64e1194230b | 15 | #include "mbed.h" |
rebonatto | 0:c64e1194230b | 16 | #include "rtos.h" |
rebonatto | 0:c64e1194230b | 17 | #include "dma.h" |
rebonatto | 0:c64e1194230b | 18 | #include "adc.h" |
rebonatto | 0:c64e1194230b | 19 | |
rebonatto | 0:c64e1194230b | 20 | #include "Settings.h" |
rebonatto | 0:c64e1194230b | 21 | |
rebonatto | 0:c64e1194230b | 22 | // MTR: Estes defines nao deveriam estar no arquivo de configuraçeos? |
rebonatto | 0:c64e1194230b | 23 | //#define SAMPLE_RATE 256U |
rebonatto | 0:c64e1194230b | 24 | |
rebonatto | 1:917ca6b5d9d9 | 25 | |
rebonatto | 0:c64e1194230b | 26 | class Capture |
rebonatto | 0:c64e1194230b | 27 | { |
rebonatto | 1:917ca6b5d9d9 | 28 | |
rebonatto | 0:c64e1194230b | 29 | protected: |
rebonatto | 1:917ca6b5d9d9 | 30 | |
rebonatto | 0:c64e1194230b | 31 | static Semaphore m_CaptureSemaphore; //used to alert the capture thread about a ready capture |
rebonatto | 0:c64e1194230b | 32 | static int m_BufferIndex; |
rebonatto | 0:c64e1194230b | 33 | |
rebonatto | 0:c64e1194230b | 34 | static dmaLinkedListNode m_Nodes[2]; //this list holds the buffer configuration for the DMA peripheral |
rebonatto | 0:c64e1194230b | 35 | public: |
rebonatto | 1:917ca6b5d9d9 | 36 | static unsigned short int m_AdcBuffers[2][NUMBER_OF_SAMPLES][NUMBER_OF_CHANNELS]; |
rebonatto | 1:917ca6b5d9d9 | 37 | |
rebonatto | 0:c64e1194230b | 38 | public: |
rebonatto | 0:c64e1194230b | 39 | |
rebonatto | 0:c64e1194230b | 40 | static unsigned short int GetValue(int nsamples, int nchannel); |
rebonatto | 0:c64e1194230b | 41 | static void CopyBuffer(int channel, unsigned short int *dest); |
rebonatto | 0:c64e1194230b | 42 | |
rebonatto | 0:c64e1194230b | 43 | static void ISRHandler(); |
rebonatto | 0:c64e1194230b | 44 | |
rebonatto | 0:c64e1194230b | 45 | static void Initialize(); |
rebonatto | 0:c64e1194230b | 46 | static void Start(); |
rebonatto | 0:c64e1194230b | 47 | static void Stop(); |
rebonatto | 1:917ca6b5d9d9 | 48 | static void Wait(); |
rebonatto | 1:917ca6b5d9d9 | 49 | |
rebonatto | 1:917ca6b5d9d9 | 50 | void ReadRFID(int channel,char *rfid); |
rebonatto | 0:c64e1194230b | 51 | |
rebonatto | 0:c64e1194230b | 52 | }; |
rebonatto | 0:c64e1194230b | 53 | |
rebonatto | 0:c64e1194230b | 54 | #endif |