diff options
-rw-r--r-- | host/include/uhd/usrp/multi_usrp.hpp | 20 | ||||
-rw-r--r-- | host/lib/usrp/multi_usrp.cpp | 20 |
2 files changed, 39 insertions, 1 deletions
diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp index 9fbc9cfe6..1cbe3a684 100644 --- a/host/include/uhd/usrp/multi_usrp.hpp +++ b/host/include/uhd/usrp/multi_usrp.hpp @@ -22,6 +22,7 @@ #define UHD_USRP_MULTI_USRP_REF_SOURCES_API #define UHD_USRP_MULTI_USRP_GET_RATES_API #define UHD_USRP_MULTI_USRP_DC_OFFSET_API +#define UHD_USRP_MULTI_USRP_CORRECTION_API #include <uhd/config.hpp> #include <uhd/device.hpp> @@ -530,7 +531,6 @@ public: */ virtual std::vector<std::string> get_rx_sensor_names(size_t chan = 0) = 0; - /*! * Enable/disable the automatic RX DC offset correction. * The automatic correction subtracts out the long-run average. @@ -554,6 +554,15 @@ public: */ virtual void set_rx_dc_offset(const std::complex<double> &offset, size_t chan = ALL_CHANS) = 0; + /*! + * Set the RX frontend IQ imbalance and gain correction. + * Use this to adjust the magnitude and phase of I and Q. + * + * \param correction the complex correction value + * \param chan the channel index 0 to N-1 + */ + virtual void set_rx_correction(const std::complex<double> &correction, size_t chan = ALL_CHANS) = 0; + /******************************************************************* * TX methods ******************************************************************/ @@ -759,6 +768,15 @@ public: */ virtual void set_tx_dc_offset(const std::complex<double> &offset, size_t chan = ALL_CHANS) = 0; + /*! + * Set the TX frontend IQ imbalance and gain correction. + * Use this to adjust the magnitude and phase of I and Q. + * + * \param correction the complex correction value + * \param chan the channel index 0 to N-1 + */ + virtual void set_tx_correction(const std::complex<double> &correction, size_t chan = ALL_CHANS) = 0; + }; }} diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index 5fff989ce..5a6acc2c5 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -567,6 +567,16 @@ public: } } + void set_rx_correction(const std::complex<double> &offset, size_t chan){ + if (chan != ALL_CHANS){ + _tree->access<std::complex<double> >(rx_rf_fe_root(chan).branch_path() / "correction" / "value").set(offset); + return; + } + for (size_t c = 0; c < get_rx_num_channels(); c++){ + this->set_rx_correction(offset, c); + } + } + /******************************************************************* * TX methods ******************************************************************/ @@ -691,6 +701,16 @@ public: } } + void set_tx_correction(const std::complex<double> &offset, size_t chan){ + if (chan != ALL_CHANS){ + _tree->access<std::complex<double> >(tx_rf_fe_root(chan).branch_path() / "correction" / "value").set(offset); + return; + } + for (size_t c = 0; c < get_tx_num_channels(); c++){ + this->set_tx_correction(offset, c); + } + } + private: device::sptr _dev; property_tree::sptr _tree; |