Loading...
Searching...
No Matches
AnalogIn
Analog

Contains the representation of the analogical input segment. More...

Collaboration diagram for AnalogIn:

## Classes

class | libm2k::analog::M2kAnalogIn
| Controls the analogical input compound. More...

## Functions

virtual void | libm2k::analog::M2kAnalogIn::startAcquisition (unsigned int nb_samples)=0
| Create the buffer for both channels and start the acquisition.
virtual void | libm2k::analog::M2kAnalogIn::stopAcquisition ()=0
| Destroy the buffer and stop the acquisition.
virtual std::vector< std::vector< double > > | libm2k::analog::M2kAnalogIn::getSamples (unsigned int nb_samples)=0
| Retrieve a specific number of samples from each channel.
virtual std::vector< std::vector< double > > | libm2k::analog::M2kAnalogIn::getSamplesRaw (unsigned int nb_samples)=0
| Retrieve a specific number of raw samples from each channel.
virtual const double * | libm2k::analog::M2kAnalogIn::getSamplesInterleaved (unsigned int nb_samples_per_channel)=0
| Retrieve a specific number of samples from each channel.
virtual const short * | libm2k::analog::M2kAnalogIn::getSamplesRawInterleaved (unsigned int nb_samples_per_channel)=0
| Retrieve a specific number of raw samples from each channel.
virtual const double * | libm2k::analog::M2kAnalogIn::getSamplesInterleaved_matlab (unsigned int nb_samples)=0
| Retrieve a specific number of samples from both channels.
virtual const short * | libm2k::analog::M2kAnalogIn::getSamplesRawInterleaved_matlab (unsigned int nb_samples)=0
| Retrieve a specific number of raw samples from both channels.
virtual short | libm2k::analog::M2kAnalogIn::getVoltageRaw (unsigned int ch)=0
| Retrieve the average raw value of the given channel.
virtual double | libm2k::analog::M2kAnalogIn::getVoltage (unsigned int ch)=0
| Retrieve the average voltage of the given channel.
virtual short | libm2k::analog::M2kAnalogIn::getVoltageRaw (libm2k::analog::ANALOG_IN_CHANNEL ch)=0
| Retrieve the average raw value of the given channel.
virtual double | libm2k::analog::M2kAnalogIn::getVoltage (libm2k::analog::ANALOG_IN_CHANNEL ch)=0
| Retrieve the average voltage of the given channel.
virtual std::vector< short > | libm2k::analog::M2kAnalogIn::getVoltageRaw ()=0
| Retrieve the average raw value for each channel.
virtual std::vector< double > | libm2k::analog::M2kAnalogIn::getVoltage ()=0
| Retrieve the average voltage for each channel.
virtual const short * | libm2k::analog::M2kAnalogIn::getVoltageRawP ()=0
| Retrieve the average raw value for both channels.
virtual const double * | libm2k::analog::M2kAnalogIn::getVoltageP ()=0
| Retrieve the average voltage for both channels.
virtual void | libm2k::analog::M2kAnalogIn::setVerticalOffset (ANALOG_IN_CHANNEL channel, double vertOffset)=0
| Set the vertical offset, in Volts, of a specific channel.
virtual double | libm2k::analog::M2kAnalogIn::getVerticalOffset (ANALOG_IN_CHANNEL channel)=0
| getVerticalOffset
virtual double | libm2k::analog::M2kAnalogIn::getScalingFactor (libm2k::analog::ANALOG_IN_CHANNEL ch)=0
| Retrieve the scaling factor.
virtual void | libm2k::analog::M2kAnalogIn::setRange (ANALOG_IN_CHANNEL channel, M2K_RANGE range)=0
| Set the range for the given channel.
virtual void | libm2k::analog::M2kAnalogIn::setRange (ANALOG_IN_CHANNEL channel, double min, double max)=0
| Set the range for the given channel.
virtual libm2k::analog::M2K_RANGE | libm2k::analog::M2kAnalogIn::getRange (libm2k::analog::ANALOG_IN_CHANNEL channel)=0
| Retrieve the range for the given channel.
virtual std::pair< double, double > | libm2k::analog::M2kAnalogIn::getRangeLimits (libm2k::analog::M2K_RANGE range)=0
| Retrieve the bounds for the given range.
virtual std::vector< std::pair< std::string, std::pair< double, double > > > | libm2k::analog::M2kAnalogIn::getAvailableRanges ()=0
| Retrieve all ranges that are available.
virtual int | libm2k::analog::M2kAnalogIn::getOversamplingRatio ()=0
| Retrieve the global oversampling ratio.
virtual int | libm2k::analog::M2kAnalogIn::getOversamplingRatio (unsigned int chn_idx)=0
| Retrieve the oversampling ratio for the given channel.
virtual int | libm2k::analog::M2kAnalogIn::setOversamplingRatio (int oversampling)=0
| Set the global oversampling ratio.
virtual int | libm2k::analog::M2kAnalogIn::setOversamplingRatio (unsigned int chn_idx, int oversampling)=0
| Set the oversampling ratio for the given channel.
virtual double | libm2k::analog::M2kAnalogIn::getSampleRate ()=0
| Retrieve the global sample rate.
virtual std::vector< double > | libm2k::analog::M2kAnalogIn::getAvailableSampleRates ()=0
| getAvailableSampleRates
virtual double | libm2k::analog::M2kAnalogIn::setSampleRate (double samplerate)=0
| Set the global sample rate.
virtual std::pair< double, double > | libm2k::analog::M2kAnalogIn::getHysteresisRange (ANALOG_IN_CHANNEL chn)=0
| Retrieve the bounds of the analogical trigger's hysteresis for the given channel.
virtual double | libm2k::analog::M2kAnalogIn::getFilterCompensation (double samplerate)=0
| Retrieve the filter compensation for the given sample rate.
virtual double | libm2k::analog::M2kAnalogIn::getValueForRange (M2K_RANGE range)=0
| Retrieve the numeric value corresponding to the given range.
virtual double | libm2k::analog::M2kAnalogIn::convertRawToVolts (unsigned int channel, short raw)=0
| Convert the raw value of a sample into volts.
virtual short | libm2k::analog::M2kAnalogIn::convertVoltsToRaw (unsigned int channel, double voltage)=0
| Convert the voltage value of a sample into raw.
virtual unsigned int | libm2k::analog::M2kAnalogIn::getNbChannels ()=0
| Retrieve the number of analogical channels.
virtual std::string | libm2k::analog::M2kAnalogIn::getName ()=0
| Retrieve the name of the device.
virtual void | libm2k::analog::M2kAnalogIn::enableChannel (unsigned int chnIdx, bool enable)=0
| Enable or disable the given channel.
virtual bool | libm2k::analog::M2kAnalogIn::isChannelEnabled (unsigned int chnIdx)=0
| Retrieve the state of the given channel.
virtual void | libm2k::analog::M2kAnalogIn::cancelAcquisition ()=0
| Cancel all buffer operations.
virtual void | libm2k::analog::M2kAnalogIn::setKernelBuffersCount (unsigned int count)=0
| Set the kernel buffers to a specific value.
virtual unsigned int | libm2k::analog::M2kAnalogIn::getKernelBuffersCount () const =0
| Get the number of kernel buffers.
virtual libm2k::M2kHardwareTrigger * | libm2k::analog::M2kAnalogIn::getTrigger ()=0
| Get the hardware trigger handler.
virtual struct IIO_OBJECTS | libm2k::analog::M2kAnalogIn::getIioObjects ()=0
| Get access to IIO channels, buffers, devices and context. Can be used when debugging directly with libiio.
virtual void | libm2k::analog::M2kAnalogIn::getSamples (std::vector< std::vector< double > > &data, unsigned int nb_samples)=0
| Retrieve a specific number of samples from each channel.
virtual std::string | libm2k::analog::M2kAnalogIn::getChannelName (unsigned int channel)=0
| Get the channel name for each ADC channel.
virtual double | libm2k::analog::M2kAnalogIn::getMaximumSamplerate ()=0
| Get the maximum samplerate for the ADC.

## Detailed Description

Contains the representation of the analogical input segment.

## Function Documentation

## cancelAcquisition()

virtual void libm2k::analog::M2kAnalogIn::cancelAcquisition | ( |  | ) |

pure virtual

Cancel all buffer operations.

Note
  Should be used to cancel an ongoing acquisition

## convertRawToVolts()

virtual double libm2k::analog::M2kAnalogIn::convertRawToVolts | ( | unsigned int | channel,
|  | short | raw )

pure virtual

Convert the raw value of a sample into volts.

Parameters

  raw | the raw value of a sample;
  channel | The index corresponding to the channel;

Returns
  The value of a sample converted into volts;

## convertVoltsToRaw()

virtual short libm2k::analog::M2kAnalogIn::convertVoltsToRaw | ( | unsigned int | channel,
|  | double | voltage )

pure virtual

Convert the voltage value of a sample into raw.

Parameters

  voltage | The voltage value of a sample;
  channel | The index corresponding to the channel;

Returns
  The value of a sample converted into raw;

## enableChannel()

virtual void libm2k::analog::M2kAnalogIn::enableChannel | ( | unsigned int | chnIdx,
|  | bool | enable )

pure virtual

Enable or disable the given channel.

Parameters

  chnIdx | The index corresponding to the channel
  enable | A boolean value corresponding to the channel's state

## getAvailableRanges()

virtual std::vector< std::pair< std::string, std::pair< double, double > > > libm2k::analog::M2kAnalogIn::getAvailableRanges | ( |  | ) |

pure virtual

Retrieve all ranges that are available.

Returns
  A list of pairs containing all available ranges and their name

## getAvailableSampleRates()

virtual std::vector< double > libm2k::analog::M2kAnalogIn::getAvailableSampleRates | ( |  | ) |

pure virtual

getAvailableSampleRates

Returns
  The list of available samplerates for this device

## getChannelName()

virtual std::string libm2k::analog::M2kAnalogIn::getChannelName | ( | unsigned int | channel | ) |

pure virtual

Get the channel name for each ADC channel.

Parameters

  channel | - unsigned int representing the index of the channel

Returns
  std::string - name of the channel

## getFilterCompensation()

virtual double libm2k::analog::M2kAnalogIn::getFilterCompensation | ( | double | samplerate | ) |

pure virtual

Retrieve the filter compensation for the given sample rate.

Parameters

  samplerate | A double value representing the sample rate

Returns
  The value of the filter compensation

## getHysteresisRange()

virtual std::pair< double, double > libm2k::analog::M2kAnalogIn::getHysteresisRange | ( | ANALOG_IN_CHANNEL | chn | ) |

pure virtual

Retrieve the bounds of the analogical trigger's hysteresis for the given channel.

Parameters

  chn | An enumerator corresponding to the channel's index

Returns
  A pair containing the lower and upper bound

## getIioObjects()

virtual struct IIO_OBJECTS libm2k::analog::M2kAnalogIn::getIioObjects | ( |  | ) |

pure virtual

Get access to IIO channels, buffers, devices and context. Can be used when debugging directly with libiio.

Returns
  IIO_OBJECTS structure.

## getKernelBuffersCount()

virtual unsigned int libm2k::analog::M2kAnalogIn::getKernelBuffersCount | ( |  | ) | const

pure virtual

Get the number of kernel buffers.

Returns
  the number of previously set kernel buffers (saved in this session)

## getMaximumSamplerate()

virtual double libm2k::analog::M2kAnalogIn::getMaximumSamplerate | ( |  | ) |

pure virtual

Get the maximum samplerate for the ADC.

Returns
  double - the value of the maximum samplerate

## getName()

virtual std::string libm2k::analog::M2kAnalogIn::getName | ( |  | ) |

pure virtual

Retrieve the name of the device.

Returns
  The name of the device

## getNbChannels()

virtual unsigned int libm2k::analog::M2kAnalogIn::getNbChannels | ( |  | ) |

pure virtual

Retrieve the number of analogical channels.

Returns
  The number of channels

## getOversamplingRatio() [1/2]

virtual int libm2k::analog::M2kAnalogIn::getOversamplingRatio | ( |  | ) |

pure virtual

Retrieve the global oversampling ratio.

Returns
  The value of the global ratio

## getOversamplingRatio() [2/2]

virtual int libm2k::analog::M2kAnalogIn::getOversamplingRatio | ( | unsigned int | chn_idx | ) |

pure virtual

Retrieve the oversampling ratio for the given channel.

Parameters

  chn_idx | The index corresponding to the channel

Returns
  The ratio value

## getRange()

virtual libm2k::analog::M2K_RANGE libm2k::analog::M2kAnalogIn::getRange | ( | libm2k::analog::ANALOG_IN_CHANNEL | channel | ) |

pure virtual

Retrieve the range for the given channel.

Parameters

  channel | An enumerator corresponding to the channel's index

Returns
  An enumerator corresponding to the range

## getRangeLimits()

virtual std::pair< double, double > libm2k::analog::M2kAnalogIn::getRangeLimits | ( | libm2k::analog::M2K_RANGE | range | ) |

pure virtual

Retrieve the bounds for the given range.

Parameters

  range | An enumerator corresponding to the range

Returns
  A pair containing the lower and upper bound

## getSampleRate()

virtual double libm2k::analog::M2kAnalogIn::getSampleRate | ( |  | ) |

pure virtual

Retrieve the global sample rate.

Returns
  The value of the sample rate

## getSamples() [1/2]

virtual void libm2k::analog::M2kAnalogIn::getSamples | ( | std::vector< std::vector< double > > & | data,
|  | unsigned int | nb_samples )

pure virtual

Retrieve a specific number of samples from each channel.

Parameters

  data | - a reference to a vector owned/created by the client
  nb_samples | The number of samples that will be retrieved

Note
  The vector will be cleaned and then filled with samples
  The index of the list corresponds to the index of the channel
  Due to a hardware limitation, the number of samples must be a multiple of 4 and greater than 16.

## getSamples() [2/2]

virtual std::vector< std::vector< double > > libm2k::analog::M2kAnalogIn::getSamples | ( | unsigned int | nb_samples | ) |

pure virtual

Retrieve a specific number of samples from each channel.

Parameters

  nb_samples | The number of samples that will be retrieved

Returns
  A list containing lists of samples for each channel

Note
  The index of the list corresponds to the index of the channel
  Due to a hardware limitation, the number of samples must be a multiple of 4 and greater than 16.

## getSamplesInterleaved()

virtual const double * libm2k::analog::M2kAnalogIn::getSamplesInterleaved | ( | unsigned int | nb_samples_per_channel | ) |

pure virtual

Retrieve a specific number of samples from each channel.

Parameters

  nb_samples_per_channel | The number of samples that will be retrieved

Returns
  A pointer to the interleaved samples

Note
  Before the acquisition, both channels will be automatically enabled
  The data array will contain samples from both channels
  After the acquisition is finished, the channels will return to their initial state
  Due to a hardware limitation, the number of samples must be a multiple of 4 and greater than 16.

## getSamplesInterleaved_matlab()

virtual const double * libm2k::analog::M2kAnalogIn::getSamplesInterleaved_matlab | ( | unsigned int | nb_samples | ) |

pure virtual

Retrieve a specific number of samples from both channels.

Parameters

  nb_samples | The number of samples that will be retrieved

Returns
  A pointer to the interleaved samples

Note
  MATLAB specific API wrapper
  Before the acquisition, both channels will be automatically enabled
  The data array will contain samples from both channels
  The data array will contain nb_samples/2 for each channel
  After the acquisition is finished, the channels will return to their initial state
  Due to a hardware limitation, the number of samples must be a multiple of 4 and greater than 16.

## getSamplesRaw()

virtual std::vector< std::vector< double > > libm2k::analog::M2kAnalogIn::getSamplesRaw | ( | unsigned int | nb_samples | ) |

pure virtual

Retrieve a specific number of raw samples from each channel.

Parameters

  nb_samples | The number of samples that will be retrieved

Returns
  A list containing lists of raw samples for each channel

Note
  The index of the list corresponds to the index of the channel
  Due to a hardware limitation, the number of samples must be a multiple of 4 and greater than 16.

## getSamplesRawInterleaved()

virtual const short * libm2k::analog::M2kAnalogIn::getSamplesRawInterleaved | ( | unsigned int | nb_samples_per_channel | ) |

pure virtual

Retrieve a specific number of raw samples from each channel.

Parameters

  nb_samples_per_channel | The number of samples that will be retrieved

Returns
  A pointer to the interleaved raw samples

Note
  Before the acquisition, both channels will be automatically enabled
  The data array will contain samples from both channels
  After the acquisition is finished, the channels will return to their initial state
  Due to a hardware limitation, the number of samples must be a multiple of 4 and greater than 16.

## getSamplesRawInterleaved_matlab()

virtual const short * libm2k::analog::M2kAnalogIn::getSamplesRawInterleaved_matlab | ( | unsigned int | nb_samples | ) |

pure virtual

Retrieve a specific number of raw samples from both channels.

Parameters

  nb_samples | The number of samples that will be retrieved

Returns
  A pointer to the interleaved raw samples

Note
  MATLAB specific API wrapper
  Before the acquisition, both channels will be automatically enabled
  The data array will contain samples from both channels
  The data array will contain nb_samples/2 for each channel
  After the acquisition is finished, the channels will return to their initial state
  Due to a hardware limitation, the number of samples must be a multiple of 4 and greater than 16.

## getScalingFactor()

virtual double libm2k::analog::M2kAnalogIn::getScalingFactor | ( | libm2k::analog::ANALOG_IN_CHANNEL | ch | ) |

pure virtual

Retrieve the scaling factor.

Parameters

  ch | An enumerator corresponding to the channel's index

Returns
  The value of the scaling factor

## getTrigger()

virtual libm2k::M2kHardwareTrigger * libm2k::analog::M2kAnalogIn::getTrigger | ( |  | ) |

pure virtual

Get the hardware trigger handler.

Returns
  A pointer to the hardware trigger trigger

## getValueForRange()

virtual double libm2k::analog::M2kAnalogIn::getValueForRange | ( | M2K_RANGE | range | ) |

pure virtual

Retrieve the numeric value corresponding to the given range.

Parameters

  range |

Returns
  double

## getVerticalOffset()

virtual double libm2k::analog::M2kAnalogIn::getVerticalOffset | ( | ANALOG_IN_CHANNEL | channel | ) |

pure virtual

getVerticalOffset

Parameters

  channel | the index of the channel

Returns
  the value of the offset in Volts

## getVoltage() [1/3]

virtual std::vector< double > libm2k::analog::M2kAnalogIn::getVoltage | ( |  | ) |

pure virtual

Retrieve the average voltage for each channel.

Returns
  A list containing the average voltage of each channel

Note
  The index of the voltage corresponds to the channel's index

## getVoltage() [2/3]

virtual double libm2k::analog::M2kAnalogIn::getVoltage | ( | libm2k::analog::ANALOG_IN_CHANNEL | ch | ) |

pure virtual

Retrieve the average voltage of the given channel.

Parameters

  ch | An enumerator corresponding to the channel's index

Returns
  The average voltage

## getVoltage() [3/3]

virtual double libm2k::analog::M2kAnalogIn::getVoltage | ( | unsigned int | ch | ) |

pure virtual

Retrieve the average voltage of the given channel.

Parameters

  ch | The index corresponding to the channel

Returns
  The average voltage

## getVoltageP()

virtual const double * libm2k::analog::M2kAnalogIn::getVoltageP | ( |  | ) |

pure virtual

Retrieve the average voltage for both channels.

Returns
  A pointer to the average voltage of both channels

## getVoltageRaw() [1/3]

