aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2/codec_ctrl.cpp
diff options
context:
space:
mode:
authorNick Foster <nick@nerdnetworks.org>2010-07-28 15:40:43 -0700
committerNick Foster <nick@nerdnetworks.org>2010-07-28 15:40:43 -0700
commit8784cf70df692066f224ddf58d624b148ea98301 (patch)
treedf0ea9bc2594316da79997933e0dd117a52d8311 /host/lib/usrp/usrp2/codec_ctrl.cpp
parente5722d61aa2b523991f5388d9bda0f56f43f79bd (diff)
downloaduhd-8784cf70df692066f224ddf58d624b148ea98301.tar.gz
uhd-8784cf70df692066f224ddf58d624b148ea98301.tar.bz2
uhd-8784cf70df692066f224ddf58d624b148ea98301.zip
ADC gain control works.
Separated digital gain and fine gain correction into separate buckets. Changed the rounding policy of gain_group to floor() rather than round().
Diffstat (limited to 'host/lib/usrp/usrp2/codec_ctrl.cpp')
-rw-r--r--host/lib/usrp/usrp2/codec_ctrl.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/host/lib/usrp/usrp2/codec_ctrl.cpp b/host/lib/usrp/usrp2/codec_ctrl.cpp
index 2e645dcec..e5be62205 100644
--- a/host/lib/usrp/usrp2/codec_ctrl.cpp
+++ b/host/lib/usrp/usrp2/codec_ctrl.cpp
@@ -86,12 +86,16 @@ public:
}
}
- void set_rx_digital_gain(float gain) { //combine fine/correction digital gains
+ void set_rx_digital_gain(float gain) { //fine digital gain
if(_iface->get_hw_rev() >= USRP2P_FIRST_HW_REV) {
- int fine_gain = int(gain/0.5);
- _ads62p44_regs.fine_gain = fine_gain; //hey what about when it calls for 6.5dB?
- _ads62p44_regs.gain_correction = (gain - (double(fine_gain) * 0.5)) / 0.05;
+ _ads62p44_regs.fine_gain = int(gain/0.5);
this->send_ads62p44_reg(0x17);
+ } else UHD_THROW_INVALID_CODE_PATH(); //should never have been called for USRP2
+ }
+
+ void set_rx_digital_fine_gain(float gain) { //gain correction
+ if(_iface->get_hw_rev() >= USRP2P_FIRST_HW_REV) {
+ _ads62p44_regs.gain_correction = int(gain / 0.05);
this->send_ads62p44_reg(0x1A);
} else UHD_THROW_INVALID_CODE_PATH(); //should never have been called for USRP2
}