1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 12:51:49 -05:00

Added support for HackRF. Interim state #2

This commit is contained in:
f4exb 2015-09-25 08:30:22 +02:00
parent 2932cbfdc3
commit 3be1a1a3e2
7 changed files with 73 additions and 19 deletions

View File

@ -107,7 +107,7 @@ void HackRFGui::handleSourceMessages()
while ((message = m_sampleSource->getOutputMessageQueueToGUI()->pop()) != 0) while ((message = m_sampleSource->getOutputMessageQueueToGUI()->pop()) != 0)
{ {
qDebug("AirspyGui::HandleSourceMessages: message: %s", message->getIdentifier()); qDebug("HackRFGui::HandleSourceMessages: message: %s", message->getIdentifier());
if (handleMessage(*message)) if (handleMessage(*message))
{ {
@ -132,9 +132,13 @@ void HackRFGui::displaySettings()
ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos); ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos);
ui->lnaExt->setChecked(m_settings.m_lnaExt);
ui->lnaGainText->setText(tr("%1dB").arg(m_settings.m_lnaGain)); ui->lnaGainText->setText(tr("%1dB").arg(m_settings.m_lnaGain));
ui->lna->setValue(m_settings.m_lnaGain); ui->lna->setValue(m_settings.m_lnaGain);
ui->rej->setCurrentIndex(m_settings.m_imjRejFilterIndex);
ui->bbFilter->setCurrentIndex(m_settings.m_bandwidthIndex);
ui->vgaText->setText(tr("%1dB").arg(m_settings.m_vgaGain)); ui->vgaText->setText(tr("%1dB").arg(m_settings.m_vgaGain));
ui->vga->setValue(m_settings.m_vgaGain); ui->vga->setValue(m_settings.m_vgaGain);
} }
@ -233,12 +237,30 @@ void HackRFGui::on_sampleRate_currentIndexChanged(int index)
sendSettings(); sendSettings();
} }
void HackRFGui::on_rej_currentIndexChanged(int index)
{
m_settings.m_imjRejFilterIndex = index;
sendSettings();
}
void HackRFGui::on_bbFilter_currentIndexChanged(int index)
{
m_settings.m_bandwidthIndex = index;
sendSettings();
}
void HackRFGui::on_biasT_stateChanged(int state) void HackRFGui::on_biasT_stateChanged(int state)
{ {
m_settings.m_biasT = (state == Qt::Checked); m_settings.m_biasT = (state == Qt::Checked);
sendSettings(); sendSettings();
} }
void HackRFGui::on_lnaExt_stateChanged(int state)
{
m_settings.m_lnaExt = (state == Qt::Checked);
sendSettings();
}
void HackRFGui::on_decim_valueChanged(int value) void HackRFGui::on_decim_valueChanged(int value)
{ {
if ((value <0) || (value > 6)) if ((value <0) || (value > 6))

View File

@ -76,7 +76,10 @@ private slots:
void on_biasT_stateChanged(int state); void on_biasT_stateChanged(int state);
void on_decim_valueChanged(int value); void on_decim_valueChanged(int value);
void on_fcPos_currentIndexChanged(int index); void on_fcPos_currentIndexChanged(int index);
void on_lnaExt_stateChanged(int state);
void on_lna_valueChanged(int value); void on_lna_valueChanged(int value);
void on_rej_currentIndexChanged(int index);
void on_bbFilter_currentIndexChanged(int index);
void on_vga_valueChanged(int value); void on_vga_valueChanged(int value);
void updateHardware(); void updateHardware();
void handleSourceMessages(); void handleSourceMessages();

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>198</width> <width>215</width>
<height>214</height> <height>220</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -224,7 +224,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QGridLayout" name="gridLayout_fcPos" columnstretch="0,0,0"> <layout class="QGridLayout" name="gridLayout_fcPos" columnstretch="0,0,0,0">
<property name="spacing"> <property name="spacing">
<number>3</number> <number>3</number>
</property> </property>
@ -235,7 +235,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="3">
<spacer name="fcPosRightSpacer"> <spacer name="fcPosRightSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -267,6 +267,19 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="0" column="2">
<widget class="QCheckBox" name="lnaExt">
<property name="toolTip">
<string>Extra LNA</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>LNA Ext</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>

View File

@ -34,11 +34,13 @@ HackRFInput::Settings::Settings() :
m_devSampleRateIndex(0), m_devSampleRateIndex(0),
m_LOppmTenths(0), m_LOppmTenths(0),
m_lnaGain(14), m_lnaGain(14),
m_mixerGain(15), m_imjRejFilterIndex(0),
m_bandwidthIndex(0),
m_vgaGain(4), m_vgaGain(4),
m_log2Decim(0), m_log2Decim(0),
m_fcPos(FC_POS_CENTER), m_fcPos(FC_POS_CENTER),
m_biasT(false) m_biasT(false),
m_lnaExt(false)
{ {
} }
@ -48,11 +50,13 @@ void HackRFInput::Settings::resetToDefaults()
m_devSampleRateIndex = 0; m_devSampleRateIndex = 0;
m_LOppmTenths = 0; m_LOppmTenths = 0;
m_lnaGain = 14; m_lnaGain = 14;
m_mixerGain = 15; m_imjRejFilterIndex = 0;
m_bandwidthIndex = 0;
m_vgaGain = 4; m_vgaGain = 4;
m_log2Decim = 0; m_log2Decim = 0;
m_fcPos = FC_POS_CENTER; m_fcPos = FC_POS_CENTER;
m_biasT = false; m_biasT = false;
m_lnaExt = false;
} }
QByteArray HackRFInput::Settings::serialize() const QByteArray HackRFInput::Settings::serialize() const
@ -65,9 +69,11 @@ QByteArray HackRFInput::Settings::serialize() const
data.m_log2Decim = m_log2Decim; data.m_log2Decim = m_log2Decim;
data.m_fcPos = (qint32) m_fcPos; data.m_fcPos = (qint32) m_fcPos;
data.m_lnaGain = m_lnaGain; data.m_lnaGain = m_lnaGain;
data.m_mixerGain = m_mixerGain; data.m_imjRejFilterIndex = m_imjRejFilterIndex;
data.m_bandwidthIndex = m_bandwidthIndex;
data.m_vgaGain = m_vgaGain; data.m_vgaGain = m_vgaGain;
data.m_biasT = m_biasT; data.m_biasT = m_biasT;
data.m_lnaExt = m_lnaExt;
QByteArray byteArray; QByteArray byteArray;
@ -88,9 +94,11 @@ bool HackRFInput::Settings::deserialize(const QByteArray& serializedData)
m_log2Decim = data.m_log2Decim; m_log2Decim = data.m_log2Decim;
m_fcPos = (fcPos_t) data.m_fcPos; m_fcPos = (fcPos_t) data.m_fcPos;
m_lnaGain = data.m_lnaGain; m_lnaGain = data.m_lnaGain;
m_mixerGain = data.m_mixerGain; m_imjRejFilterIndex = data.m_imjRejFilterIndex;
m_bandwidthIndex = data.m_bandwidthIndex;
m_vgaGain = data.m_vgaGain; m_vgaGain = data.m_vgaGain;
m_biasT = data.m_biasT; m_biasT = data.m_biasT;
m_lnaExt = data.m_lnaExt;
return valid; return valid;
} }

