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)
 
void open_device (int device_number, int device_type)
 
void close_device (int device_number)
 
void close_all_devices ()
 
void check_blocks (int device_number, int block_type, int device_type, int chip_mode, double sample_rate, size_t oversample, int file_switch, const char *filename)
 
void settings_from_file (int device_number, const char *filename)
 
void set_chip_mode (int device_number, int device_type, int chip_mode, int channel, bool direction)
 
void set_samp_rate (int device_number, const double rate, size_t oversample)
 
void set_samp_rate_dir (int device_number, const int direction, const double rate, size_t oversample)
 
void set_rf_freq (int device_number, int device_type, bool direction, int channel, float rf_freq)
 
void calibrate (int device_number, int device_type, int calibration, int direction, int channel, double bandwidth, float rf_freq, int path)
 
void mini_switch_workaround (int device_number)
 
void set_lna_path_mini (int device_number, int lna_path_mini)
 
void set_lna_path (int device_number, int channel, int lna_path)
 
void set_pa_path_mini (int device_number, int pa_path_mini)
 
void set_pa_path (int device_number, int channel, int pa_path)
 
void set_analog_filter (int device_number, bool direction, int channel, int analog_filter, float analog_bandw)
 
void set_digital_filter (int device_number, bool direction, int channel, int digital_filter, float digital_bandw)
 
void set_gain (int device_number, bool direction, int channel, unsigned int gain_dB)
 

Static Public Member Functions

static device_handlergetInstance ()
 

Constructor & Destructor Documentation

◆ ~device_handler()

device_handler::~device_handler ( )

Referenced by getInstance().

Member Function Documentation

◆ calibrate()

void device_handler::calibrate ( int  device_number,
int  device_type,
int  calibration,
int  direction,
int  channel,
double  bandwidth,
float  rf_freq,
int  path 
)

Perform device calibration.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
device_typeLimeSDR-Mini(1), LimeSDR-USB(2).
calibrationTurn calibration: OFF(0),ON(1).
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.
rf_freqPass RF frequency in Hz for calibration.
pathPass path for calibration.
Note
rf_freq and path are necessary in order to perform calibration for LNAL (matching) and center frequencies below 30 MHz (NCO).

Referenced by getInstance().

◆ check_blocks()

void device_handler::check_blocks ( int  device_number,
int  block_type,
int  device_type,
int  chip_mode,
double  sample_rate,
size_t  oversample,
int  file_switch,
const char *  filename 
)

Check what blocks are used for single device.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
device_typeLimeSDR-Mini(1), LimeSDR-USB(2).
chip_modeSISO(1), MIMO(2).
samp_rateSample rate in Hz.
oversampleOversampling value (0 (default),1,2,4,8,16,32).
file_switchLoad settings from file: NO(0),YES(1).
filenamePath to file if file switch is turned on.

Referenced by getInstance().

◆ close_all_devices()

void device_handler::close_all_devices ( )

Disconnect from all devices.

Referenced by getInstance().

◆ close_device()

void device_handler::close_device ( int  device_number)

Disconnect from the device.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.

Referenced by getInstance().

◆ 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.

Referenced by getInstance().

◆ 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.

Referenced by getInstance().

◆ getInstance()

◆ mini_switch_workaround()

void device_handler::mini_switch_workaround ( int  device_number)

Workaround for LimeSDR-Mini switch bug. Call upon implementation.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.

Referenced by getInstance().

◆ open_device()

void device_handler::open_device ( int  device_number,
int  device_type 
)

Connect to the device and create singletone.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
device_typeLimeSDR-Mini(1), LimeSDR-USB(2).

Referenced by getInstance().

◆ set_analog_filter()

void device_handler::set_analog_filter ( int  device_number,
bool  direction,
int  channel,
int  analog_filter,
float  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_filterTurn analog filter: OFF(0),ON(1).
analog_bandwChannel filter bandwidth in Hz.

Referenced by getInstance().

◆ set_chip_mode()

void device_handler::set_chip_mode ( int  device_number,
int  device_type,
int  chip_mode,
int  channel,
bool  direction 
)

Set chip mode (single-input single-output/multiple-input multiple-output) and check if the device supports it.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
device_typeLimeSDR-Mini(1), LimeSDR-USB(2).
chip_modeSISO(1), MIMO(2).

Referenced by getInstance().

◆ set_digital_filter()

void device_handler::set_digital_filter ( int  device_number,
bool  direction,
int  channel,
int  digital_filter,
float  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_filterTurn digital filter: OFF(0),ON(1).
digital_bandwChannel filter bandwidth in Hz.

Referenced by getInstance().

◆ set_gain()

void device_handler::set_gain ( int  device_number,
bool  direction,
int  channel,
unsigned int  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 levle may be different when those values are changed
Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
directionSelect RX or TX.
channelChannel index.
gain_dBDesired gain: [0,70] RX, [0,60] TX.

Referenced by getInstance().

◆ set_lna_path()

void device_handler::set_lna_path ( int  device_number,
int  channel,
int  lna_path 
)

Set LNA path.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
channelChannel selection: A(LMS_CH_0),B(LMS_CH_1).
lna_pathLNA path: no path(0),LNAH(1),LNAL(2),LNAW(3).

Referenced by getInstance().

◆ set_lna_path_mini()

void device_handler::set_lna_path_mini ( int  device_number,
int  lna_path_mini 
)

LNA switch for LimeSDR-Mini.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
lna_path_miniLNA switch: LNAH(1),LNAW(3).

Referenced by getInstance().

◆ set_pa_path()

void device_handler::set_pa_path ( int  device_number,
int  channel,
int  pa_path 
)

Set PA path.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
channelChannel selection: A(LMS_CH_0),B(LMS_CH_1).
pa_pathPA path: BAND1(1),BAND2(2).

Referenced by getInstance().

◆ set_pa_path_mini()

void device_handler::set_pa_path_mini ( int  device_number,
int  pa_path_mini 
)

PA switch for LimeSDR-Mini.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
pa_path_miniPA path: BAND1(1),BAND2(2).

Referenced by getInstance().

◆ set_rf_freq()

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

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

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
device_typeLimeSDR-Mini(1), LimeSDR-USB(2).
directionDirection of samples RX(LMS_CH_RX), TX(LMS_CH_TX).
rf_freqRF frequency in Hz.

Referenced by getInstance().

◆ set_samp_rate()

void device_handler::set_samp_rate ( int  device_number,
const double  rate,
size_t  oversample 
)

Set the same sample rate for both channels.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
samp_rateSample rate in S/s.
oversampleOversampling value (0 (default),1,2,4,8,16,32).

Referenced by getInstance().

◆ set_samp_rate_dir()

void device_handler::set_samp_rate_dir ( int  device_number,
const int  direction,
const double  rate,
size_t  oversample 
)

Set sample rate for both channels (RX and TX seperately).

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
directionDirection of samples RX(LMS_CH_RX), TX(LMS_CH_RX).
samp_rateSample rate in S/s.
oversampleOversampling value (0 (default),1,2,4,8,16,32).

Referenced by getInstance().

◆ settings_from_file()

void device_handler::settings_from_file ( int  device_number,
const char *  filename 
)

Load settings from .ini file.

Parameters
device_numberDevice number from the list of LMS_GetDeviceList.
filenamePath to file if file switch is turned on.

Referenced by getInstance().


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