diff options
Diffstat (limited to 'lib/fcd')
-rw-r--r-- | lib/fcd/CMakeLists.txt | 39 | ||||
-rw-r--r-- | lib/fcd/fcd_source_c.cc | 21 | ||||
-rw-r--r-- | lib/fcd/fcd_source_c.h | 13 |
3 files changed, 56 insertions, 17 deletions
diff --git a/lib/fcd/CMakeLists.txt b/lib/fcd/CMakeLists.txt index 768c5b2..e71b153 100644 --- a/lib/fcd/CMakeLists.txt +++ b/lib/fcd/CMakeLists.txt @@ -1,19 +1,19 @@ # Copyright 2012 Free Software Foundation, Inc. # -# This file is part of gr-osmosdr +# This file is part of GNU Radio # -# gr-osmosdr is free software; you can redistribute it and/or modify +# GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # -# gr-osmosdr is distributed in the hope that it will be useful, +# GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with gr-osmosdr; see the file COPYING. If not, write to +# along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. @@ -21,16 +21,29 @@ # This file included, use CMake directory variables ######################################################################## -target_include_directories(gnuradio-osmosdr PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} - ${GNURADIO_FCDPP_INCLUDE_DIRS} -) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -APPEND_LIB_LIST( - ${GNURADIO_FCDPP_LIBRARIES} -) +if(ENABLE_FCD) +include_directories(${GNURADIO_FCD_INCLUDE_DIRS}) +endif(ENABLE_FCD) -list(APPEND gr_osmosdr_srcs +if(ENABLE_FCDPP) +include_directories(${GNURADIO_FCDPP_INCLUDE_DIRS}) +endif(ENABLE_FCDPP) + +set(fcd_srcs ${CMAKE_CURRENT_SOURCE_DIR}/fcd_source_c.cc ) -set(gr_osmosdr_srcs ${gr_osmosdr_srcs} PARENT_SCOPE) + +######################################################################## +# Append gnuradio-osmosdr library sources +######################################################################## +list(APPEND gr_osmosdr_srcs ${fcd_srcs}) + +if(ENABLE_FCD) +list(APPEND gr_osmosdr_libs ${GNURADIO_FCD_LIBRARIES}) +endif(ENABLE_FCD) + +if(ENABLE_FCDPP) +list(APPEND gr_osmosdr_libs ${GNURADIO_FCDPP_LIBRARIES}) +endif(ENABLE_FCDPP) diff --git a/lib/fcd/fcd_source_c.cc b/lib/fcd/fcd_source_c.cc index 854e4c0..885d514 100644 --- a/lib/fcd/fcd_source_c.cc +++ b/lib/fcd/fcd_source_c.cc @@ -23,6 +23,7 @@ #include <sstream> #include <boost/assign.hpp> +#include <boost/foreach.hpp> #include <gnuradio/io_signature.h> @@ -141,15 +142,18 @@ fcd_source_c::fcd_source_c(const std::string &args) : std::cerr << "Using " << name() << " (" << dev_name << ")" << std::endl; +#ifdef HAVE_FCD if ( FUNCUBE_V1 == _type ) { - _src_v1 = gr::fcdproplus::fcd::make( dev_name ); + _src_v1 = gr::fcd::source_c::make( dev_name ); connect( _src_v1, 0, self(), 0 ); set_gain( 20, "LNA" ); set_gain( 12, "MIX" ); } +#endif +#ifdef HAVE_FCDPP if ( FUNCUBE_V2 == _type ) { _src_v2 = gr::fcdproplus::fcdproplus::make( dev_name ); @@ -159,6 +163,7 @@ fcd_source_c::fcd_source_c(const std::string &args) : set_gain( 1, "MIX" ); set_gain( 15, "BB" ); } +#endif } fcd_source_c::~fcd_source_c() @@ -170,7 +175,7 @@ std::vector< std::string > fcd_source_c::get_devices() int id = 0; std::vector< std::string > devices; - for (device_t dev : _get_devices()) + BOOST_FOREACH( device_t dev, _get_devices() ) { std::string args = "fcd=" + boost::lexical_cast< std::string >( id++ ); @@ -236,11 +241,15 @@ osmosdr::freq_range_t fcd_source_c::get_freq_range( size_t chan ) double fcd_source_c::set_center_freq( double freq, size_t chan ) { +#ifdef HAVE_FCD if ( FUNCUBE_V1 == _type ) _src_v1->set_freq( float(freq) ); +#endif +#ifdef HAVE_FCDPP if ( FUNCUBE_V2 == _type ) _src_v2->set_freq( float(freq) ); +#endif _freq = freq; @@ -254,11 +263,15 @@ double fcd_source_c::get_center_freq( size_t chan ) double fcd_source_c::set_freq_corr( double ppm, size_t chan ) { +#ifdef HAVE_FCD if ( FUNCUBE_V1 == _type ) _src_v1->set_freq_corr( ppm ); +#endif +#ifdef HAVE_FCDPP if ( FUNCUBE_V2 == _type ) _src_v2->set_freq_corr( ppm ); +#endif _correct = ppm; @@ -330,6 +343,7 @@ double fcd_source_c::set_gain( double gain, size_t chan ) double fcd_source_c::set_gain( double gain, const std::string & name, size_t chan ) { +#ifdef HAVE_FCD if ( FUNCUBE_V1 == _type ) { if ( "LNA" == name ) @@ -343,7 +357,9 @@ double fcd_source_c::set_gain( double gain, const std::string & name, size_t cha _src_v1->set_mixer_gain(_mix_gain); } } +#endif +#ifdef HAVE_FCDPP if ( FUNCUBE_V2 == _type ) { if ( "LNA" == name ) @@ -362,6 +378,7 @@ double fcd_source_c::set_gain( double gain, const std::string & name, size_t cha _src_v2->set_if_gain(_bb_gain); } } +#endif return get_gain( name, chan ); } diff --git a/lib/fcd/fcd_source_c.h b/lib/fcd/fcd_source_c.h index 2b02eb1..70239f8 100644 --- a/lib/fcd/fcd_source_c.h +++ b/lib/fcd/fcd_source_c.h @@ -22,8 +22,13 @@ #include <gnuradio/hier_block2.h> -#include <fcdproplus/fcd.h> +#ifdef HAVE_FCD +#include <gnuradio/fcd/source_c.h> +#endif + +#ifdef HAVE_FCDPP #include <fcdproplus/fcdproplus.h> +#endif #include "source_iface.h" @@ -81,8 +86,12 @@ public: private: dongle_type _type; - gr::fcdproplus::fcd::sptr _src_v1; +#ifdef HAVE_FCD + gr::fcd::source_c::sptr _src_v1; +#endif +#ifdef HAVE_FCDPP gr::fcdproplus::fcdproplus::sptr _src_v2; +#endif double _lna_gain, _mix_gain, _bb_gain, _freq; int _correct; }; |