#include <devicelimesdr.h>
|
static bool | setNCOFrequency (lms_device_t *device, bool dir_tx, std::size_t chan, bool enable, float frequency) |
|
static bool | SetRFELNA_dB (lms_device_t *device, std::size_t chan, int value) |
|
static bool | SetRFETIA_dB (lms_device_t *device, std::size_t chan, int value) |
|
static bool | SetRBBPGA_dB (lms_device_t *device, std::size_t chan, float value) |
|
static bool | setRxAntennaPath (lms_device_t *device, std::size_t chan, int path) |
|
static bool | setTxAntennaPath (lms_device_t *device, std::size_t chan, int path) |
|
static bool | setClockSource (lms_device_t *device, bool extClock, uint32_t extClockFrequency) |
|
Definition at line 25 of file devicelimesdr.h.
◆ PathRxRFE
Enumerator |
---|
PATH_RFE_RX_NONE | |
PATH_RFE_LNAH | |
PATH_RFE_LNAL | |
PATH_RFE_LNAW | |
PATH_RFE_LB1 | |
PATH_RFE_LB2 | |
Definition at line 28 of file devicelimesdr.h.
◆ PathTxRFE
Enumerator |
---|
PATH_RFE_TX_NONE | |
PATH_RFE_TXRF1 | |
PATH_RFE_TXRF2 | |
Definition at line 38 of file devicelimesdr.h.
◆ setClockSource()
bool DeviceLimeSDR::setClockSource |
( |
lms_device_t * |
device, |
|
|
bool |
extClock, |
|
|
uint32_t |
extClockFrequency |
|
) |
| |
|
static |
Set clock source and external clock frequency if required
Definition at line 349 of file devicelimesdr.cpp.
Referenced by LimeSDROutput::applySettings(), and LimeSDRInput::applySettings().
353 if (LMS_SetClockFreq(device, LMS_CLOCK_EXTREF, (
float) extClockFrequency) < 0)
355 fprintf(stderr,
"DeviceLimeSDR::setClockSource: cannot set to external\n");
363 if (LMS_VCTCXORead(device, &vcoTrimValue))
365 fprintf(stderr,
"DeviceLimeSDR::setClockSource: cannot read VCTXO trim value\n");
369 if (LMS_VCTCXOWrite(device, vcoTrimValue))
371 fprintf(stderr,
"DeviceLimeSDR::setClockSource: cannot write VCTXO trim value\n");
◆ setNCOFrequency()
bool DeviceLimeSDR::setNCOFrequency |
( |
lms_device_t * |
device, |
|
|
bool |
dir_tx, |
|
|
std::size_t |
chan, |
|
|
bool |
enable, |
|
|
float |
frequency |
|
) |
| |
|
static |
set NCO frequency with positive or negative frequency (deals with up/down convert). Enables or disables NCO
Definition at line 23 of file devicelimesdr.cpp.
Referenced by LimeSDROutput::applySettings(), and LimeSDRInput::applySettings().
28 float_type freqs[LMS_NCO_VAL_COUNT];
29 float_type phos[LMS_NCO_VAL_COUNT];
31 if (LMS_GetNCOFrequency(device, dir_tx, chan, freqs, phos) < 0)
33 fprintf(stderr,
"DeviceLimeSDR::setNCOFrequency: cannot get NCO frequencies and phases\n");
39 frequency = -frequency;
48 if (LMS_SetNCOFrequency(device, dir_tx, chan, freqs, 0.0f) < 0)
50 fprintf(stderr,
"DeviceLimeSDR::setNCOFrequency: cannot set frequency to %f\n", frequency);
54 if (LMS_SetNCOIndex(device, dir_tx, chan, 0, dir_tx^positive) < 0)
56 fprintf(stderr,
"DeviceLimeSDR::setNCOFrequency: cannot set conversion direction %sfreq\n", positive ?
"+" :
"-");
62 if (LMS_WriteParam(device,LMS7param(CMIX_BYP_TXTSP),0) < 0) {
63 fprintf(stderr,
"DeviceLimeSDR::setNCOFrequency: cannot enable Tx NCO\n");
69 if (LMS_WriteParam(device,LMS7param(CMIX_BYP_RXTSP),0) < 0) {
70 fprintf(stderr,
"DeviceLimeSDR::setNCOFrequency: cannot enable Rx NCO\n");
81 if (LMS_WriteParam(device,LMS7param(CMIX_BYP_TXTSP),1) < 0) {
82 fprintf(stderr,
"DeviceLimeSDR::setNCOFrequency: cannot disable Tx NCO\n");
88 if (LMS_WriteParam(device,LMS7param(CMIX_BYP_RXTSP),1) < 0) {
89 fprintf(stderr,
"DeviceLimeSDR::setNCOFrequency: cannot disable Rx NCO\n");
◆ SetRBBPGA_dB()
bool DeviceLimeSDR::SetRBBPGA_dB |
( |
lms_device_t * |
device, |
|
|
std::size_t |
chan, |
|
|
float |
value |
|
) |
| |
|
static |
set PGA gain Range: [0-32] (dB)
Definition at line 163 of file devicelimesdr.cpp.
Referenced by LimeSDRInput::applySettings().
165 if (LMS_WriteParam(device, LMS7param(MAC), chan+1) < 0)
167 fprintf(stderr,
"DeviceLimeSDR::SetRBBPGA_dB: cannot set channel to #%lu\n", chan);
171 int g_pga_rbb = (int)(value + 12.5);
172 if (g_pga_rbb > 0x1f) g_pga_rbb = 0x1f;
173 if (g_pga_rbb < 0) g_pga_rbb = 0;
175 if (LMS_WriteParam(device, LMS7param(G_PGA_RBB), g_pga_rbb) < 0)
177 fprintf(stderr,
"DeviceLimeSDR::SetRBBPGA_dB: cannot set G_PGA_RBB to %d\n", g_pga_rbb);
181 int rcc_ctl_pga_rbb = (430.0*pow(0.65, (g_pga_rbb/10.0))-110.35)/20.4516 + 16;
183 int c_ctl_pga_rbb = 0;
184 if (g_pga_rbb < 8) { c_ctl_pga_rbb = 3; }
185 if (8 <= g_pga_rbb && g_pga_rbb < 13) { c_ctl_pga_rbb = 2; }
186 if (13 <= g_pga_rbb && g_pga_rbb < 21) { c_ctl_pga_rbb = 1; }
187 if (21 <= g_pga_rbb) { c_ctl_pga_rbb = 0; }
189 if (LMS_WriteParam(device, LMS7param(RCC_CTL_PGA_RBB), rcc_ctl_pga_rbb) < 0)
191 fprintf(stderr,
"DeviceLimeSDR::SetRBBPGA_dB: cannot set RCC_CTL_PGA_RBB to %d\n", rcc_ctl_pga_rbb);
195 if (LMS_WriteParam(device, LMS7param(C_CTL_PGA_RBB), c_ctl_pga_rbb) < 0)
197 fprintf(stderr,
"DeviceLimeSDR::SetRBBPGA_dB: cannot set C_CTL_PGA_RBB to %d\n", c_ctl_pga_rbb);
◆ SetRFELNA_dB()
bool DeviceLimeSDR::SetRFELNA_dB |
( |
lms_device_t * |
device, |
|
|
std::size_t |
chan, |
|
|
int |
value |
|
) |
| |
|
static |
set LNA gain Range: [1-30] (dB)
Definition at line 98 of file devicelimesdr.cpp.
Referenced by LimeSDRInput::applySettings().
100 if (LMS_WriteParam(device, LMS7param(MAC), chan+1) < 0)
102 fprintf(stderr,
"DeviceLimeSDR::SetRFELNA_dB: cannot set channel to #%lu\n", chan);
110 int val = value - 30;
113 if (val >= 0) g_lna_rfe = 15;
114 else if (val >= -1) g_lna_rfe = 14;
115 else if (val >= -2) g_lna_rfe = 13;
116 else if (val >= -3) g_lna_rfe = 12;
117 else if (val >= -4) g_lna_rfe = 11;
118 else if (val >= -5) g_lna_rfe = 10;
119 else if (val >= -6) g_lna_rfe = 9;
120 else if (val >= -9) g_lna_rfe = 8;
121 else if (val >= -12) g_lna_rfe = 7;
122 else if (val >= -15) g_lna_rfe = 6;
123 else if (val >= -18) g_lna_rfe = 5;
124 else if (val >= -21) g_lna_rfe = 4;
125 else if (val >= -24) g_lna_rfe = 3;
126 else if (val >= -27) g_lna_rfe = 2;
129 if (LMS_WriteParam(device, LMS7param(G_LNA_RFE), g_lna_rfe) < 0)
131 fprintf(stderr,
"DeviceLimeSDR::SetRFELNA_dB: cannot set LNA gain to %d (%d)\n", value, g_lna_rfe);
◆ SetRFETIA_dB()
bool DeviceLimeSDR::SetRFETIA_dB |
( |
lms_device_t * |
device, |
|
|
std::size_t |
chan, |
|
|
int |
value |
|
) |
| |
|
static |
set TIA gain Range: [1-3]
Definition at line 138 of file devicelimesdr.cpp.
Referenced by LimeSDRInput::applySettings().
140 if (LMS_WriteParam(device, LMS7param(MAC), chan+1) < 0)
142 fprintf(stderr,
"DeviceLimeSDR::SetRFETIA_dB: cannot set channel to #%lu\n", chan);
148 }
else if (value < 1) {
152 int g_tia_rfe = value;
154 if (LMS_WriteParam(device, LMS7param(G_TIA_RFE), g_tia_rfe) < 0)
156 fprintf(stderr,
"DeviceLimeSDR::SetRFELNA_dB: cannot set TIA gain to %d (%d)\n", value, g_tia_rfe);
◆ setRxAntennaPath()
bool DeviceLimeSDR::setRxAntennaPath |
( |
lms_device_t * |
device, |
|
|
std::size_t |
chan, |
|
|
int |
path |
|
) |
| |
|
static |
Set Rx antenna path
Definition at line 204 of file devicelimesdr.cpp.
References PATH_RFE_LB1, PATH_RFE_LB2, PATH_RFE_LNAH, PATH_RFE_LNAL, PATH_RFE_LNAW, and PATH_RFE_RX_NONE.
Referenced by LimeSDRInput::applySettings().
273 if (LMS_SetAntenna(device, LMS_CH_RX, chan, 1) < 0)
275 fprintf(stderr,
"DeviceLimeSDR::setRxAntennaPath: cannot set to LNAH\n");
280 if (LMS_SetAntenna(device, LMS_CH_RX, chan, 2) < 0)
282 fprintf(stderr,
"DeviceLimeSDR::setRxAntennaPath: cannot set to LNAL\n");
287 if (LMS_SetAntenna(device, LMS_CH_RX, chan, 3) < 0)
289 fprintf(stderr,
"DeviceLimeSDR::setRxAntennaPath: cannot set to LNAW\n");
294 if (LMS_SetAntenna(device, LMS_CH_TX, chan, 1) < 0)
296 fprintf(stderr,
"DeviceLimeSDR::setRxAntennaPath: cannot set to Loopback TX1\n");
301 if (LMS_SetAntenna(device, LMS_CH_TX, chan, 2) < 0)
303 fprintf(stderr,
"DeviceLimeSDR::setRxAntennaPath: cannot set to Loopback TX2\n");
309 if (LMS_SetAntenna(device, LMS_CH_RX, chan, 0) < 0)
311 fprintf(stderr,
"DeviceLimeSDR::setRxAntennaPath: cannot set to none\n");
◆ setTxAntennaPath()
bool DeviceLimeSDR::setTxAntennaPath |
( |
lms_device_t * |
device, |
|
|
std::size_t |
chan, |
|
|
int |
path |
|
) |
| |
|
static |
Set Tx antenna path
Definition at line 319 of file devicelimesdr.cpp.
References PATH_RFE_TX_NONE, PATH_RFE_TXRF1, and PATH_RFE_TXRF2.
Referenced by LimeSDROutput::applySettings().
324 if (LMS_SetAntenna(device, LMS_CH_TX, chan, 1) < 0)
326 fprintf(stderr,
"DeviceLimeSDR::setTxAntennaPath: cannot set to TXRF1\n");
331 if (LMS_SetAntenna(device, LMS_CH_TX, chan, 2) < 0)
333 fprintf(stderr,
"DeviceLimeSDR::setTxAntennaPath: cannot set to TXRF2\n");
339 if (LMS_SetAntenna(device, LMS_CH_TX, chan, 0) < 0)
341 fprintf(stderr,
"DeviceLimeSDR::setTxAntennaPath: cannot set to none\n");
The documentation for this class was generated from the following files: