aboutsummaryrefslogtreecommitdiffstats
path: root/lib/soapy/soapy_sink_c.cc
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2017-04-14 11:02:00 -0500
committerJosh Blum <josh@joshknows.com>2017-04-18 16:29:02 -0700
commit117f64885904f743d1f04c5ddbbd39aab5a56e6d (patch)
treeb9084175d5dd0405a3d8e1e5e976ff5835930c40 /lib/soapy/soapy_sink_c.cc
parentb361fa5a7768864901821567bba0f89a18646b9e (diff)
soapy: support set/getFrequencyCorrection() API
backwards compatible changes with #ifdef set/get_freq_corr() call directly into the SoapySDR equivalent when supported by the API version.
Diffstat (limited to 'lib/soapy/soapy_sink_c.cc')
-rw-r--r--lib/soapy/soapy_sink_c.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/soapy/soapy_sink_c.cc b/lib/soapy/soapy_sink_c.cc
index 29defea..07cf069 100644
--- a/lib/soapy/soapy_sink_c.cc
+++ b/lib/soapy/soapy_sink_c.cc
@@ -171,22 +171,30 @@ double soapy_sink_c::get_center_freq( size_t chan)
double soapy_sink_c::set_freq_corr( double ppm, size_t chan)
{
+ #ifdef SOAPY_SDR_API_HAS_FREQUENCY_CORRECTION_API
+ _device->setFrequencyCorrection(SOAPY_SDR_TX, chan, ppm);
+ #else
std::vector<std::string> components = _device->listFrequencies(SOAPY_SDR_TX, chan);
if (std::find(components.begin(), components.end(), "COOR") != components.end())
{
_device->setFrequency(SOAPY_SDR_TX, chan, "CORR", ppm);
}
+ #endif
return this->get_freq_corr(chan);
}
double soapy_sink_c::get_freq_corr( size_t chan)
{
+ #ifdef SOAPY_SDR_API_HAS_FREQUENCY_CORRECTION_API
+ return _device->getFrequencyCorrection(SOAPY_SDR_TX, chan);
+ #else
std::vector<std::string> components = _device->listFrequencies(SOAPY_SDR_TX, chan);
if (std::find(components.begin(), components.end(), "COOR") != components.end())
{
return _device->getFrequency(SOAPY_SDR_TX, chan, "CORR");
}
return 0.0;
+ #endif
}
std::vector<std::string> soapy_sink_c::get_gain_names( size_t chan)