mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
PlutoSDR: changed set sample rate method to use write long long
This commit is contained in:
parent
04d06085fe
commit
b16a1ff932
@ -430,13 +430,33 @@ bool DevicePlutoSDRBox::parseSampleRates(const std::string& rateStr, SampleRates
|
|||||||
|
|
||||||
void DevicePlutoSDRBox::setSampleRate(uint32_t sampleRate)
|
void DevicePlutoSDRBox::setSampleRate(uint32_t sampleRate)
|
||||||
{
|
{
|
||||||
char buff[100];
|
// char buff[100];
|
||||||
std::vector<std::string> params;
|
// std::vector<std::string> params;
|
||||||
snprintf(buff, sizeof(buff), "in_voltage_sampling_frequency=%d", sampleRate);
|
// snprintf(buff, sizeof(buff), "in_voltage_sampling_frequency=%d", sampleRate);
|
||||||
params.push_back(std::string(buff));
|
// params.push_back(std::string(buff));
|
||||||
snprintf(buff, sizeof(buff), "out_voltage_sampling_frequency=%d", sampleRate);
|
// snprintf(buff, sizeof(buff), "out_voltage_sampling_frequency=%d", sampleRate);
|
||||||
params.push_back(std::string(buff));
|
// params.push_back(std::string(buff));
|
||||||
set_params(DEVICE_PHY, params);
|
// set_params(DEVICE_PHY, params);
|
||||||
|
|
||||||
|
int ret = iio_channel_attr_write_longlong(m_chnRx0, "sampling_frequency", sampleRate);
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
|
qWarning("DevicePlutoSDRBox::setSampleRate: cannot set Rx sample rate to %u: %d", sampleRate, ret);
|
||||||
|
} else {
|
||||||
|
qDebug("DevicePlutoSDRBox::setSampleRate: Rx sample rate set to %u: %d", sampleRate, ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_chnTx0) // Tx is opened at the same time
|
||||||
|
{
|
||||||
|
ret = iio_channel_attr_write_longlong(m_chnTx0, "sampling_frequency", sampleRate);
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
|
qWarning("DevicePlutoSDRBox::setSampleRate: cannot set Tx sample rate to %u: %d", sampleRate, ret);
|
||||||
|
} else {
|
||||||
|
qDebug("DevicePlutoSDRBox::setSampleRate: Tx sample rate set to %u: %d", sampleRate, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_devSampleRate = sampleRate;
|
m_devSampleRate = sampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user