Open Ephys GUI
 All Classes Functions Variables Pages
IntanThread.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 __INTANTHREAD_H_D9135C03__
25 #define __INTANTHREAD_H_D9135C03__
26 
27 #include "../../../JuceLibraryCode/JuceHeader.h"
28 #include <ftdi.h>
29 #include <stdio.h>
30 #include "DataThread.h"
31 
32 /**
33 
34  Interface to the Intan Demo Board.
35 
36  @see SourceNode, DataThread
37 
38 */
39 
40 class SourceNode;
41 
42 class IntanThread : public DataThread
43 
44 {
45 public:
47  ~IntanThread();
48 
49  bool foundInputSource();
50  int getNumChannels();
51  float getSampleRate();
52  float getBitVolts();
53 
54 private:
55 
56  struct ftdi_context ftdic;
57  int vendorID, productID;
58  int baudrate;
59  bool isTransmitting;
60  bool deviceFound;
61 
62  bool initializeUSB(bool);
63  bool closeUSB();
64 
65  bool startAcquisition();
66  bool stopAcquisition();
67 
68  unsigned char startCode, stopCode;
69  unsigned char buffer[240]; // should be 5 samples per channel
70 
71  float thisSample[16];
72 
73  int ch;
74 
75  bool updateBuffer();
76 
77  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (IntanThread);
78 };
79 
80 
81 #endif // __INTANTHREAD_H_D9135C03__