summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatt2008-11-16 20:55:07 +0000
committermatt2008-11-16 20:55:07 +0000
commitde8ca69a22ada942849f4232954854d47e5e724d (patch)
tree14aecb12fd659c9c1549409bf43ae6e21fa9aed4
parent0aa75fde365f501a68a1028aed9426add2267e5f (diff)
downloadgnuradio-de8ca69a22ada942849f4232954854d47e5e724d.tar.gz
gnuradio-de8ca69a22ada942849f4232954854d47e5e724d.tar.bz2
gnuradio-de8ca69a22ada942849f4232954854d47e5e724d.zip
fixed gain calculations rfx900-2400
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9998 221aa14e-8319-0410-a670-987f0aec2ac5
-rw-r--r--usrp2/firmware/lib/db_rfx.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usrp2/firmware/lib/db_rfx.c b/usrp2/firmware/lib/db_rfx.c
index 40d2cb2dc..32f2c24e8 100644
--- a/usrp2/firmware/lib/db_rfx.c
+++ b/usrp2/firmware/lib/db_rfx.c
@@ -517,10 +517,10 @@ rfx_set_gain_rx(struct db_base *dbb, u2_fxpt_gain_t gain)
{
struct db_rfx_dummy *db = (struct db_rfx_dummy *) dbb;
- u2_fxpt_gain_t MAXGAIN = U2_DOUBLE_TO_FXPT_GAIN(70.0);
-
int offset_q8 = (int)(1.2/3.3*4096*(1<<15));
- int slope_q8 = (int)(-1.0/45.0*4096/3.3*256);
+ int range_q15 = (int)(-1.0*4096/3.3*256*128);
+ int slope_q8 = range_q15/db->base.gain_max;
+
int dacword = ((slope_q8 * gain) + offset_q8)>>15;
//printf("DACWORD %d\n",dacword);
lsdac_write_rx(1,dacword);