/
rhd2000registers.h
168 lines (134 loc) · 4.56 KB
/
rhd2000registers.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
//----------------------------------------------------------------------------------
// rhd2000registers.h
//
// Intan Technoloies RHD2000 Rhythm Interface API
// Rhd2000Registers Class Header File
// Version 1.4 (26 February 2014)
//
// Copyright (c) 2013-2014 Intan Technologies LLC
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the
// use of this software.
//
// Permission is granted to anyone to use this software for any applications that
// use Intan Technologies integrated circuits, and to alter it and redistribute it
// freely.
//
// See http://www.intantech.com for documentation and product information.
//----------------------------------------------------------------------------------
#ifndef RHD2000REGISTERS_H
#define RHD2000REGISTERS_H
using namespace std;
class Rhd2000Registers
{
public:
Rhd2000Registers(double sampleRate);
void defineSampleRate(double newSampleRate);
void setFastSettle(bool enabled);
void setDigOutLow();
void setDigOutHigh();
void setDigOutHiZ();
void enableAux1(bool enabled);
void enableAux2(bool enabled);
void enableAux3(bool enabled);
void enableDsp(bool enabled);
void disableDsp();
double setDspCutoffFreq(double newDspCutoffFreq);
double getDspCutoffFreq() const;
void enableZcheck(bool enabled);
void setZcheckDacPower(bool enabled);
enum ZcheckCs {
ZcheckCs100fF,
ZcheckCs1pF,
ZcheckCs10pF
};
enum ZcheckPolarity {
ZcheckPositiveInput,
ZcheckNegativeInput
};
void setZcheckScale(ZcheckCs scale);
void setZcheckPolarity(ZcheckPolarity polarity);
int setZcheckChannel(int channel);
void setAmpPowered(int channel, bool powered);
void powerUpAllAmps();
void powerDownAllAmps();
int getRegisterValue(int reg) const;
double setUpperBandwidth(double upperBandwidth);
double setLowerBandwidth(double lowerBandwidth);
int createCommandListRegisterConfig(vector<int> &commandList, bool calibrate);
int createCommandListTempSensor(vector<int> &commandList);
int createCommandListUpdateDigOut(vector<int> &commandList);
int createCommandListZcheckDac(vector<int> &commandList, double frequency, double amplitude);
enum Rhd2000CommandType {
Rhd2000CommandConvert,
Rhd2000CommandCalibrate,
Rhd2000CommandCalClear,
Rhd2000CommandRegWrite,
Rhd2000CommandRegRead
};
int createRhd2000Command(Rhd2000CommandType commandType);
int createRhd2000Command(Rhd2000CommandType commandType, int arg1);
int createRhd2000Command(Rhd2000CommandType commandType, int arg1, int arg2);
private:
double sampleRate;
// RHD2000 Register 0 variables
int adcReferenceBw;
int ampFastSettle;
int ampVrefEnable;
int adcComparatorBias;
int adcComparatorSelect;
// RHD2000 Register 1 variables
int vddSenseEnable;
int adcBufferBias;
// RHD2000 Register 2 variables
int muxBias;
// RHD2000 Register 3 variables
int muxLoad;
int tempS1;
int tempS2;
int tempEn;
int digOutHiZ;
int digOut;
// RHD2000 Register 4 variables
int weakMiso;
int twosComp;
int absMode;
int dspEn;
int dspCutoffFreq;
// RHD2000 Register 5 variables
int zcheckDacPower;
int zcheckLoad;
int zcheckScale;
int zcheckConnAll;
int zcheckSelPol;
int zcheckEn;
// RHD2000 Register 6 variables
//int zcheckDac; // handle Zcheck DAC waveform elsewhere
// RHD2000 Register 7 variables
int zcheckSelect;
// RHD2000 Register 8-13 variables
int offChipRH1;
int offChipRH2;
int offChipRL;
int adcAux1En;
int adcAux2En;
int adcAux3En;
int rH1Dac1;
int rH1Dac2;
int rH2Dac1;
int rH2Dac2;
int rLDac1;
int rLDac2;
int rLDac3;
// RHD2000 Register 14-17 variables
vector<int> aPwr;
double rH1FromUpperBandwidth(double upperBandwidth) const;
double rH2FromUpperBandwidth(double upperBandwidth) const;
double rLFromLowerBandwidth(double lowerBandwidth) const;
double upperBandwidthFromRH1(double rH1) const;
double upperBandwidthFromRH2(double rH2) const;
double lowerBandwidthFromRL(double rL) const;
static const int MaxCommandLength = 1024; // size of on-FPGA auxiliary command RAM banks
};
#endif // RHD2000REGISTERS_H