GNU Radio's LIMESDR Package
device_handler Class Reference

#include <device_handler.h>

Public Member Functions

 ~device_handler ()
 
void error (int device_number)
 
lms_device_t * get_device (int device_number)
 
int open_device (std::string &serial)
 
void close_device (int device_number, int block_type)
 
void close_all_devices ()
 
void check_blocks (int device_number, int block_type, int channel_mode, const std::string &filename)
 
void settings_from_file (int device_number, const std::string &filename, int *antenna_tx)
 
void enable_channels (int device_number, int channel_mode, bool direction)
 
void set_samp_rate (int device_number, double &rate)
 
void set_oversampling (int device_number, int oversample)
 
double set_rf_freq (int device_number, bool direction, int channel, float rf_freq)
 
void calibrate (int device_number, int direction, int channel, double bandwidth)
 
void set_antenna (int device_number, int channel, int direction, int antenna)
 
double set_analog_filter (int device_number, bool direction, int channel, double analog_bandw)
 
double set_digital_filter (int device_number, bool direction, int channel, double digital_bandw)
 
unsigned set_gain (int device_number, bool direction, int channel, unsigned gain_dB)
 
void set_nco (int device_number, bool direction, int channel, float nco_freq)
 
void disable_DC_corrections (int device_number)
 
void set_tcxo_dac (int device_number, uint16_t dacVal)
 
void set_rfe_device (rfe_dev_t *rfe_dev)
 
void update_rfe_channels ()
 
void write_lms_reg (int device_number, uint32_t address, uint16_t val)
 
void set_gpio_dir (int device_number, uint8_t dir)
 
void write_gpio (int device_number, uint8_t out)
 
uint8_t read_gpio (int device_number)
 

Static Public Member Functions

static device_handlergetInstance ()
 

Public Attributes

std::recursive_mutex block_mutex
 

Constructor & Destructor Documentation

◆ ~device_handler()

device_handler::~device_handler ( )

Member Function Documentation

◆ calibrate()

void device_handler::calibrate ( int  device_number,
int  direction,
int  channel,
double  bandwidth 
)

Perform device calibration.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
directionDirection of samples: RX(LMS_CH_RX),TX(LMS_CH_RX).
channelChannel selection: A(LMS_CH_0),B(LMS_CH_1).
bandwidthSet calibration bandwidth in Hz.

◆ check_blocks()

void device_handler::check_blocks ( int  device_number,
int  block_type,
int  channel_mode,
const std::string &  filename 
)

Check what blocks are used for single device.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
block_typeSource block(1), Sink block(2).
channel_modeChannel A(0), Channel B(1), MIMO(2)
filenamePath to file if file switch is turned on.

◆ close_all_devices()

void device_handler::close_all_devices ( )

Disconnect from all devices.

◆ close_device()

void device_handler::close_device ( int  device_number,
int  block_type 
)

Disconnect from the device.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
block_typeSource block(1), Sink block(2).

◆ disable_DC_corrections()

void device_handler::disable_DC_corrections ( int  device_number)

Disables LimeSDR boards DC corrections

◆ enable_channels()

void device_handler::enable_channels ( int  device_number,
int  channel_mode,
bool  direction 
)

Set used channels

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
channel_modeChannel A(0), Channel B(1), MIMO(2)
directionDirection of samples RX(LMS_CH_RX), TX(LMS_CH_RX).

◆ error()

void device_handler::error ( int  device_number)

Print device error and close all devices.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.

◆ get_device()

lms_device_t * device_handler::get_device ( int  device_number)

Get device connection handler in order to configure it.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.

◆ getInstance()

static device_handler & device_handler::getInstance ( )
inlinestatic

◆ open_device()

int device_handler::open_device ( std::string &  serial)

Connect to the device and create singletone.

Parameters
serialDevice serial from the list of LMS_GetDeviceList.

◆ read_gpio()

uint8_t device_handler::read_gpio ( int  device_number)

◆ set_analog_filter()

double device_handler::set_analog_filter ( int  device_number,
bool  direction,
int  channel,
double  analog_bandw 
)

Set analog filters.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
directionDirection of samples: RX(LMS_CH_RX),TX(LMS_CH_TX).
channelChannel selection: A(LMS_CH_0),B(LMS_CH_1).
analog_bandwChannel filter bandwidth in Hz.

◆ set_antenna()

