Open Ephys GUI
 All Classes Functions Variables Pages
FPGAThread.h
1 /*
2  ------------------------------------------------------------------
3 
4  This file is part of the Open Ephys GUI
5  Copyright (C) 2012 Open Ephys
6 
7  ------------------------------------------------------------------
8 
9  This program is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #ifndef __FPGATHREAD_H_FBB22A45__
25 #define __FPGATHREAD_H_FBB22A45__
26 
27 
28 #include "../../../JuceLibraryCode/JuceHeader.h"
29 
30 #include <stdio.h>
31 #include <string.h>
32 
33 #include "okFrontPanelDLL.h"
34 #include "DataThread.h"
35 
36 /**
37 
38  Communicates with the custom acquisition board via an Opal Kelly FPGA.
39 
40  @see DataThread, SourceNode
41 
42 */
43 
44 class SourceNode;
45 
46 class FPGAThread : public DataThread
47 
48 {
49 public:
51  ~FPGAThread();
52 
53  bool foundInputSource();
54  int getNumChannels();
55  float getSampleRate();
56  float getBitVolts();
57 
58 private:
59 
60  okCFrontPanel* dev;
61  char bitfile[128];
62  char dll_date[32], dll_time[32];
63  bool isTransmitting;
64  bool deviceFound;
65 
66  bool initializeFPGA(bool);
67  bool closeFPGA();
68 
69  bool startAcquisition();
70  bool stopAcquisition();
71 
72  unsigned char pBuffer[50000]; // request a 50kb block of data
73 
74  float thisSample[32];
75 
76  int numchannels;
77  int Ndatabytes;
78 
79  bool updateBuffer();
80 
81  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FPGAThread);
82 };
83 
84 
85 
86 #endif // __FPGATHREAD_H_FBB22A45__