View File

@ -38,11 +38,11 @@ public:
quint32 m_bandwidthIndex; quint32 m_bandwidthIndex;
quint32 m_imjRejFilterIndex; quint32 m_imjRejFilterIndex;
quint32 m_lnaGain; quint32 m_lnaGain;
quint32 m_mixerGain;
quint32 m_vgaGain; quint32 m_vgaGain;
quint32 m_log2Decim; quint32 m_log2Decim;
fcPos_t m_fcPos; fcPos_t m_fcPos;
bool m_biasT; bool m_biasT;
bool m_lnaExt;
Settings(); Settings();
void resetToDefaults(); void resetToDefaults();

View File

@ -29,9 +29,11 @@ void HackRFSerializer::writeSerializedData(const AirspyData& data, QByteArray& s
s.writeU32(4, data.m_log2Decim); s.writeU32(4, data.m_log2Decim);
s.writeS32(5, data.m_fcPos); s.writeS32(5, data.m_fcPos);
s.writeU32(6, data.m_lnaGain); s.writeU32(6, data.m_lnaGain);
s.writeU32(7, data.m_mixerGain); s.writeU32(7, data.m_imjRejFilterIndex);
s.writeU32(8, data.m_vgaGain); s.writeU32(8, data.m_bandwidthIndex);
s.writeBool(9, data.m_biasT); s.writeU32(9, data.m_vgaGain);
s.writeBool(10, data.m_biasT);
s.writeBool(11, data.m_lnaExt);
serializedData = s.final(); serializedData = s.final();
} }
@ -60,9 +62,11 @@ bool HackRFSerializer::readSerializedData(const QByteArray& serializedData, Airs
d.readU32(4, &data.m_log2Decim, 0); d.readU32(4, &data.m_log2Decim, 0);
d.readS32(5, &data.m_fcPos, 0); d.readS32(5, &data.m_fcPos, 0);
d.readU32(6, &data.m_lnaGain, 14); d.readU32(6, &data.m_lnaGain, 14);
d.readU32(7, &data.m_mixerGain, 15); d.readU32(7, &data.m_imjRejFilterIndex, 0);
d.readU32(8, &data.m_vgaGain, 4); d.readU32(8, &data.m_bandwidthIndex, 0);
d.readBool(9, &data.m_biasT, false); d.readU32(9, &data.m_vgaGain, 4);
d.readBool(10, &data.m_biasT, false);
d.readBool(11, &data.m_lnaExt, false);
return SampleSourceSerializer::readSerializedData(sampleSourceSerialized, data.m_data); return SampleSourceSerializer::readSerializedData(sampleSourceSerialized, data.m_data);
} }
@ -80,7 +84,9 @@ void HackRFSerializer::setDefaults(AirspyData& data)
data.m_log2Decim = 0; data.m_log2Decim = 0;
data.m_fcPos = 0; data.m_fcPos = 0;
data.m_lnaGain = 14; data.m_lnaGain = 14;
data.m_mixerGain = 15; data.m_imjRejFilterIndex = 0;
data.m_bandwidthIndex = 0;
data.m_vgaGain = 4; data.m_vgaGain = 4;
data.m_biasT = false; data.m_biasT = false;
data.m_lnaExt = false;
} }

View File

@ -30,9 +30,11 @@ public:
quint32 m_log2Decim; quint32 m_log2Decim;
qint32 m_fcPos; qint32 m_fcPos;
quint32 m_lnaGain; quint32 m_lnaGain;
quint32 m_mixerGain; quint32 m_imjRejFilterIndex;
quint32 m_bandwidthIndex;
quint32 m_vgaGain; quint32 m_vgaGain;
bool m_biasT; bool m_biasT;
bool m_lnaExt;
}; };
static void writeSerializedData(const AirspyData& data, QByteArray& serializedData); static void writeSerializedData(const AirspyData& data, QByteArray& serializedData);