1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-03 22:45:05 -04:00

XTRX input: refactoring to prepare MI operation

This commit is contained in:
f4exb
2018-12-31 01:43:24 +01:00
parent 2eb78ebad8
commit e2085e8c29
10 changed files with 647 additions and 469 deletions
+37
View File
@@ -14,6 +14,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <QDebug>
#include "xtrx_api.h"
#include "devicextrx.h"
const uint32_t DeviceXTRX::m_lnaTbl[m_nbGains] = {
@@ -32,6 +35,40 @@ const uint32_t DeviceXTRX::m_pgaTbl[m_nbGains] = {
22, 23, 24, 25, 26, 27, 28, 29, 30, 31
};
DeviceXTRX::DeviceXTRX() :
m_dev(0)
{}
DeviceXTRX::~DeviceXTRX()
{
close();
}
bool DeviceXTRX::open(const char* deviceStr)
{
int res;
qDebug("DeviceXTRX::open: serial: %s", (const char *) deviceStr);
res = xtrx_open(deviceStr, XTRX_O_RESET | 4, &m_dev);
if (res)
{
qCritical() << "DeviceXTRX::open: cannot open device " << deviceStr;
return false;
}
return true;
}
void DeviceXTRX::close()
{
if (m_dev)
{
xtrx_close(m_dev);
m_dev = 0;
}
}
void DeviceXTRX::getAutoGains(uint32_t autoGain, uint32_t& lnaGain, uint32_t& tiaGain, uint32_t& pgaGain)
{
uint32_t value = autoGain + 12 > 73 ? 73 : autoGain + 12;