libm2k
m2k.hpp
1 /*
2  * Copyright (c) 2019 Analog Devices Inc.
3  *
4  * This file is part of libm2k
5  * (see http://www.github.com/analogdevicesinc/libm2k).
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation, either version 2.1 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef M2K_H
23 #define M2K_H
24 
25 #include <libm2k/m2kglobal.hpp>
26 #include <libm2k/context.hpp>
27 #include <libm2k/enums.hpp>
28 #include <iostream>
29 #include <vector>
30 #include <map>
31 
32 namespace libm2k {
33 namespace analog {
34 class M2kAnalogIn;
35 class M2kAnalogOut;
36 class M2kPowerSupply;
37 }
38 
39 namespace digital {
40 class M2kDigital;
41 }
42 
43 class M2kCalibration;
44 
45 namespace context {
46 
54 class LIBM2K_API M2k : public virtual Context
55 {
56 public:
60  virtual ~M2k() {}
61 
62 
73  virtual void reset() = 0;
74 
75 
79  virtual void deinitialize() = 0;
80 
84  virtual bool calibrate() = 0;
85 
86 
93  virtual bool calibrateADC() = 0;
94 
95 
102  virtual bool calibrateDAC() = 0;
103 
104 
108  virtual bool resetCalibration() = 0;
109 
110 
117  virtual double calibrateFromContext() = 0;
118 
119 
126  virtual libm2k::digital::M2kDigital* getDigital() = 0;
127 
128 
135  virtual libm2k::analog::M2kPowerSupply* getPowerSupply() = 0;
136 
137 
144  virtual libm2k::analog::M2kAnalogIn* getAnalogIn() = 0;
145 
146 
154  virtual libm2k::analog::M2kAnalogIn* getAnalogIn(std::string dev_name) = 0;
155 
156 
163  virtual libm2k::analog::M2kAnalogOut* getAnalogOut() = 0;
164 
165 
169  virtual std::vector<libm2k::analog::M2kAnalogIn*> getAllAnalogIn() = 0;
170 
171 
175  virtual std::vector<libm2k::analog::M2kAnalogOut*> getAllAnalogOut() = 0;
176 
177 
182  virtual bool hasMixedSignal() = 0;
183 
184 
191  virtual void startMixedSignalAcquisition(unsigned int nb_samples) = 0;
192 
193 
199  virtual void stopMixedSignalAcquisition() = 0;
200 
201 
208  virtual int getDacCalibrationOffset(unsigned int chn) = 0;
209 
210 
217  virtual double getDacCalibrationGain(unsigned int chn) = 0;
218 
219 
226  virtual int getAdcCalibrationOffset(unsigned int chn) = 0;
227 
228 
235  virtual double getAdcCalibrationGain(unsigned int chn) = 0;
236 
237 
245  virtual void setDacCalibrationOffset(unsigned int chn, int offset) = 0;
246 
247 
256  virtual void setDacCalibrationGain(unsigned int chn, double gain) = 0;
257 
258 
266  virtual void setAdcCalibrationOffset(unsigned int chn, int offset) = 0;
267 
268 
277  virtual void setAdcCalibrationGain(unsigned int chn, double gain) = 0;
278 
279 
284  virtual bool hasContextCalibration() = 0;
285 
286 
291  virtual std::map<double, std::shared_ptr<struct CALIBRATION_PARAMETERS>> &getLUT() = 0;
292 
293 
298  virtual bool isCalibrated() = 0;
299 
300 
308  virtual void setLed(bool on) = 0;
309 
310 
317  virtual bool getLed() = 0;
318 };
319 }
320 }
321 #endif // M2K_H
Controls the power supply.
Definition: m2kpowersupply.hpp:42
Controls the analogical output compound.
Definition: m2kanalogout.hpp:52
Controls the ADALM2000.
Definition: m2k.hpp:54
Controls the analogical input compound.
Definition: m2kanalogin.hpp:46
Controls the IIO context.
Definition: context.hpp:52
Controls the digital input and output segment.
Definition: m2kdigital.hpp:44
Generic M2K enumerations.