protegemed, aquisição via A/D simples utilizando interrupção do timer

Dependencies:   EthernetInterface NTPClient mbed-rtos mbed

Fork of ptgm_semDMA by Marcelo Rebonatto

Committer:
viniciushl
Date:
Wed Jan 13 18:53:25 2016 +0000
Revision:
1:8129536051df
Parent:
0:fac116e94d44
Alterada captura para aquisi??o simples do A/D utilizando interrup??o do timer;

Who changed what in which revision?

UserRevisionLine numberNew 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;
viniciushl 1:8129536051df 36 static bool flag_capture;
viniciushl 1:8129536051df 37 static int cnt_buffer;
viniciushl 1:8129536051df 38 static int channel_number;
viniciushl 1:8129536051df 39 static int cnt_interrupt;
rebonatto 0:fac116e94d44 40
viniciushl 1:8129536051df 41
rebonatto 0:fac116e94d44 42 //static dmaLinkedListNode m_Nodes[2]; //this list holds the buffer configuration for the DMA peripheral
rebonatto 0:fac116e94d44 43 public:
viniciushl 1:8129536051df 44 static short int m_AdcBuffers[NUMBER_OF_CHANNELS][NUMBER_OF_SAMPLES];
viniciushl 1:8129536051df 45
rebonatto 0:fac116e94d44 46 // matrix m_AdcBuffers[6][128]
rebonatto 0:fac116e94d44 47
rebonatto 0:fac116e94d44 48 public:
viniciushl 1:8129536051df 49
rebonatto 0:fac116e94d44 50 static short int GetValue(int nsamples, int nchannel);
rebonatto 0:fac116e94d44 51 static void PutValue(int nsamples, int nchannel, short int value);
rebonatto 0:fac116e94d44 52 static void CopyBuffer(int channel, short int *dest);
rebonatto 0:fac116e94d44 53 //static void CopyBufferFloat(int channel, float *dest);
rebonatto 0:fac116e94d44 54
rebonatto 0:fac116e94d44 55 //static void ISRHandler();
rebonatto 0:fac116e94d44 56
rebonatto 0:fac116e94d44 57 //static void Initialize();
rebonatto 0:fac116e94d44 58 static void AcquireValues();
viniciushl 1:8129536051df 59 static void InitializeAD();
viniciushl 1:8129536051df 60
rebonatto 0:fac116e94d44 61 //static void Start();
rebonatto 0:fac116e94d44 62 //static void Stop();
rebonatto 0:fac116e94d44 63 //static void Wait();
rebonatto 0:fac116e94d44 64
rebonatto 0:fac116e94d44 65 static void ReadRFID(int channel,char *rfid);
viniciushl 1:8129536051df 66
viniciushl 1:8129536051df 67 static void FcnTimerInt(void);
viniciushl 1:8129536051df 68 //static void AdInitialize();
rebonatto 0:fac116e94d44 69
rebonatto 0:fac116e94d44 70 };
rebonatto 0:fac116e94d44 71
rebonatto 0:fac116e94d44 72 #endif