libm2k
Loading...
Searching...
No Matches
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
32namespace libm2k {
33namespace analog {
34class M2kAnalogIn;
35class M2kAnalogOut;
36class M2kPowerSupply;
37}
38
39namespace digital {
40class M2kDigital;
41}
42
43class M2kCalibration;
44
45namespace context {
46
54class LIBM2K_API M2k : public virtual Context
55{
56public:
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
127
128
136
137
145
146
154 virtual libm2k::analog::M2kAnalogIn* getAnalogIn(std::string dev_name) = 0;
155
156
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 analogical input compound.
Definition m2kanalogin.hpp:47
Controls the analogical output compound.
Definition m2kanalogout.hpp:53
Controls the power supply.
Definition m2kpowersupply.hpp:42
Controls the IIO context.
Definition context.hpp:52
Controls the ADALM2000.
Definition m2k.hpp:55
Controls the digital input and output segment.
Definition m2kdigital.hpp:45
Generic M2K enumerations.
virtual bool calibrateDAC()=0
Calibrate the DAC.
virtual void setDacCalibrationOffset(unsigned int chn, int offset)=0
Set the calibration offset of the DAC.
virtual libm2k::digital::M2kDigital * getDigital()=0
Retrieve the Digital object.
virtual bool hasMixedSignal()=0
Check if the mixed signal acquisition is available on the current firmware version.
virtual void setDacCalibrationGain(unsigned int chn, double gain)=0
Set the calibration gain of the DAC.
virtual std::map< double, std::shared_ptr< struct CALIBRATION_PARAMETERS > > & getLUT()=0
Retrieve the predefined calibration parameter.
virtual double getAdcCalibrationGain(unsigned int chn)=0
Get the calibration gain of the ADC.
virtual libm2k::analog::M2kAnalogIn * getAnalogIn()=0
Retrieve the AnalogIn object.
virtual bool calibrateADC()=0
Calibrate the ADC.
virtual libm2k::analog::M2kAnalogOut * getAnalogOut()=0
Retrieve the AnalogOut object.
virtual void setAdcCalibrationOffset(unsigned int chn, int offset)=0
Set the calibration offset of the ADC.
virtual bool hasContextCalibration()=0
Check if the calibration based on temperature can be performed.
virtual libm2k::analog::M2kAnalogIn * getAnalogIn(std::string dev_name)=0
Retrieve the AnalogIn object of a device.
virtual int getDacCalibrationOffset(unsigned int chn)=0
Get the calibration offset of the DAC.
virtual bool getLed()=0
Retrieve the state of the led.
virtual void setLed(bool on)=0
Turn on or off the board's led.
virtual double getDacCalibrationGain(unsigned int chn)=0
Get the calibration gain of the DAC.
virtual void startMixedSignalAcquisition(unsigned int nb_samples)=0
Initiate the mixed acquisition.
virtual void stopMixedSignalAcquisition()=0
Stop the mixed acquisition.
virtual libm2k::analog::M2kPowerSupply * getPowerSupply()=0
Retrieve the PowerSupply object.
virtual int getAdcCalibrationOffset(unsigned int chn)=0
Get the calibration offset of the ADC.
virtual double calibrateFromContext()=0
Calibrate both ADC and DACs using predefined calibration values located in context.
virtual void setAdcCalibrationGain(unsigned int chn, double gain)=0
Set the calibration gain of the ADC.
virtual bool isCalibrated()=0
Check if the board was calibrated.
virtual void reset()=0
Reset the M2K device to default settings: