libm2k
Classes | Functions
Digital

Contains the representation of the digital segment. More...

Classes

class  libm2k::digital::M2kDigital
 Controls the digital input and output segment. More...
 

Functions

virtual void libm2k::digital::M2kDigital::setDirection (unsigned short mask)=0
 Set the direction for all digital channels. More...
 
virtual void libm2k::digital::M2kDigital::setDirection (unsigned int index, DIO_DIRECTION dir)=0
 Set the direction of the given digital channel. More...
 
virtual void libm2k::digital::M2kDigital::setDirection (unsigned int index, bool dir)=0
 Set the direction of the given digital channel. More...
 
virtual void libm2k::digital::M2kDigital::setDirection (DIO_CHANNEL index, bool dir)=0
 Set the direction of the given digital channel. More...
 
virtual void libm2k::digital::M2kDigital::setDirection (DIO_CHANNEL index, DIO_DIRECTION dir)=0
 Set the direction of the given digital channel. More...
 
virtual DIO_DIRECTION libm2k::digital::M2kDigital::getDirection (DIO_CHANNEL index)=0
 Retrieve the direction of the given digital channel. More...
 
virtual void libm2k::digital::M2kDigital::setValueRaw (DIO_CHANNEL index, DIO_LEVEL level)=0
 Set the raw value of a given digital channel. More...
 
virtual void libm2k::digital::M2kDigital::push (std::vector< unsigned short > const &data)=0
 Send the samples to all digital channels. More...
 
virtual void libm2k::digital::M2kDigital::push (unsigned short *data, unsigned int nb_samples)=0
 Send the samples to all digital channels. More...
 
virtual void libm2k::digital::M2kDigital::setValueRaw (unsigned int index, DIO_LEVEL level)=0
 Set the raw value of a given digital channel. More...
 
virtual void libm2k::digital::M2kDigital::setValueRaw (DIO_CHANNEL index, bool level)=0
 Set the raw value of a given digital channel. More...
 
virtual DIO_LEVEL libm2k::digital::M2kDigital::getValueRaw (DIO_CHANNEL index)=0
 Retrieve the raw value of the given digital channel. More...
 
virtual DIO_LEVEL libm2k::digital::M2kDigital::getValueRaw (unsigned int index)=0
 Retrieve the raw value of the given digital channel. More...
 
virtual void libm2k::digital::M2kDigital::stopBufferOut ()=0
 Stop all digital channels from sending the signals.
 
virtual void libm2k::digital::M2kDigital::startAcquisition (unsigned int nb_samples)=0
 Create the buffer for all channels and start the acquisition. More...
 
virtual void libm2k::digital::M2kDigital::stopAcquisition ()=0
 Destroy the buffer and stop the acquisition.
 
virtual void libm2k::digital::M2kDigital::cancelAcquisition ()=0
 Cancel all rx-buffer operations. More...
 
virtual void libm2k::digital::M2kDigital::cancelBufferOut ()=0
 Cancel all tx-buffer operations. More...
 
virtual std::vector< unsigned short > libm2k::digital::M2kDigital::getSamples (unsigned int nb_samples)=0
 Retrieve a specific number of samples. More...
 
virtual const unsigned short * libm2k::digital::M2kDigital::getSamplesP (unsigned int nb_samples)=0
 Retrieve a specific number of samples. More...
 
virtual void libm2k::digital::M2kDigital::enableChannel (unsigned int index, bool enable)=0
 Enable or disable the given digital channel. More...
 
virtual void libm2k::digital::M2kDigital::enableChannel (DIO_CHANNEL index, bool enable)=0
 Enable or disable the given digital channel. More...
 
virtual void libm2k::digital::M2kDigital::enableAllOut (bool enable)=0
 Enable or disable all output channels. More...
 
virtual bool libm2k::digital::M2kDigital::anyChannelEnabled (DIO_DIRECTION dir)=0
 Check if there is at least one channel enabled. More...
 
virtual void libm2k::digital::M2kDigital::setOutputMode (DIO_CHANNEL chn, DIO_MODE mode)=0
 Set the output mode for the given digital channel. More...
 
virtual void libm2k::digital::M2kDigital::setOutputMode (unsigned int chn, DIO_MODE mode)=0
 Set the output mode for the given digital channel. More...
 
virtual DIO_MODE libm2k::digital::M2kDigital::getOutputMode (DIO_CHANNEL chn)=0
 Retrieve the output mode for the given digital channel. More...
 
virtual DIO_MODE libm2k::digital::M2kDigital::getOutputMode (unsigned int chn)=0
 Retrieve the output mode for the given digital channel. More...
 
virtual double libm2k::digital::M2kDigital::setSampleRateIn (double samplerate)=0
 Set the sample rate for all digital input channels. More...
 
virtual double libm2k::digital::M2kDigital::setSampleRateOut (double samplerate)=0
 Set the sample rate for all digital output channels. More...
 
virtual double libm2k::digital::M2kDigital::getSampleRateIn ()=0
 Retrieve the sample rate of all digital input channels. More...
 
virtual double libm2k::digital::M2kDigital::getSampleRateOut ()=0
 Retrieve the sample rate of all digital output channels. More...
 
virtual bool libm2k::digital::M2kDigital::getCyclic ()=0
 Retrieve the value of the cyclic mode. More...
 
virtual void libm2k::digital::M2kDigital::setCyclic (bool cyclic)=0
 Enable or disable the cyclic mode for all digital channels. More...
 
virtual libm2k::M2kHardwareTriggerlibm2k::digital::M2kDigital::getTrigger ()=0
 Get the hardware trigger handler. More...
 
virtual void libm2k::digital::M2kDigital::setKernelBuffersCountIn (unsigned int count)=0
 Set the kernel buffers for input to a specific value. More...
 
virtual void libm2k::digital::M2kDigital::setKernelBuffersCountOut (unsigned int count)=0
 Set the kernel buffers for output to a specific value. More...
 
virtual struct IIO_OBJECTS libm2k::digital::M2kDigital::getIioObjects ()=0
 Get access to IIO channels, buffers, devices and context. Can be used when debugging directly with libiio. More...
 
virtual unsigned int libm2k::digital::M2kDigital::getNbChannelsIn ()=0
 Retrieve the number of digital input channels. More...
 
virtual unsigned int libm2k::digital::M2kDigital::getNbChannelsOut ()=0
 Retrieve the number of digital output channels. More...
 
virtual void libm2k::digital::M2kDigital::getSamples (std::vector< unsigned short > &data, unsigned int nb_samples)=0
 Retrieve a specific number of samples. More...
 
virtual void libm2k::digital::M2kDigital::setRateMux ()=0
 Force the digital interface to use the analogical rate. More...
 
virtual void libm2k::digital::M2kDigital::resetRateMux ()=0
 Reset the digital rate to default. More...
 
virtual void libm2k::digital::M2kDigital::setExternalClocksource (bool external)=0
 Set the clocksource. More...
 
virtual bool libm2k::digital::M2kDigital::isClocksourceExternal ()=0
 Get the current clocksource. More...
 

Detailed Description

Contains the representation of the digital segment.

Function Documentation

◆ anyChannelEnabled()

virtual bool libm2k::digital::M2kDigital::anyChannelEnabled ( DIO_DIRECTION  dir)
pure virtual

Check if there is at least one channel enabled.

Parameters
dirAn enumerator corresponding to the direction of a channel
Returns
On succces, true
Otherwise, false

◆ cancelAcquisition()

virtual void libm2k::digital::M2kDigital::cancelAcquisition ( )
pure virtual

Cancel all rx-buffer operations.

Note
Should be used to cancel an ongoing acquisition

◆ cancelBufferOut()

virtual void libm2k::digital::M2kDigital::cancelBufferOut ( )
pure virtual

Cancel all tx-buffer operations.

Note
Should be used to cancel an ongoing data write.

◆ enableAllOut()

virtual void libm2k::digital::M2kDigital::enableAllOut ( bool  enable)
pure virtual

Enable or disable all output channels.

Parameters
enableA boolean value corresponding to the channel's state
Note
This function affects only the TX channels

◆ enableChannel() [1/2]

virtual void libm2k::digital::M2kDigital::enableChannel ( unsigned int  index,
bool  enable 
)
pure virtual

Enable or disable the given digital channel.

Parameters
indexThe index corresponding to the channel
enableA boolean value corresponding to the channel's state
Note
This function affects only the TX channels

◆ enableChannel() [2/2]

virtual void libm2k::digital::M2kDigital::enableChannel ( DIO_CHANNEL  index,
bool  enable 
)
pure virtual

Enable or disable the given digital channel.

Parameters
indexAn enumerator corresponding to the channel's index
enableA boolean value corresponding to the channel's state
Note
This function affects only the TX channels

◆ getCyclic()

virtual bool libm2k::digital::M2kDigital::getCyclic ( )
pure virtual

Retrieve the value of the cyclic mode.

Returns
A boolean value corresponding to the state of the cyclic mode

◆ getDirection()

virtual DIO_DIRECTION libm2k::digital::M2kDigital::getDirection ( DIO_CHANNEL  index)
pure virtual

Retrieve the direction of the given digital channel.

Parameters
indexAn enumerator corresponding to the channel's index
Returns
DIO_DIRECTION An enumerator that indicates the direction of a channel

◆ getIioObjects()

virtual struct IIO_OBJECTS libm2k::digital::M2kDigital::getIioObjects ( )
pure virtual

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

Returns
IIO_OBJECTS structure.

◆ getNbChannelsIn()

virtual unsigned int libm2k::digital::M2kDigital::getNbChannelsIn ( )
pure virtual

Retrieve the number of digital input channels.

Returns
an unsigned int representing the number of digital IN channels

◆ getNbChannelsOut()

virtual unsigned int libm2k::digital::M2kDigital::getNbChannelsOut ( )
pure virtual

Retrieve the number of digital output channels.

Returns
an unsigned int representing the number of digital OUT channels

◆ getOutputMode() [1/2]

virtual DIO_MODE libm2k::digital::M2kDigital::getOutputMode ( DIO_CHANNEL  chn)
pure virtual

Retrieve the output mode for the given digital channel.

Parameters
chnAn enumerator corresponding to the channel's index
Returns
An enumerator corresponding to the output mode

◆ getOutputMode() [2/2]

virtual DIO_MODE libm2k::digital::M2kDigital::getOutputMode ( unsigned int  chn)
pure virtual

Retrieve the output mode for the given digital channel.

Parameters
chnThe index corresponding to the channel
Returns
An enumerator corresponding to the output mode

◆ getSampleRateIn()

virtual double libm2k::digital::M2kDigital::getSampleRateIn ( )
pure virtual

Retrieve the sample rate of all digital input channels.

Returns
The value of the sample rate

◆ getSampleRateOut()

virtual double libm2k::digital::M2kDigital::getSampleRateOut ( )
pure virtual

Retrieve the sample rate of all digital output channels.

Returns
The value of the sample rate

◆ getSamples() [1/2]

virtual std::vector<unsigned short> libm2k::digital::M2kDigital::getSamples ( unsigned int  nb_samples)
pure virtual

Retrieve a specific number of samples.

Parameters
nb_samplesThe number of samples that will be retrieved
Returns
A list that contains the samples
Note
Due to a hardware limitation, the number of samples must be a multiple of 4 and greater than 16.

◆ getSamples() [2/2]

virtual void libm2k::digital::M2kDigital::getSamples ( std::vector< unsigned short > &  data,
unsigned int  nb_samples 
)
pure virtual

Retrieve a specific number of samples.

