diff options
author | Josh Blum <josh@joshknows.com> | 2010-10-20 18:16:34 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-10-20 18:16:34 -0700 |
commit | 318d62a179806cec20b5adb4f2aad58ecc5a330e (patch) | |
tree | a1da93cba43435669b145821f6da4d022b6b1abd /host | |
parent | d96b2e7587962c43c1db895b3340f9d868cbd704 (diff) | |
download | uhd-318d62a179806cec20b5adb4f2aad58ecc5a330e.tar.gz uhd-318d62a179806cec20b5adb4f2aad58ecc5a330e.tar.bz2 uhd-318d62a179806cec20b5adb4f2aad58ecc5a330e.zip |
usrp: convenience wrappers for dealing with overall gains
Diffstat (limited to 'host')
-rw-r--r-- | host/include/uhd/usrp/multi_usrp.hpp | 30 | ||||
-rw-r--r-- | host/include/uhd/usrp/single_usrp.hpp | 62 |
2 files changed, 66 insertions, 26 deletions
diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp index 70901fc31..2f71f80b1 100644 --- a/host/include/uhd/usrp/multi_usrp.hpp +++ b/host/include/uhd/usrp/multi_usrp.hpp @@ -251,6 +251,11 @@ public: */ virtual void set_rx_gain(float gain, const std::string &name, size_t chan) = 0; + //! A convenience wrapper for setting overall RX gain + void set_rx_gain(float gain, size_t chan){ + return this->set_rx_gain(gain, ALL_GAINS, chan); + } + /*! * Get the RX gain value for the specified gain element. * For an empty name, sum across all gain elements. @@ -260,6 +265,11 @@ public: */ virtual float get_rx_gain(const std::string &name, size_t chan) = 0; + //! A convenience wrapper for getting overall RX gain + float get_rx_gain(size_t chan){ + return this->get_rx_gain(ALL_GAINS, chan); + } + /*! * Get the RX gain range for the specified gain element. * For an empty name, calculate the overall gain range. @@ -269,6 +279,11 @@ public: */ virtual gain_range_t get_rx_gain_range(const std::string &name, size_t chan) = 0; + //! A convenience wrapper for getting overall RX gain range + gain_range_t get_rx_gain_range(size_t chan){ + return this->get_rx_gain_range(ALL_GAINS, chan); + } + /*! * Get the names of the gain elements in the RX chain. * Gain elements are ordered from antenna to FPGA. @@ -422,6 +437,11 @@ public: */ virtual void set_tx_gain(float gain, const std::string &name, size_t chan) = 0; + //! A convenience wrapper for setting overall TX gain + void set_tx_gain(float gain, size_t chan){ + return this->set_tx_gain(gain, ALL_GAINS, chan); + } + /*! * Get the TX gain value for the specified gain element. * For an empty name, sum across all gain elements. @@ -431,6 +451,11 @@ public: */ virtual float get_tx_gain(const std::string &name, size_t chan) = 0; + //! A convenience wrapper for getting overall TX gain + float get_tx_gain(size_t chan){ + return this->get_tx_gain(ALL_GAINS, chan); + } + /*! * Get the TX gain range for the specified gain element. * For an empty name, calculate the overall gain range. @@ -440,6 +465,11 @@ public: */ virtual gain_range_t get_tx_gain_range(const std::string &name, size_t chan) = 0; + //! A convenience wrapper for getting overall TX gain range + gain_range_t get_tx_gain_range(size_t chan){ + return this->get_tx_gain_range(ALL_GAINS, chan); + } + /*! * Get the names of the gain elements in the TX chain. * Gain elements are ordered from antenna to FPGA. diff --git a/host/include/uhd/usrp/single_usrp.hpp b/host/include/uhd/usrp/single_usrp.hpp index 09bf9c84d..a34f92cee 100644 --- a/host/include/uhd/usrp/single_usrp.hpp +++ b/host/include/uhd/usrp/single_usrp.hpp @@ -191,11 +191,12 @@ public: * \param name the name of the gain element * \param chan the channel index 0 to N-1 */ - virtual void set_rx_gain( - float gain, - const std::string &name = ALL_GAINS, - size_t chan = 0 - ) = 0; + virtual void set_rx_gain(float gain, const std::string &name, size_t chan = 0) = 0; + + //! A convenience wrapper for setting overall RX gain + void set_rx_gain(float gain, size_t chan = 0){ + return this->set_rx_gain(gain, ALL_GAINS, chan); + } /*! * Get the RX gain value for the specified gain element. @@ -204,10 +205,12 @@ public: * \param chan the channel index 0 to N-1 * \return the gain in dB */ - virtual float get_rx_gain( - const std::string &name = ALL_GAINS, - size_t chan = 0 - ) = 0; + virtual float get_rx_gain(const std::string &name, size_t chan = 0) = 0; + + //! A convenience wrapper for getting overall RX gain + float get_rx_gain(size_t chan = 0){ + return this->get_rx_gain(ALL_GAINS, chan); + } /*! * Get the RX gain range for the specified gain element. @@ -216,10 +219,12 @@ public: * \param chan the channel index 0 to N-1 * \return a gain range object */ - virtual gain_range_t get_rx_gain_range( - const std::string &name = ALL_GAINS, - size_t chan = 0 - ) = 0; + virtual gain_range_t get_rx_gain_range(const std::string &name, size_t chan = 0) = 0; + + //! A convenience wrapper for getting overall RX gain range + gain_range_t get_rx_gain_range(size_t chan = 0){ + return this->get_rx_gain_range(ALL_GAINS, chan); + } /*! * Get the names of the gain elements in the RX chain. @@ -363,11 +368,12 @@ public: * \param name the name of the gain element * \param chan the channel index 0 to N-1 */ - virtual void set_tx_gain( - float gain, - const std::string &name = ALL_GAINS, - size_t chan = 0 - ) = 0; + virtual void set_tx_gain(float gain, const std::string &name, size_t chan = 0) = 0; + + //! A convenience wrapper for setting overall TX gain + void set_tx_gain(float gain, size_t chan = 0){ + return this->set_tx_gain(gain, ALL_GAINS, chan); + } /*! * Get the TX gain value for the specified gain element. @@ -376,10 +382,12 @@ public: * \param chan the channel index 0 to N-1 * \return the gain in dB */ - virtual float get_tx_gain( - const std::string &name = ALL_GAINS, - size_t chan = 0 - ) = 0; + virtual float get_tx_gain(const std::string &name, size_t chan = 0) = 0; + + //! A convenience wrapper for getting overall TX gain + float get_tx_gain(size_t chan = 0){ + return this->get_tx_gain(ALL_GAINS, chan); + } /*! * Get the TX gain range for the specified gain element. @@ -388,10 +396,12 @@ public: * \param chan the channel index 0 to N-1 * \return a gain range object */ - virtual gain_range_t get_tx_gain_range( - const std::string &name = ALL_GAINS, - size_t chan = 0 - ) = 0; + virtual gain_range_t get_tx_gain_range(const std::string &name, size_t chan = 0) = 0; + + //! A convenience wrapper for getting overall TX gain range + gain_range_t get_tx_gain_range(size_t chan = 0){ + return this->get_tx_gain_range(ALL_GAINS, chan); + } /*! * Get the names of the gain elements in the TX chain. |