diff options
author | Jason Abele <jason@ettus.com> | 2010-08-02 17:40:30 -0700 |
---|---|---|
committer | Jason Abele <jason@ettus.com> | 2010-08-02 17:40:30 -0700 |
commit | 94e7cec66a2d3efe6be5f12455644c4547b61a9c (patch) | |
tree | 0a64495a13320c10e25b22c030693457036ad421 /host | |
parent | 4220097f99c37632d06de436fdd20772aad46fda (diff) | |
download | uhd-94e7cec66a2d3efe6be5f12455644c4547b61a9c.tar.gz uhd-94e7cec66a2d3efe6be5f12455644c4547b61a9c.tar.bz2 uhd-94e7cec66a2d3efe6be5f12455644c4547b61a9c.zip |
Propogate gain range into RX pga0 helper for RFX boards
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/dboard/db_rfx.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp index 664b406d9..b6b44199a 100644 --- a/host/lib/usrp/dboard/db_rfx.cpp +++ b/host/lib/usrp/dboard/db_rfx.cpp @@ -241,10 +241,10 @@ void rfx_xcvr::set_tx_ant(const std::string &ant){ /*********************************************************************** * Gain Handling **********************************************************************/ -static float rx_pga0_gain_to_dac_volts(float &gain){ +static float rx_pga0_gain_to_dac_volts(float &gain, float range){ //voltage level constants (negative slope) static const float max_volts = float(.2), min_volts = float(1.2); - static const float slope = (max_volts-min_volts)/45; + static const float slope = (max_volts-min_volts)/(range); //calculate the voltage for the aux dac float dac_volts = std::clip<float>(gain*slope + min_volts, max_volts, min_volts); @@ -263,7 +263,8 @@ void rfx_xcvr::set_tx_gain(float, const std::string &name){ void rfx_xcvr::set_rx_gain(float gain, const std::string &name){ assert_has(_rx_gain_ranges.keys(), name, "rfx rx gain name"); if(name == "PGA0"){ - float dac_volts = rx_pga0_gain_to_dac_volts(gain); + float dac_volts = rx_pga0_gain_to_dac_volts(gain, + (_rx_gain_ranges["PGA0"].max - _rx_gain_ranges["PGA0"].min)); _rx_gains[name] = gain; //write the new voltage to the aux dac |