bladerf: implement automatic bandwidth selection

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

View File

@ -631,6 +631,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

@ -599,6 +599,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__) + " " +