Parameters
data- a reference to a vector owned/created by the client
nb_samplesThe number of samples that will be retrieved. The vector will be cleaned and then filled with samples.
Note
Due to a hardware limitation, the number of samples must be a multiple of 4 and greater than 16.

◆ getSamplesP()

virtual const unsigned short* libm2k::digital::M2kDigital::getSamplesP ( unsigned int  nb_samples)
pure virtual

Retrieve a specific number of samples.

Parameters
nb_samplesThe number of samples that will be retrieved
Returns
A pointer to the data
Note
Due to a hardware limitation, the number of samples must be a multiple of 4 and greater than 16.

◆ getTrigger()

virtual libm2k::M2kHardwareTrigger* libm2k::digital::M2kDigital::getTrigger ( )
pure virtual

Get the hardware trigger handler.

Returns
the trigger object

◆ getValueRaw() [1/2]

virtual DIO_LEVEL libm2k::digital::M2kDigital::getValueRaw ( DIO_CHANNEL  index)
pure virtual

Retrieve the raw value of the given digital channel.

Parameters
indexAn enumerator corresponding to the channel's index
Returns
DIO_LEVEL An enumerator corresponding to the raw value

◆ getValueRaw() [2/2]

virtual DIO_LEVEL libm2k::digital::M2kDigital::getValueRaw ( unsigned int  index)
pure virtual

Retrieve the raw value of the given digital channel.

Parameters
indexThe index corresponding to the channel
Returns
DIO_LEVEL An enumerator corresponding to the raw value

◆ isClocksourceExternal()

virtual bool libm2k::digital::M2kDigital::isClocksourceExternal ( )
pure virtual

Get the current clocksource.

Returns
True if clocksource is set to external
Note
Only available from firmware v0.26.

◆ push() [1/2]

virtual void libm2k::digital::M2kDigital::push ( std::vector< unsigned short > const &  data)
pure virtual

Send the samples to all digital channels.

Parameters
dataThe std vector that contains the samples
Note
Due to a hardware limitation, the number of samples must be a multiple of 4 and greater than 16.

◆ push() [2/2]

virtual void libm2k::digital::M2kDigital::push ( unsigned short *  data,
unsigned int  nb_samples 
)
pure virtual

Send the samples to all digital channels.

Parameters
dataa pointer to the samples
nb_samplesthe number of samples
Note
Due to a hardware limitation, the number of samples must be a multiple of 4 and greater than 16.

◆ resetRateMux()

virtual void libm2k::digital::M2kDigital::resetRateMux ( )
pure virtual

Reset the digital rate to default.

Note
Only available from firmware v0.26.

◆ setCyclic()

virtual void libm2k::digital::M2kDigital::setCyclic ( bool  cyclic)
pure virtual

Enable or disable the cyclic mode for all digital channels.

Parameters
cyclicIf true, enable cyclic mode

◆ setDirection() [1/5]

virtual void libm2k::digital::M2kDigital::setDirection ( unsigned short  mask)
pure virtual

Set the direction for all digital channels.

Parameters
maskA bitmask
Note
Each bit of the mask corresponds to the channel with the same index. The value of the bit represents the channel's direction. O - input, 1 - output

◆ setDirection() [2/5]

virtual void libm2k::digital::M2kDigital::setDirection ( unsigned int  index,
DIO_DIRECTION  dir 
)
pure virtual

Set the direction of the given digital channel.

Parameters
indexThe index corresponding to the channel
dirAn enumerator that indicates the direction of a channel

◆ setDirection() [3/5]

virtual void libm2k::digital::M2kDigital::setDirection ( unsigned int  index,
bool  dir 
)
pure virtual

Set the direction of the given digital channel.

Parameters
indexThe index corresponding to the channel
dirA boolean value that corresponds to one direction
Note
The boolean value for input direction is false and for output direction is true

◆ setDirection() [4/5]

virtual void libm2k::digital::M2kDigital::setDirection ( DIO_CHANNEL  index,
bool  dir 
)
pure virtual