virtual std::vector< short > libm2k::analog::M2kAnalogIn::getVoltageRaw | ( |  | ) |

pure virtual

Retrieve the average raw value for each channel.

Returns
  A list containing the average raw value of each channel

Note
  The index of the value corresponds to the channel's index

## getVoltageRaw() [2/3]

virtual short libm2k::analog::M2kAnalogIn::getVoltageRaw | ( | libm2k::analog::ANALOG_IN_CHANNEL | ch | ) |

pure virtual

Retrieve the average raw value of the given channel.

Parameters

  ch | An enumerator corresponding to the channel's index

Returns
  The average raw value

## getVoltageRaw() [3/3]

virtual short libm2k::analog::M2kAnalogIn::getVoltageRaw | ( | unsigned int | ch | ) |

pure virtual

Retrieve the average raw value of the given channel.

Parameters

  ch | The index corresponding to the channel

Returns
  The average raw value

## getVoltageRawP()

virtual const short * libm2k::analog::M2kAnalogIn::getVoltageRawP | ( |  | ) |

pure virtual

Retrieve the average raw value for both channels.

Returns
  A pointer to the average raw value of both channels

## isChannelEnabled()

virtual bool libm2k::analog::M2kAnalogIn::isChannelEnabled | ( | unsigned int | chnIdx | ) |

pure virtual

Retrieve the state of the given channel.

Parameters

  chnIdx | The index corresponding to the channel

Returns
  True if the channel is enabled
  False if the channel is disabled

## setKernelBuffersCount()

virtual void libm2k::analog::M2kAnalogIn::setKernelBuffersCount | ( | unsigned int | count | ) |

pure virtual

Set the kernel buffers to a specific value.

Parameters

  count | the number of kernel buffers

## setOversamplingRatio() [1/2]

virtual int libm2k::analog::M2kAnalogIn::setOversamplingRatio | ( | int | oversampling | ) |

pure virtual

Set the global oversampling ratio.

Parameters

  oversampling | Integer value to set the oversampling ratio to

Returns
  The current value of the global ratio

## setOversamplingRatio() [2/2]

virtual int libm2k::analog::M2kAnalogIn::setOversamplingRatio | ( | unsigned int | chn_idx,
|  | int | oversampling )

pure virtual

Set the oversampling ratio for the given channel.

Parameters

  chn_idx | The index corresponding to the channel
  oversampling | Integer value to set the oversampling ratio to

Returns
  The current ratio value

## setRange() [1/2]

virtual void libm2k::analog::M2kAnalogIn::setRange | ( | ANALOG_IN_CHANNEL | channel,
|  | double | min,
|  | double | max )

pure virtual

Set the range for the given channel.

Parameters

  channel | An enumerator corresponding to the channel's index
  min | Upper bound
  max | Lower bound

## setRange() [2/2]

virtual void libm2k::analog::M2kAnalogIn::setRange | ( | ANALOG_IN_CHANNEL | channel,
|  | M2K_RANGE | range )

pure virtual

Set the range for the given channel.

Parameters

  channel | An enumerator corresponding to the channel's index
  range | An enumerator corresponding to a range

## setSampleRate()

virtual double libm2k::analog::M2kAnalogIn::setSampleRate | ( | double | samplerate | ) |

pure virtual

Set the global sample rate.

Parameters

  samplerate | A double value to set the sample rate to

Returns
  The value of the global sample rate

## setVerticalOffset()

virtual void libm2k::analog::M2kAnalogIn::setVerticalOffset | ( | ANALOG_IN_CHANNEL | channel,
|  | double | vertOffset )

pure virtual

Set the vertical offset, in Volts, of a specific channel.

Parameters

  channel | the index of the channel
  vertOffset | the value of the offset in Volts

## startAcquisition()

virtual void libm2k::analog::M2kAnalogIn::startAcquisition | ( | unsigned int | nb_samples | ) |

pure virtual

Create the buffer for both channels and start the acquisition.

Parameters

  nb_samples | size of the buffer in samples for each channel