BladeRF support: make sample rate precision to the sample/s and added 4.333 MS/s for GSM

pull/27/head
f4exb 2017-02-18 11:55:19 +01:00
rodzic 39006c5502
commit 7b9dfb0446
4 zmienionych plików z 51 dodań i 13 usunięć

Wyświetl plik

@ -85,8 +85,30 @@ struct bladerf *DeviceBladeRF::open_bladerf_from_serial(const char *serial)
}
}
unsigned int BladerfSampleRates::m_rates[] = {1536, 1600, 2000, 2304, 2400, 3072, 3200, 4608, 4800, 6144, 7680, 9216, 9600, 10752, 12288, 18432, 19200, 24576, 30720, 36864, 39936};
unsigned int BladerfSampleRates::m_nb_rates = 21;
const unsigned int BladerfSampleRates::m_nb_rates = 22;
const unsigned int BladerfSampleRates::m_rates[BladerfSampleRates::m_nb_rates] = {
1536000,
1600000,
2000000,
2304000,
2400000,
3072000,
3200000,
4333333, // for GSM
4608000,
4800000,
6144000,
7680000,
9216000,
9600000,
10752000,
12288000,
18432000,
19200000,
24576000,
30720000,
36864000,
39936000};
unsigned int BladerfSampleRates::getRate(unsigned int rate_index)
{
@ -104,7 +126,7 @@ unsigned int BladerfSampleRates::getRateIndex(unsigned int rate)
{
for (unsigned int i=0; i < m_nb_rates; i++)
{
if (rate/1000 == m_rates[i])
if (rate == m_rates[i])
{
return i;
}
@ -118,8 +140,24 @@ unsigned int BladerfSampleRates::getNbRates()
return BladerfSampleRates::m_nb_rates;
}
unsigned int BladerfBandwidths::m_halfbw[] = {750, 875, 1250, 1375, 1500, 1920, 2500, 2750, 3000, 3500, 4375, 5000, 6000, 7000, 10000, 14000};
unsigned int BladerfBandwidths::m_nb_halfbw = 16;
const unsigned int BladerfBandwidths::m_nb_halfbw = 16;
const unsigned int BladerfBandwidths::m_halfbw[BladerfBandwidths::m_nb_halfbw] = {
750,
875,
1250,
1375,
1500,
1920,
2500,
2750,
3000,
3500,
4375,
5000,
6000,
7000,
10000,
14000};
unsigned int BladerfBandwidths::getBandwidth(unsigned int bandwidth_index)
{

Wyświetl plik

@ -34,8 +34,8 @@ public:
static unsigned int getRateIndex(unsigned int rate);
static unsigned int getNbRates();
private:
static unsigned int m_rates[21];
static unsigned int m_nb_rates;
static const unsigned int m_nb_rates;
static const unsigned int m_rates[];
};
class BladerfBandwidths {
@ -44,8 +44,8 @@ public:
static unsigned int getBandwidthIndex(unsigned int bandwidth);
static unsigned int getNbBandwidths();
private:
static unsigned int m_halfbw[16];
static unsigned int m_nb_halfbw;
static const unsigned int m_nb_halfbw;
static const unsigned int m_halfbw[];
};
#endif /* DEVICES_BLADERF_DEVICESDBLADERF_H_ */

Wyświetl plik

@ -45,7 +45,7 @@ BladerfOutputGui::BladerfOutputGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
ui->samplerate->clear();
for (int i = 0; i < BladerfSampleRates::getNbRates(); i++)
{
ui->samplerate->addItem(QString::number(BladerfSampleRates::getRate(i)));
ui->samplerate->addItem(QString::number(BladerfSampleRates::getRate(i)/1000));
}
ui->bandwidth->clear();
@ -208,7 +208,7 @@ void BladerfOutputGui::on_centerFrequency_changed(quint64 value)
void BladerfOutputGui::on_samplerate_currentIndexChanged(int index)
{
int newrate = BladerfSampleRates::getRate(index);
m_settings.m_devSampleRate = newrate * 1000;
m_settings.m_devSampleRate = newrate;
sendSettings();
}

Wyświetl plik

@ -45,7 +45,7 @@ BladerfInputGui::BladerfInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
ui->samplerate->clear();
for (int i = 0; i < BladerfSampleRates::getNbRates(); i++)
{
ui->samplerate->addItem(QString::number(BladerfSampleRates::getRate(i)));
ui->samplerate->addItem(QString::number(BladerfSampleRates::getRate(i)/1000));
}
ui->bandwidth->clear();
@ -227,7 +227,7 @@ void BladerfInputGui::on_iqImbalance_toggled(bool checked)
void BladerfInputGui::on_samplerate_currentIndexChanged(int index)
{
int newrate = BladerfSampleRates::getRate(index);
m_settings.m_devSampleRate = newrate * 1000;
m_settings.m_devSampleRate = newrate;
sendSettings();
}