1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-13 03:30:33 +00:00

Fix for new API for gr-iio component in GNU Radio master

This commit is contained in:
Carles Fernandez 2021-10-23 14:11:20 +02:00
parent 69c4f9f7fc
commit 2f7263d7a3
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
6 changed files with 39 additions and 3 deletions

View File

@ -369,6 +369,11 @@ if(GNURADIO_VERSION VERSION_GREATER 3.8.99)
INTERFACE_LINK_LIBRARIES "${GNURADIO_LIBRARY}"
)
endif()
# check templatized API
if(NOT EXISTS "${GNURADIO_IIO_INCLUDE_DIRS}/gnuradio/iio/pluto_source.h")
set(GR_IIO_TEMPLATIZED_API TRUE)
endif()
endif()
endif()

View File

@ -241,6 +241,11 @@ if(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2)
Gnuradio::analog
)
endif()
if(GR_IIO_TEMPLATIZED_API)
target_compile_definitions(signal_source_adapters
PUBLIC -DGR_IIO_TEMPLATIZED_API=1
)
endif()
endif()
if(ENABLE_CLANG_TIDY)

View File

@ -185,7 +185,11 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(const ConfigurationInterface *configu
{
#if GNURADIO_API_IIO
std::vector<bool> enable_channels{rx1_en_, rx2_en_};
#if GR_IIO_TEMPLATIZED_API
fmcomms2_source_f32c_ = gr::iio::fmcomms2_source<gr_complex>::make(uri_, enable_channels, buffer_size_);
#else
fmcomms2_source_f32c_ = gr::iio::fmcomms2_source::make(uri_, enable_channels, buffer_size_);
#endif
fmcomms2_source_f32c_->set_frequency(freq_);
fmcomms2_source_f32c_->set_samplerate(sample_rate_);
if (rx1_en_)
@ -261,7 +265,11 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(const ConfigurationInterface *configu
{
#if GNURADIO_API_IIO
std::vector<bool> enable_channels{rx1_en_, rx2_en_};
#if GR_IIO_TEMPLATIZED_API
fmcomms2_source_f32c_ = gr::iio::fmcomms2_source<gr_complex>::make(uri_, enable_channels, buffer_size_);
#else
fmcomms2_source_f32c_ = gr::iio::fmcomms2_source::make(uri_, enable_channels, buffer_size_);
#endif
fmcomms2_source_f32c_->set_frequency(freq_);
fmcomms2_source_f32c_->set_samplerate(sample_rate_);
fmcomms2_source_f32c_->set_gain_mode(0, gain_mode_rx1_);

View File

@ -62,7 +62,11 @@ public:
private:
#if GNURADIO_API_IIO
#if GR_IIO_TEMPLATIZED_API
gr::iio::fmcomms2_source<gr_complex>::sptr fmcomms2_source_f32c_;
#else
gr::iio::fmcomms2_source::sptr fmcomms2_source_f32c_;
#endif
#else
gr::iio::fmcomms2_source_f32c::sptr fmcomms2_source_f32c_;
#endif

View File

@ -126,11 +126,17 @@ PlutosdrSignalSource::PlutosdrSignalSource(const ConfigurationInterface* configu
std::cout << "item type: " << item_type_ << '\n';
#if GNURADIO_API_IIO
#if GR_IIO_TEMPLATIZED_API
plutosdr_source_ = gr::iio::fmcomms2_source<gr_complex>::make(uri_, {true}, buffer_size_);
plutosdr_source_->set_gain_mode(0, gain_mode_);
plutosdr_source_->set_gain(0, rf_gain_);
#else
plutosdr_source_ = gr::iio::pluto_source::make(uri_, buffer_size_);
plutosdr_source_->set_frequency(freq_);
plutosdr_source_->set_samplerate(sample_rate_);
plutosdr_source_->set_gain_mode(gain_mode_);
plutosdr_source_->set_gain(rf_gain_);
#endif
plutosdr_source_->set_frequency(freq_);
plutosdr_source_->set_samplerate(sample_rate_);
plutosdr_source_->set_quadrature(quadrature_);
plutosdr_source_->set_rfdc(rf_dc_);
plutosdr_source_->set_bbdc(bb_dc_);

View File

@ -22,7 +22,11 @@
#include "signal_source_base.h"
#include <gnuradio/blocks/file_sink.h>
#if GRIIO_INCLUDE_HAS_GNURADIO
#if GR_IIO_TEMPLATIZED_API
#include <gnuradio/iio/fmcomms2_source.h>
#else
#include <gnuradio/iio/pluto_source.h>
#endif
#else
#include <iio/pluto_source.h>
#endif
@ -62,7 +66,11 @@ public:
gr::basic_block_sptr get_right_block() override;
private:
gr::iio::pluto_source::sptr plutosdr_source_;
#if GR_IIO_TEMPLATIZED_API
gr::iio::fmcomms2_source<gr_complex>::sptr plutosdr_source_;
#else
gr::iio::pluto_source::sptr plutosdr_source_;
#endif
gnss_shared_ptr<gr::block> valve_;
gr::blocks::file_sink::sptr file_sink_;