void device_handler::set_antenna ( int  device_number,
int  channel,
int  direction,
int  antenna 
)

Set which antenna is used

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
channelChannel selection: A(LMS_CH_0),B(LMS_CH_1).
directionDirection of samples: RX(LMS_CH_RX),TX(LMS_CH_RX).
antennaAntenna to set: None(0), LNAH(1), LNAL(2), LNAW(3) for RX None(0), BAND1(1), BAND(2), NONE(3) for TX

◆ set_digital_filter()

double device_handler::set_digital_filter ( int  device_number,
bool  direction,
int  channel,
double  digital_bandw 
)

Set digital filters (GFIR).

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
directionDirection of samples: RX(LMS_CH_RX),TX(LMS_CH_TX).
channelChannel selection: A(LMS_CH_0),B(LMS_CH_1).
digital_bandwChannel filter bandwidth in Hz.

◆ set_gain()

unsigned device_handler::set_gain ( int  device_number,
bool  direction,
int  channel,
unsigned  gain_dB 
)

Set the combined gain value in dB This function computes and sets the optimal gain values of various amplifiers that are present in the device based on desired gain value in dB.

Note
actual gain depends on LO frequency and analog LPF configuration and resulting output signal level may be different when those values are changed
Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
directionSelect RX or TX.
channelChannel selection: A(LMS_CH_0),B(LMS_CH_1).
gain_dBDesired gain: [0,73] dB

◆ set_gpio_dir()

void device_handler::set_gpio_dir ( int  device_number,
uint8_t  dir 
)

◆ set_nco()

void device_handler::set_nco ( int  device_number,
bool  direction,
int  channel,
float  nco_freq 
)

Set NCO (numerically controlled oscillator). By selecting NCO frequency configure NCO. When NCO frequency is 0, NCO is off.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
directionSelect RX or TX.
channelChannel index.
nco_freqNCO frequency in Hz.

◆ set_oversampling()

void device_handler::set_oversampling ( int  device_number,
int  oversample 
)

Set oversampling value for both channels

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
oversampleOversampling value (0 (default),1,2,4,8,16,32).

◆ set_rf_freq()

double device_handler::set_rf_freq ( int  device_number,
bool  direction,
int  channel,
float  rf_freq 
)

Set RF frequency of both channels (RX and TX separately).

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
directionDirection of samples RX(LMS_CH_RX), TX(LMS_CH_TX).
channelselection: A(LMS_CH_0),B(LMS_CH_1).
rf_freqRF frequency in Hz.
Returns
returns RF frequency in Hz

◆ set_rfe_device()

void device_handler::set_rfe_device ( rfe_dev_t *  rfe_dev)

Sets up LimeRFE device pointer so that automatic channel configuration could be made

Parameters
rfe_devPointer to LimeRFE device descriptor

◆ set_samp_rate()

void device_handler::set_samp_rate ( int  device_number,
double &  rate 
)

Set the same sample rate for both channels.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
rateSample rate in S/s.

◆ set_tcxo_dac()

void device_handler::set_tcxo_dac ( int  device_number,
uint16_t  dacVal 
)

Set TCXO DAC.

Note
Care must be taken as this parameter is returned to default value only after power off.
LimeSDR-Mini default value is 180 range is [0,255] LimeSDR-USB default value is 125 range is [0,255] LimeSDR-PCIe default value is 134 range is [0,255] LimeNET-Micro default value is 30714 range is [0,65535]
Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
dacValDAC value (0-65535)

◆ settings_from_file()

void device_handler::settings_from_file ( int  device_number,
const std::string &  filename,
int *  antenna_tx 
)

Load settings from .ini file.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
filenamePath to file if file switch is turned on.
antenna_txPointer to TX antenna, so PA path would be updated in sink block

◆ update_rfe_channels()

void device_handler::update_rfe_channels ( )

Assigns configured LimeSDR channels to LimeRFE for automatic channel switching

◆ write_gpio()

void device_handler::write_gpio ( int  device_number,
uint8_t  out 
)

◆ write_lms_reg()

void device_handler::write_lms_reg ( int  device_number,
uint32_t  address,
uint16_t  val 
)

Writes an LMS register by calling LMS_WriteLMSReg()

Member Data Documentation

◆ block_mutex

std::recursive_mutex device_handler::block_mutex
mutable

The documentation for this class was generated from the following file: