Loading...
Searching...
No Matches
m2k.hpp
/*
* Copyright (c) 2019 Analog Devices Inc.
*
* This file is part of libm2k
* (see http://www.github.com/analogdevicesinc/libm2k).
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef M2K_H
#define M2K_H
#include <libm2k/m2kglobal.hpp>
#include <libm2k/context.hpp>
#include <libm2k/enums.hpp>
#include <iostream>
#include <vector>
#include <map>
namespace libm2k {
namespace analog {
class M2kAnalogIn;
class M2kAnalogOut;
class M2kPowerSupply;
}
namespace digital {
class M2kDigital;
}
class M2kCalibration;
namespace context {
class LIBM2K_API M2k : public virtual Context
{
public:
virtual ~M2k() {}
virtual void reset() = 0;
virtual void deinitialize() = 0;
virtual bool calibrate() = 0;
virtual bool calibrateADC() = 0;
virtual bool calibrateDAC() = 0;
virtual bool resetCalibration() = 0;
virtual double calibrateFromContext() = 0;
virtual libm2k::digital::M2kDigital* getDigital() = 0;
virtual libm2k::analog::M2kPowerSupply* getPowerSupply() = 0;
virtual libm2k::analog::M2kAnalogIn* getAnalogIn() = 0;
virtual libm2k::analog::M2kAnalogIn* getAnalogIn(std::string dev_name) = 0;
virtual libm2k::analog::M2kAnalogOut* getAnalogOut() = 0;
virtual std::vector<libm2k::analog::M2kAnalogIn*> getAllAnalogIn() = 0;
virtual std::vector<libm2k::analog::M2kAnalogOut*> getAllAnalogOut() = 0;
virtual bool hasMixedSignal() = 0;
virtual void startMixedSignalAcquisition(unsigned int nb_samples) = 0;
virtual void stopMixedSignalAcquisition() = 0;
virtual int getDacCalibrationOffset(unsigned int chn) = 0;
virtual double getDacCalibrationGain(unsigned int chn) = 0;
virtual int getAdcCalibrationOffset(unsigned int chn) = 0;
virtual double getAdcCalibrationGain(unsigned int chn) = 0;
virtual void setDacCalibrationOffset(unsigned int chn, int offset) = 0;
virtual void setDacCalibrationGain(unsigned int chn, double gain) = 0;
virtual void setAdcCalibrationOffset(unsigned int chn, int offset) = 0;
virtual void setAdcCalibrationGain(unsigned int chn, double gain) = 0;
virtual bool hasContextCalibration() = 0;
virtual std::map<double, std::shared_ptr<struct CALIBRATION_PARAMETERS>> &getLUT() = 0;
virtual bool isCalibrated() = 0;
virtual void setLed(bool on) = 0;
virtual bool getLed() = 0;
};
}
}
#endif // M2K_H
libm2k::analog::M2kAnalogIn
Controls the analogical input compound.
Definition m2kanalogin.hpp:47
libm2k::analog::M2kAnalogOut
Controls the analogical output compound.
Definition m2kanalogout.hpp:53
libm2k::analog::M2kPowerSupply
Controls the power supply.
Definition m2kpowersupply.hpp:42
libm2k::context::Context
Controls the IIO context.
Definition context.hpp:52
libm2k::context::M2k
Controls the ADALM2000.
Definition m2k.hpp:55
libm2k::digital::M2kDigital
Controls the digital input and output segment.
Definition m2kdigital.hpp:45
enums.hpp
Generic M2K enumerations.
libm2k::context::M2k::calibrateDAC
virtual bool calibrateDAC()=0
Calibrate the DAC.
libm2k::context::M2k::setDacCalibrationOffset
virtual void setDacCalibrationOffset(unsigned int chn, int offset)=0
Set the calibration offset of the DAC.
libm2k::context::M2k::getDigital
virtual libm2k::digital::M2kDigital * getDigital()=0
Retrieve the Digital object.
libm2k::context::M2k::hasMixedSignal
virtual bool hasMixedSignal()=0
Check if the mixed signal acquisition is available on the current firmware version.
libm2k::context::M2k::setDacCalibrationGain
virtual void setDacCalibrationGain(unsigned int chn, double gain)=0
Set the calibration gain of the DAC.
libm2k::context::M2k::getLUT
virtual std::map< double, std::shared_ptr< struct CALIBRATION_PARAMETERS > > & getLUT()=0
Retrieve the predefined calibration parameter.
libm2k::context::M2k::getAdcCalibrationGain
virtual double getAdcCalibrationGain(unsigned int chn)=0
Get the calibration gain of the ADC.
libm2k::context::M2k::getAnalogIn
virtual libm2k::analog::M2kAnalogIn * getAnalogIn()=0
Retrieve the AnalogIn object.
libm2k::context::M2k::calibrateADC
virtual bool calibrateADC()=0
Calibrate the ADC.
libm2k::context::M2k::getAnalogOut
virtual libm2k::analog::M2kAnalogOut * getAnalogOut()=0
Retrieve the AnalogOut object.
libm2k::context::M2k::setAdcCalibrationOffset
virtual void setAdcCalibrationOffset(unsigned int chn, int offset)=0
Set the calibration offset of the ADC.
libm2k::context::M2k::hasContextCalibration
virtual bool hasContextCalibration()=0
Check if the calibration based on temperature can be performed.
libm2k::context::M2k::getAnalogIn
virtual libm2k::analog::M2kAnalogIn * getAnalogIn(std::string dev_name)=0
Retrieve the AnalogIn object of a device.
libm2k::context::M2k::getDacCalibrationOffset
virtual int getDacCalibrationOffset(unsigned int chn)=0
Get the calibration offset of the DAC.
libm2k::context::M2k::getLed
virtual bool getLed()=0
Retrieve the state of the led.
libm2k::context::M2k::setLed
virtual void setLed(bool on)=0
Turn on or off the board's led.
libm2k::context::M2k::getDacCalibrationGain
virtual double getDacCalibrationGain(unsigned int chn)=0
Get the calibration gain of the DAC.
libm2k::context::M2k::startMixedSignalAcquisition
virtual void startMixedSignalAcquisition(unsigned int nb_samples)=0
Initiate the mixed acquisition.
libm2k::context::M2k::stopMixedSignalAcquisition
virtual void stopMixedSignalAcquisition()=0
Stop the mixed acquisition.
libm2k::context::M2k::getPowerSupply
virtual libm2k::analog::M2kPowerSupply * getPowerSupply()=0
Retrieve the PowerSupply object.
libm2k::context::M2k::getAdcCalibrationOffset
virtual int getAdcCalibrationOffset(unsigned int chn)=0
Get the calibration offset of the ADC.
libm2k::context::M2k::calibrateFromContext
virtual double calibrateFromContext()=0
Calibrate both ADC and DACs using predefined calibration values located in context.
libm2k::context::M2k::setAdcCalibrationGain
virtual void setAdcCalibrationGain(unsigned int chn, double gain)=0
Set the calibration gain of the ADC.
libm2k::context::M2k::isCalibrated
virtual bool isCalibrated()=0
Check if the board was calibrated.
libm2k::context::M2k::reset
virtual void reset()=0
Reset the M2K device to default settings: