From 02f38ca90813582607f6ba790a5800817cd288ae Mon Sep 17 00:00:00 2001 From: Dimitri Stolnikov Date: Sun, 9 Jun 2013 20:19:17 +0200 Subject: uhd: implement dc correction --- include/osmosdr/sink.h | 20 +++++++------------- include/osmosdr/source.h | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/osmosdr/sink.h b/include/osmosdr/sink.h index f6f304f..a4b52c4 100644 --- a/include/osmosdr/sink.h +++ b/include/osmosdr/sink.h @@ -234,29 +234,23 @@ public: */ virtual std::string get_antenna( size_t chan = 0 ) = 0; - enum IQBalanceMode { - IQBalanceOff = 0, - IQBalanceManual, - IQBalanceAutomatic - }; - /*! - * Set the RX frontend IQ balance mode. + * Set the TX frontend DC offset value. + * The value is complex to control both I and Q. * - * \param mode iq balance correction mode: 0 = Off, 1 = Manual, 2 = Automatic + * \param offset the dc offset (1.0 is full-scale) * \param chan the channel index 0 to N-1 */ - virtual void set_iq_balance_mode( int mode, size_t chan = 0 ) = 0; + virtual void set_dc_offset( const std::complex &offset, size_t chan = 0 ) = 0; /*! - * Set the RX frontend IQ balance correction. + * Set the TX frontend IQ balance correction. * Use this to adjust the magnitude and phase of I and Q. * - * \param correction the complex correction value + * \param balance the complex correction value * \param chan the channel index 0 to N-1 */ - virtual void set_iq_balance( const std::complex &correction, - size_t chan = 0 ) = 0; + virtual void set_iq_balance( const std::complex &balance, size_t chan = 0 ) = 0; /*! * Set the bandpass filter on the radio frontend. diff --git a/include/osmosdr/source.h b/include/osmosdr/source.h index 2d0da3b..081c6de 100644 --- a/include/osmosdr/source.h +++ b/include/osmosdr/source.h @@ -234,6 +234,36 @@ public: */ virtual std::string get_antenna( size_t chan = 0 ) = 0; + enum DCOffsetMode { + DCOffsetOff = 0, + DCOffsetManual, + DCOffsetAutomatic + }; + + /*! + * Set the RX frontend DC correction mode. + * The automatic correction subtracts out the long-run average. + * + * When disabled, the averaging option operation is reset. + * Once in Manual mode, the average value will be held constant until + * the user re-enables the automatic correction or overrides the + * value by manually setting the offset. + * + * \param mode dc offset correction mode: 0 = Off, 1 = Manual, 2 = Automatic + * \param chan the channel index 0 to N-1 + */ + virtual void set_dc_offset_mode( int mode, size_t chan = 0) = 0; + + /*! + * Set the RX frontend DC offset value. + * The value is complex to control both I and Q. + * Only set this when automatic correction is disabled. + * + * \param offset the dc offset (1.0 is full-scale) + * \param chan the channel index 0 to N-1 + */ + virtual void set_dc_offset( const std::complex &offset, size_t chan = 0 ) = 0; + enum IQBalanceMode { IQBalanceOff = 0, IQBalanceManual, @@ -252,11 +282,10 @@ public: * Set the RX frontend IQ balance correction. * Use this to adjust the magnitude and phase of I and Q. * - * \param correction the complex correction value + * \param balance the complex correction value * \param chan the channel index 0 to N-1 */ - virtual void set_iq_balance( const std::complex &correction, - size_t chan = 0 ) = 0; + virtual void set_iq_balance( const std::complex &balance, size_t chan = 0 ) = 0; /*! * Set the bandpass filter on the radio frontend. -- cgit v1.2.3