mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-03 00:48:30 -04:00
HackRF support: changed sample rates to sample precision
This commit is contained in:
parent
06dc97c91c
commit
f7d7551d01
@ -16,17 +16,32 @@
|
|||||||
|
|
||||||
#include "devicehackrfvalues.h"
|
#include "devicehackrfvalues.h"
|
||||||
|
|
||||||
unsigned int HackRFSampleRates::m_rates_k[] = {2400, 3200, 4000, 4800, 5600, 6000, 6400, 8000, 9600, 12000, 12800, 16000, 18000, 19200, 20000};
|
unsigned int HackRFSampleRates::m_rates[] = {
|
||||||
|
2400000,
|
||||||
|
3200000,
|
||||||
|
4000000,
|
||||||
|
4800000,
|
||||||
|
5600000,
|
||||||
|
6000000,
|
||||||
|
6400000,
|
||||||
|
8000000,
|
||||||
|
9600000,
|
||||||
|
12000000,
|
||||||
|
12800000,
|
||||||
|
16000000,
|
||||||
|
18000000,
|
||||||
|
19200000,
|
||||||
|
20000000};
|
||||||
|
|
||||||
unsigned int HackRFSampleRates::getRate(unsigned int rate_index)
|
unsigned int HackRFSampleRates::getRate(unsigned int rate_index)
|
||||||
{
|
{
|
||||||
if (rate_index < m_nb_rates)
|
if (rate_index < m_nb_rates)
|
||||||
{
|
{
|
||||||
return m_rates_k[rate_index];
|
return m_rates[rate_index];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return m_rates_k[0];
|
return m_rates[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +49,7 @@ unsigned int HackRFSampleRates::getRateIndex(unsigned int rate)
|
|||||||
{
|
{
|
||||||
for (unsigned int i=0; i < m_nb_rates; i++)
|
for (unsigned int i=0; i < m_nb_rates; i++)
|
||||||
{
|
{
|
||||||
if (rate == m_rates_k[i])
|
if (rate == m_rates[i])
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@ -43,7 +58,23 @@ unsigned int HackRFSampleRates::getRateIndex(unsigned int rate)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int HackRFBandwidths::m_bw_k[] = {1750, 2500, 3500, 5000, 5500, 6000, 7000, 8000, 9000, 10000, 12000, 14000, 15000, 20000, 24000, 28000};
|
unsigned int HackRFBandwidths::m_bw_k[] = {
|
||||||
|
1750,
|
||||||
|
2500,
|
||||||
|
3500,
|
||||||
|
5000,
|
||||||
|
5500,
|
||||||
|
6000,
|
||||||
|
7000,
|
||||||
|
8000,
|
||||||
|
9000,
|
||||||
|
10000,
|
||||||
|
12000,
|
||||||
|
14000,
|
||||||
|
15000,
|
||||||
|
20000,
|
||||||
|
24000,
|
||||||
|
28000};
|
||||||
|
|
||||||
unsigned int HackRFBandwidths::getBandwidth(unsigned int bandwidth_index)
|
unsigned int HackRFBandwidths::getBandwidth(unsigned int bandwidth_index)
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ public:
|
|||||||
static unsigned int getRate(unsigned int rate_index);
|
static unsigned int getRate(unsigned int rate_index);
|
||||||
static unsigned int getRateIndex(unsigned int rate);
|
static unsigned int getRateIndex(unsigned int rate);
|
||||||
static const unsigned int m_nb_rates = 15;
|
static const unsigned int m_nb_rates = 15;
|
||||||
static unsigned int m_rates_k[m_nb_rates];
|
static unsigned int m_rates[m_nb_rates];
|
||||||
};
|
};
|
||||||
|
|
||||||
class HackRFBandwidths {
|
class HackRFBandwidths {
|
||||||
|
@ -166,7 +166,7 @@ void HackRFOutputGui::displaySettings()
|
|||||||
ui->LOppm->setValue(m_settings.m_LOppmTenths);
|
ui->LOppm->setValue(m_settings.m_LOppmTenths);
|
||||||
ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
|
ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
|
||||||
|
|
||||||
unsigned int sampleRateIndex = HackRFSampleRates::getRateIndex(m_settings.m_devSampleRate/1000);
|
unsigned int sampleRateIndex = HackRFSampleRates::getRateIndex(m_settings.m_devSampleRate);
|
||||||
ui->sampleRate->setCurrentIndex(sampleRateIndex);
|
ui->sampleRate->setCurrentIndex(sampleRateIndex);
|
||||||
|
|
||||||
ui->biasT->setChecked(m_settings.m_biasT);
|
ui->biasT->setChecked(m_settings.m_biasT);
|
||||||
@ -183,13 +183,13 @@ void HackRFOutputGui::displaySettings()
|
|||||||
|
|
||||||
void HackRFOutputGui::displaySampleRates()
|
void HackRFOutputGui::displaySampleRates()
|
||||||
{
|
{
|
||||||
int savedIndex = HackRFSampleRates::getRateIndex(m_settings.m_devSampleRate/1000);
|
int savedIndex = HackRFSampleRates::getRateIndex(m_settings.m_devSampleRate);
|
||||||
ui->sampleRate->blockSignals(true);
|
ui->sampleRate->blockSignals(true);
|
||||||
ui->sampleRate->clear();
|
ui->sampleRate->clear();
|
||||||
|
|
||||||
for (int i = 0; i < HackRFSampleRates::m_nb_rates; i++)
|
for (int i = 0; i < HackRFSampleRates::m_nb_rates; i++)
|
||||||
{
|
{
|
||||||
ui->sampleRate->addItem(QString("%1M").arg(QString::number(HackRFSampleRates::m_rates_k[i]/1000.0, 'f', 1)));
|
ui->sampleRate->addItem(QString("%1M").arg(QString::number(HackRFSampleRates::m_rates[i] / 1000000.0f, 'f', 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->sampleRate->blockSignals(false);
|
ui->sampleRate->blockSignals(false);
|
||||||
@ -249,7 +249,7 @@ void HackRFOutputGui::on_LOppm_valueChanged(int value)
|
|||||||
void HackRFOutputGui::on_sampleRate_currentIndexChanged(int index)
|
void HackRFOutputGui::on_sampleRate_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
int newrate = HackRFSampleRates::getRate(index);
|
int newrate = HackRFSampleRates::getRate(index);
|
||||||
m_settings.m_devSampleRate = newrate * 1000;
|
m_settings.m_devSampleRate = newrate;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ void HackRFInputGui::displaySettings()
|
|||||||
ui->dcOffset->setChecked(m_settings.m_dcBlock);
|
ui->dcOffset->setChecked(m_settings.m_dcBlock);
|
||||||
ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
|
ui->iqImbalance->setChecked(m_settings.m_iqCorrection);
|
||||||
|
|
||||||
unsigned int sampleRateIndex = HackRFSampleRates::getRateIndex(m_settings.m_devSampleRate/1000);
|
unsigned int sampleRateIndex = HackRFSampleRates::getRateIndex(m_settings.m_devSampleRate);
|
||||||
ui->sampleRate->setCurrentIndex(sampleRateIndex);
|
ui->sampleRate->setCurrentIndex(sampleRateIndex);
|
||||||
|
|
||||||
ui->biasT->setChecked(m_settings.m_biasT);
|
ui->biasT->setChecked(m_settings.m_biasT);
|
||||||
@ -200,13 +200,13 @@ void HackRFInputGui::displaySettings()
|
|||||||
|
|
||||||
void HackRFInputGui::displaySampleRates()
|
void HackRFInputGui::displaySampleRates()
|
||||||
{
|
{
|
||||||
int savedIndex = HackRFSampleRates::getRateIndex(m_settings.m_devSampleRate/1000);
|
int savedIndex = HackRFSampleRates::getRateIndex(m_settings.m_devSampleRate);
|
||||||
ui->sampleRate->blockSignals(true);
|
ui->sampleRate->blockSignals(true);
|
||||||
ui->sampleRate->clear();
|
ui->sampleRate->clear();
|
||||||
|
|
||||||
for (int i = 0; i < HackRFSampleRates::m_nb_rates; i++)
|
for (int i = 0; i < HackRFSampleRates::m_nb_rates; i++)
|
||||||
{
|
{
|
||||||
ui->sampleRate->addItem(QString("%1M").arg(QString::number(HackRFSampleRates::m_rates_k[i]/1000.0, 'f', 1)));
|
ui->sampleRate->addItem(QString("%1M").arg(QString::number(HackRFSampleRates::m_rates[i] / 1000000.0f, 'f', 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->sampleRate->blockSignals(false);
|
ui->sampleRate->blockSignals(false);
|
||||||
@ -278,7 +278,7 @@ void HackRFInputGui::on_iqImbalance_toggled(bool checked)
|
|||||||
void HackRFInputGui::on_sampleRate_currentIndexChanged(int index)
|
void HackRFInputGui::on_sampleRate_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
int newrate = HackRFSampleRates::getRate(index);
|
int newrate = HackRFSampleRates::getRate(index);
|
||||||
m_settings.m_devSampleRate = newrate * 1000;
|
m_settings.m_devSampleRate = newrate;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user