Set the direction of the given digital channel.

Parameters
indexAn enumerator corresponding to the channel's index
dirA boolean value that corresponds to one direction
Note
The boolean value for input direction is false and for output direction is true

◆ setDirection() [5/5]

virtual void libm2k::digital::M2kDigital::setDirection ( DIO_CHANNEL  index,
DIO_DIRECTION  dir 
)
pure virtual

Set the direction of the given digital channel.

Parameters
indexAn enumerator corresponding to the channel's index
dirAn enumerator that indicates the direction of a channel

◆ setExternalClocksource()

virtual void libm2k::digital::M2kDigital::setExternalClocksource ( bool  external)
pure virtual

Set the clocksource.

Parameters
external- True to set source to external
  • False to set source to internal
Note
Only available from firmware v0.26.

◆ setKernelBuffersCountIn()

virtual void libm2k::digital::M2kDigital::setKernelBuffersCountIn ( unsigned int  count)
pure virtual

Set the kernel buffers for input to a specific value.

Parameters
countthe number of kernel buffers

◆ setKernelBuffersCountOut()

virtual void libm2k::digital::M2kDigital::setKernelBuffersCountOut ( unsigned int  count)
pure virtual

Set the kernel buffers for output to a specific value.

Parameters
countthe number of kernel buffers

◆ setOutputMode() [1/2]

virtual void libm2k::digital::M2kDigital::setOutputMode ( DIO_CHANNEL  chn,
DIO_MODE  mode 
)
pure virtual

Set the output mode for the given digital channel.

Parameters
chnAn enumerator corresponding to the channel's index
modeAn enumerator corresponding to the output mode

◆ setOutputMode() [2/2]

virtual void libm2k::digital::M2kDigital::setOutputMode ( unsigned int  chn,
DIO_MODE  mode 
)
pure virtual

Set the output mode for the given digital channel.

Parameters
chnThe index corresponding to the channel
modeAn enumerator corresponding to the output mode

◆ setRateMux()

virtual void libm2k::digital::M2kDigital::setRateMux ( )
pure virtual

Force the digital interface to use the analogical rate.

Note
Only available from firmware v0.26.

◆ setSampleRateIn()

virtual double libm2k::digital::M2kDigital::setSampleRateIn ( double  samplerate)
pure virtual

Set the sample rate for all digital input channels.

Parameters
samplerateA double value to set the sample rate to
Returns
The current sample rate for all digital input channels

◆ setSampleRateOut()

virtual double libm2k::digital::M2kDigital::setSampleRateOut ( double  samplerate)
pure virtual

Set the sample rate for all digital output channels.

Parameters
samplerateA double value to set the sample rate to
Returns
The current sample rate for all digital output channels

◆ setValueRaw() [1/3]

virtual void libm2k::digital::M2kDigital::setValueRaw ( DIO_CHANNEL  index,
DIO_LEVEL  level 
)
pure virtual

Set the raw value of a given digital channel.

Parameters
indexAn enumerator corresponding to the channel's index
levelAn enumerator corresponding to the raw value

◆ setValueRaw() [2/3]

virtual void libm2k::digital::M2kDigital::setValueRaw ( unsigned int  index,
DIO_LEVEL  level 
)
pure virtual

Set the raw value of a given digital channel.

Parameters
indexThe index corresponding to the channel
levelAn enumerator corresponding to the raw value

◆ setValueRaw() [3/3]

virtual void libm2k::digital::M2kDigital::setValueRaw ( DIO_CHANNEL  index,
bool  level 
)
pure virtual

Set the raw value of a given digital channel.

Parameters
indexAn enumerator corresponding to the channel's index
levelA boolean value corresponding to the raw value

◆ startAcquisition()

virtual void libm2k::digital::M2kDigital::startAcquisition ( unsigned int  nb_samples)
pure virtual

Create the buffer for all channels and start the acquisition.

Parameters
nb_samplessize of the buffer in samples