commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r11421 - gnuradio/branches/developers/eb/vrt/gr-utils/


From: matt
Subject: [Commit-gnuradio] r11421 - gnuradio/branches/developers/eb/vrt/gr-utils/src/python
Date: Sat, 11 Jul 2009 16:11:59 -0600 (MDT)

Author: matt
Date: 2009-07-11 16:11:59 -0600 (Sat, 11 Jul 2009)
New Revision: 11421

Modified:
   gnuradio/branches/developers/eb/vrt/gr-utils/src/python/qr_fft.py
Log:
control ADC properties -- coarse gain, digital gain, dc offset


Modified: gnuradio/branches/developers/eb/vrt/gr-utils/src/python/qr_fft.py
===================================================================
--- gnuradio/branches/developers/eb/vrt/gr-utils/src/python/qr_fft.py   
2009-07-11 22:10:25 UTC (rev 11420)
+++ gnuradio/branches/developers/eb/vrt/gr-utils/src/python/qr_fft.py   
2009-07-11 22:11:59 UTC (rev 11421)
@@ -205,12 +205,18 @@
         ##### db control stuff #####
         self.subscribe('db_ctrl_atten', self.u.set_attenuation)
         self.subscribe('db_ctrl_10db', self.u.set_10dB_atten)
+        self.subscribe('db_ctrl_adcgain', self.set_adcgain)
+        self.subscribe('db_ctrl_diggain', self.set_diggain)
+        self.subscribe('db_ctrl_dcoffset', self.set_dcoffset)
         self.subscribe('db_ctrl_bandsel', self.u.set_band_select)
         self.subscribe('db_ctrl_type', self.u.select_rx_antenna)
         self['db_ctrl_atten'] = 0
         self['db_ctrl_10db'] = False
+        self['db_ctrl_adcgain'] = False
+        self['db_ctrl_dcoffset'] = False
+        self['db_ctrl_diggain'] = 0.0
         self['db_ctrl_bandsel'] = 'A'
-        self['db_ctrl_type'] = 'cal'
+        self['db_ctrl_type'] = 'rf'
         hbox = wx.BoxSizer(wx.HORIZONTAL)
         hbox.AddSpacer(10)
         #create slider for atten
@@ -247,6 +253,52 @@
         )
         hbox.AddSpacer(10)
         vbox.Add(hbox, 0, wx.EXPAND)
+        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
+        hbox2.AddSpacer(10)
+        forms.static_text(
+            label='ADC Controls',
+            ps=self,
+            key='db_ctrl_diggain',
+            sizer=hbox2,
+            parent=panel,
+            proportion=0,
+            converter=forms.float_converter()
+        )
+        hbox2.AddSpacer(20)
+        #create checkbox for ADC digital gain
+        forms.slider(
+            #label='ADC Digital Gain',
+            ps=self,
+            minimum=0,
+            maximum=6,
+            step_size=0.5,
+            key='db_ctrl_diggain',
+            sizer=hbox2,
+            parent=panel,
+            proportion=2,
+        )
+        hbox2.AddSpacer(10)
+        #create checkbox for 3.5dB ADC gain
+        forms.check_box(
+            label='3.5dB ADC Gain',
+            ps=self,
+            key='db_ctrl_adcgain',
+            sizer=hbox2,
+            parent=panel,
+            proportion=1,
+        )
+        hbox2.AddSpacer(10)
+        #create checkbox for DC Offset Correction in ADC
+        forms.check_box(
+            label='DC Offset Correction',
+            ps=self,
+            key='db_ctrl_dcoffset',
+            sizer=hbox2,
+            parent=panel,
+            proportion=2,
+        )
+        hbox2.AddSpacer(10)
+        vbox.Add(hbox2, 0, wx.EXPAND)
         hbox = wx.BoxSizer(wx.HORIZONTAL)
         hbox.AddSpacer(10)
         #create radio buttons for band sel
@@ -275,6 +327,30 @@
         hbox.AddSpacer(10)
         vbox.Add(hbox, 0, wx.EXPAND)
 
+    def set_adcgain(self, On):
+        print "Set ADC Gain to : ", On
+        if On:
+            self.u.set_hsadc_conf(0, 0x14, 0x10)
+        else:
+            self.u.set_hsadc_conf(0, 0x14, 0x00)
+            
+    def set_dcoffset(self, On):
+        print "Set DC Offset : ", On
+        if On:
+            self.u.set_hsadc_conf(0, 0x1B, 0x80)
+            self.u.set_hsadc_conf(0, 0x1A, 0x30)  # bits 6:4 set time constant
+        else:
+            self.u.set_hsadc_conf(0, 0x1B, 0x00)
+            
+    def set_diggain(self, gain):
+        print "Set DIG Gain to : ", gain
+        self.u.set_hsadc_conf(0, 0x17, int(round(2*gain)))
+
+        #if On:
+        #    self.u.set_hsadc_conf(0, 0x14, 0x10)
+        #else:
+        #    self.u.set_hsadc_conf(0, 0x14, 0x00)
+            
     def set_freq(self, target_freq):
         """
         Set the center frequency we're interested in.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]