diff options
author | Dimitri Stolnikov <horiz0n@gmx.net> | 2013-04-15 23:36:55 +0200 |
---|---|---|
committer | Dimitri Stolnikov <horiz0n@gmx.net> | 2013-04-15 23:36:55 +0200 |
commit | afd56f4b5a5c9ac107aaca91364239c0ce61634d (patch) | |
tree | 6fea6f0e3c06f9a63c60ac54f443b6f22c96d298 /lib/hackrf | |
parent | 8578eee7ce5d74a14a3089be8ea94ada3d9627f0 (diff) |
hackrf: implement BB lowpass filter control
To use the default (automatic) bandwidth filter selection, this should
be set to 0.
Diffstat (limited to 'lib/hackrf')
-rw-r--r-- | lib/hackrf/hackrf_source_c.cc | 8 | ||||
-rw-r--r-- | lib/hackrf/hackrf_source_c.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/hackrf/hackrf_source_c.cc b/lib/hackrf/hackrf_source_c.cc index 5543ea0..e5db62c 100644 --- a/lib/hackrf/hackrf_source_c.cc +++ b/lib/hackrf/hackrf_source_c.cc @@ -625,13 +625,13 @@ std::string hackrf_source_c::get_antenna( size_t chan ) return "ANT"; } -void hackrf_source_c::set_bandwidth( double bandwidth, size_t chan ) +double hackrf_source_c::set_bandwidth( double bandwidth, size_t chan ) { int ret; // osmosdr::meta_range_t bandwidths = get_bandwidth_range( chan ); - if ( bandwidth == 0.0 ) - return; + if ( bandwidth == 0.0 ) /* bandwidth of 0 means automatic filter selection */ + bandwidth = _sample_rate; if ( _dev ) { /* compute best default value depending on sample rate (auto filter) */ @@ -643,6 +643,8 @@ void hackrf_source_c::set_bandwidth( double bandwidth, size_t chan ) throw std::runtime_error( std::string( __FUNCTION__ ) ); } } + + return _bandwidth; } double hackrf_source_c::get_bandwidth( size_t chan ) diff --git a/lib/hackrf/hackrf_source_c.h b/lib/hackrf/hackrf_source_c.h index ea14944..3e60749 100644 --- a/lib/hackrf/hackrf_source_c.h +++ b/lib/hackrf/hackrf_source_c.h @@ -113,7 +113,7 @@ private: std::string set_antenna( const std::string & antenna, size_t chan = 0 ); std::string get_antenna( size_t chan = 0 ); - void set_bandwidth( double bandwidth, size_t chan = 0 ); + double set_bandwidth( double bandwidth, size_t chan = 0 ); double get_bandwidth( size_t chan = 0 ); osmosdr::meta_range_t get_bandwidth_range( size_t chan = 0 ); |