bladerf: implement automatic bandwidth selection

This commit is contained in:
Dimitri Stolnikov 2013-09-28 13:33:30 +02:00
parent 5d5dc04371
commit 681e3b7d4a
2 changed files with 6 additions and 0 deletions

View File

@ -632,6 +632,9 @@ double bladerf_sink_c::set_bandwidth( double bandwidth, size_t chan )
int ret;
uint32_t actual;
if ( bandwidth == 0.0 ) /* bandwidth of 0 means automatic filter selection */
bandwidth = get_sample_rate() * 0.75; /* select narrower filters to prevent aliasing */
ret = bladerf_set_bandwidth( _dev, BLADERF_MODULE_TX, (uint32_t)bandwidth, &actual );
if( ret ) {
throw std::runtime_error( std::string(__FUNCTION__) + " " +

View File

@ -600,6 +600,9 @@ double bladerf_source_c::set_bandwidth( double bandwidth, size_t chan )
int ret;
uint32_t actual;
if ( bandwidth == 0.0 ) /* bandwidth of 0 means automatic filter selection */
bandwidth = get_sample_rate() * 0.75; /* select narrower filters to prevent aliasing */
ret = bladerf_set_bandwidth( _dev, BLADERF_MODULE_RX, (uint32_t)bandwidth, &actual );
if( ret ) {
throw std::runtime_error( std::string(__FUNCTION__) + " " +