protegemed, aquisição via A/D simples utilizando interrupção do timer
Dependencies: EthernetInterface NTPClient mbed-rtos mbed
Fork of ptgm_semDMA by
Headers/Capture.h@0:fac116e94d44, 2016-01-05 (annotated)
- Committer:
- rebonatto
- Date:
- Tue Jan 05 11:47:35 2016 +0000
- Revision:
- 0:fac116e94d44
- Child:
- 1:8129536051df
Vers?o est?vel sem DMA e FFT. 128 amostras.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rebonatto | 0:fac116e94d44 | 1 | /* |
rebonatto | 0:fac116e94d44 | 2 | * capture.h |
rebonatto | 0:fac116e94d44 | 3 | * |
rebonatto | 0:fac116e94d44 | 4 | * Created on: |
rebonatto | 0:fac116e94d44 | 5 | * Author: |
rebonatto | 0:fac116e94d44 | 6 | */ |
rebonatto | 0:fac116e94d44 | 7 | |
rebonatto | 0:fac116e94d44 | 8 | #ifndef CAPTURE_H |
rebonatto | 0:fac116e94d44 | 9 | #define CAPTURE_H |
rebonatto | 0:fac116e94d44 | 10 | |
rebonatto | 0:fac116e94d44 | 11 | #include <stdio.h> |
rebonatto | 0:fac116e94d44 | 12 | #include <string.h> |
rebonatto | 0:fac116e94d44 | 13 | #include <math.h> |
rebonatto | 0:fac116e94d44 | 14 | |
rebonatto | 0:fac116e94d44 | 15 | #include "mbed.h" |
rebonatto | 0:fac116e94d44 | 16 | #include "rtos.h" |
rebonatto | 0:fac116e94d44 | 17 | #include "dma.h" |
rebonatto | 0:fac116e94d44 | 18 | #include "adc.h" |
rebonatto | 0:fac116e94d44 | 19 | |
rebonatto | 0:fac116e94d44 | 20 | #include "Settings.h" |
rebonatto | 0:fac116e94d44 | 21 | |
rebonatto | 0:fac116e94d44 | 22 | #define CHANNEL0 p15 |
rebonatto | 0:fac116e94d44 | 23 | #define CHANNEL1 p16 |
rebonatto | 0:fac116e94d44 | 24 | #define CHANNEL2 p17 |
rebonatto | 0:fac116e94d44 | 25 | #define CHANNEL3 p18 |
rebonatto | 0:fac116e94d44 | 26 | #define CHANNEL4 p19 |
rebonatto | 0:fac116e94d44 | 27 | #define CHANNEL5 p20 |
rebonatto | 0:fac116e94d44 | 28 | |
rebonatto | 0:fac116e94d44 | 29 | class Capture |
rebonatto | 0:fac116e94d44 | 30 | { |
rebonatto | 0:fac116e94d44 | 31 | |
rebonatto | 0:fac116e94d44 | 32 | protected: |
rebonatto | 0:fac116e94d44 | 33 | |
rebonatto | 0:fac116e94d44 | 34 | //static Semaphore m_CaptureSemaphore; //used to alert the capture thread about a ready capture |
rebonatto | 0:fac116e94d44 | 35 | //static int m_BufferIndex; |
rebonatto | 0:fac116e94d44 | 36 | |
rebonatto | 0:fac116e94d44 | 37 | |
rebonatto | 0:fac116e94d44 | 38 | //static dmaLinkedListNode m_Nodes[2]; //this list holds the buffer configuration for the DMA peripheral |
rebonatto | 0:fac116e94d44 | 39 | public: |
rebonatto | 0:fac116e94d44 | 40 | static short int m_AdcBuffers[NUMBER_OF_CHANNELS][NUMBER_OF_SAMPLES]; |
rebonatto | 0:fac116e94d44 | 41 | // matrix m_AdcBuffers[6][128] |
rebonatto | 0:fac116e94d44 | 42 | |
rebonatto | 0:fac116e94d44 | 43 | public: |
rebonatto | 0:fac116e94d44 | 44 | |
rebonatto | 0:fac116e94d44 | 45 | static short int GetValue(int nsamples, int nchannel); |
rebonatto | 0:fac116e94d44 | 46 | static void PutValue(int nsamples, int nchannel, short int value); |
rebonatto | 0:fac116e94d44 | 47 | static void CopyBuffer(int channel, short int *dest); |
rebonatto | 0:fac116e94d44 | 48 | //static void CopyBufferFloat(int channel, float *dest); |
rebonatto | 0:fac116e94d44 | 49 | |
rebonatto | 0:fac116e94d44 | 50 | //static void ISRHandler(); |
rebonatto | 0:fac116e94d44 | 51 | |
rebonatto | 0:fac116e94d44 | 52 | //static void Initialize(); |
rebonatto | 0:fac116e94d44 | 53 | static void AcquireValues(); |
rebonatto | 0:fac116e94d44 | 54 | //static void Start(); |
rebonatto | 0:fac116e94d44 | 55 | //static void Stop(); |
rebonatto | 0:fac116e94d44 | 56 | //static void Wait(); |
rebonatto | 0:fac116e94d44 | 57 | |
rebonatto | 0:fac116e94d44 | 58 | static void ReadRFID(int channel,char *rfid); |
rebonatto | 0:fac116e94d44 | 59 | |
rebonatto | 0:fac116e94d44 | 60 | }; |
rebonatto | 0:fac116e94d44 | 61 | |
rebonatto | 0:fac116e94d44 | 62 | #endif |