airspy: implement DC bias control

use with -a "airspy,bias=1" to enable DC bias on antenna input
This commit is contained in:
Dimitri Stolnikov 2014-11-27 16:38:25 +01:00
parent 163cad2e96
commit 20fd6a8c34
2 changed files with 8 additions and 1 deletions

View File

@ -250,7 +250,7 @@ Lines ending with ... mean it's possible to bind devices together by specifying
netsdr=127.0.0.1[:50000][,nchan=2] netsdr=127.0.0.1[:50000][,nchan=2]
sdr-ip=127.0.0.1[:50000] sdr-ip=127.0.0.1[:50000]
sdr-iq=/dev/ttyUSB0 sdr-iq=/dev/ttyUSB0
airspy=0 airspy=0[,bias=0|1]
#end if #end if
hackrf=0[,buffers=32] hackrf=0[,buffers=32]
bladerf=0[,fpga='/path/to/the/bitstream.rbf'] bladerf=0[,fpga='/path/to/the/bitstream.rbf']

View File

@ -123,6 +123,13 @@ airspy_source_c::airspy_source_c (const std::string &args)
set_if_gain( 0 ); /* preset to a reasonable default (non-GRC use case) */ set_if_gain( 0 ); /* preset to a reasonable default (non-GRC use case) */
if ( dict.count( "bias" ) )
{
bool bias = boost::lexical_cast<bool>( dict["bias"] );
int ret = airspy_set_rf_bias(_dev, (uint8_t)bias);
AIRSPY_THROW_ON_ERROR(ret, "Failed to enable DC bias")
}
_fifo = new boost::circular_buffer<gr_complex>(5000000); _fifo = new boost::circular_buffer<gr_complex>(5000000);
if (!_fifo) { if (!_fifo) {
throw std::runtime_error( std::string(__FUNCTION__) + " " + throw std::runtime_error( std::string(__FUNCTION__) + " " +