commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11433 - in gnuradio/branches/developers/eb/vrt: gr-ut


From: jblum
Subject: [Commit-gnuradio] r11433 - in gnuradio/branches/developers/eb/vrt: gr-utils/src/python gr-vrt/src vrt/include/vrt vrt/lib
Date: Tue, 14 Jul 2009 16:36:54 -0600 (MDT)

Author: jblum
Date: 2009-07-14 16:36:53 -0600 (Tue, 14 Jul 2009)
New Revision: 11433

Modified:
   gnuradio/branches/developers/eb/vrt/gr-utils/src/python/qr_fft.py
   gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt.i
   gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.cc
   gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.h
   gnuradio/branches/developers/eb/vrt/vrt/include/vrt/quadradio.h
   gnuradio/branches/developers/eb/vrt/vrt/lib/quadradio.cc
Log:
added more convenience methods, and implemented them in qr_fft.py

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-14 20:47:47 UTC (rev 11432)
+++ gnuradio/branches/developers/eb/vrt/gr-utils/src/python/qr_fft.py   
2009-07-14 22:36:53 UTC (rev 11433)
@@ -205,11 +205,12 @@
         ##### 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_adcgain', self.u.set_adc_gain)
+        self.subscribe('db_ctrl_diggain', self.u.set_digital_gain)
+        self.subscribe('db_ctrl_dcoffset', self.u.set_dc_offset_comp)
         self.subscribe('db_ctrl_bandsel', self.u.set_band_select)
         self.subscribe('db_ctrl_type', self.u.select_rx_antenna)
+        self.subscribe('db_test_signal', self.u.set_test_signal)
         self['db_ctrl_atten'] = 0
         self['db_ctrl_10db'] = False
         self['db_ctrl_adcgain'] = False
@@ -217,6 +218,7 @@
         self['db_ctrl_diggain'] = 0.0
         self['db_ctrl_bandsel'] = 'A'
         self['db_ctrl_type'] = 'rf'
+        self['db_test_signal'] = vrt.VRT_TEST_SIG_NORMAL
         hbox = wx.BoxSizer(wx.HORIZONTAL)
         hbox.AddSpacer(10)
         #create slider for atten
@@ -313,6 +315,22 @@
             proportion=2,
         )
         hbox.AddSpacer(10)
+        #create radio buttons for band sel
+        types = sorted(
+            filter(lambda x: x.startswith('VRT_TEST_SIG_'), dir(vrt)),
+            lambda x, y: cmp(getattr(vrt, x), getattr(vrt, y)),
+        )
+        forms.drop_down(
+            label='Test Signal',
+            ps=self,
+            key='db_test_signal',
+            choices=map(lambda a: getattr(vrt, a), types),
+            labels=types,
+            sizer=hbox,
+            parent=panel,
+            proportion=2,
+        )
+        hbox.AddSpacer(10)
         #create radio buttons for type
         forms.radio_buttons(
             label='RF Input',
@@ -326,31 +344,7 @@
         )
         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, 0x00)  # 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.

Modified: gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt.i
===================================================================
--- gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt.i        2009-07-14 
20:47:47 UTC (rev 11432)
+++ gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt.i        2009-07-14 
22:36:53 UTC (rev 11433)
@@ -25,6 +25,7 @@
 
 %{
 #include "vrt_quadradio_source_32fc.h"
+#include <vrt/quadradio.h>
 //#include "vrt_quadradio_source_16sc.h"
 //#include "vrt_sink_32fc.h"
 //#include "vrt_sink_16sc.h"
@@ -53,6 +54,7 @@
   ~vrt_source_32fc();
 };
 
+%include <vrt/quadradio.h>
 
 // ----------------------------------------------------------------
 
@@ -84,6 +86,11 @@
 
   bool set_attenuation(int attenuation);
 
+  void set_adc_gain(bool on);
+  void set_dc_offset_comp(bool on);
+  void set_digital_gain(float gain);
+  void set_test_signal(int type);
+
   bool set_setting_reg(int regno, int value);
   bool set_hsadc_conf(int which_dboard, int regno, int value);
   bool set_lsdac(int which_dboard, int which_dac, int value);

Modified: 
gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.cc
===================================================================
--- gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.cc 
2009-07-14 20:47:47 UTC (rev 11432)
+++ gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.cc 
2009-07-14 22:36:53 UTC (rev 11433)
@@ -108,6 +108,26 @@
   return d_qr->set_attenuation(attenuation);
 }
 
+void
+vrt_quadradio_source_32fc::set_adc_gain(bool on){
+  d_qr->set_adc_gain(on);
+}
+
+void
+vrt_quadradio_source_32fc::set_dc_offset_comp(bool on){
+  d_qr->set_dc_offset_comp(on);
+}
+
+void
+vrt_quadradio_source_32fc::set_digital_gain(float gain){
+  d_qr->set_digital_gain(gain);
+}
+
+void
+vrt_quadradio_source_32fc::set_test_signal(int type){
+  d_qr->set_test_signal(static_cast<vrt_test_sig_t>(type));
+}
+
 bool
 vrt_quadradio_source_32fc::set_setting_reg(int regno, int value)
 {

Modified: 
gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.h
===================================================================
--- gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.h  
2009-07-14 20:47:47 UTC (rev 11432)
+++ gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.h  
2009-07-14 22:36:53 UTC (rev 11433)
@@ -94,6 +94,10 @@
    */
   bool set_attenuation(int attenuation);
 
+  void set_adc_gain(bool on);
+  void set_dc_offset_comp(bool on);
+  void set_digital_gain(float gain);
+  void set_test_signal(int type);
 
   bool set_setting_reg(int regno, int value);
   bool set_hsadc_conf(int which_dboard, int regno, int value);

Modified: gnuradio/branches/developers/eb/vrt/vrt/include/vrt/quadradio.h
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/include/vrt/quadradio.h     
2009-07-14 20:47:47 UTC (rev 11432)
+++ gnuradio/branches/developers/eb/vrt/vrt/include/vrt/quadradio.h     
2009-07-14 22:36:53 UTC (rev 11433)
@@ -28,6 +28,16 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 
+typedef enum{
+    VRT_TEST_SIG_NORMAL=0,
+    VRT_TEST_SIG_ZEROS=1,
+    VRT_TEST_SIG_ONES=2,
+    VRT_TEST_SIG_TOGGLE=3,
+    VRT_TEST_SIG_RAMP=4,
+    VRT_TEST_SIG_CUSTOM=5,  
+      
+    } vrt_test_sig_t;
+
 namespace vrt {
 
   /*
@@ -87,6 +97,12 @@
     bool select_rx_antenna(const std::string &ant);
     bool set_attenuation(int attenuation);
     
+    /* convenience methods that ultimately call set_hsadc_conf */
+    void set_adc_gain(bool on);
+    void set_dc_offset_comp(bool on);
+    void set_digital_gain(float gain);
+    void set_test_signal(vrt_test_sig_t type);
+    
     bool set_setting_reg(int regno, int value);
     bool set_hsadc_conf(int which_dboard, int regno, int value);
     bool set_lsdac(int which_dboard, int which_dac, int value);

Modified: gnuradio/branches/developers/eb/vrt/vrt/lib/quadradio.cc
===================================================================
--- gnuradio/branches/developers/eb/vrt/vrt/lib/quadradio.cc    2009-07-14 
20:47:47 UTC (rev 11432)
+++ gnuradio/branches/developers/eb/vrt/vrt/lib/quadradio.cc    2009-07-14 
22:36:53 UTC (rev 11433)
@@ -26,6 +26,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <stdexcept>
+#include <math.h>
 
 #define        MIN_IP_LOCAL_PORT       32768
 #define        MAX_IP_LOCAL_PORT       61000
@@ -153,7 +154,32 @@
   return send_and_check(d_ctrl_fd, cmd, sizeof(cmd));
 }
   
+void
+vrt::quadradio::set_adc_gain(bool on){
+    if (on) set_hsadc_conf(0, 0x14, 0x90);
+    else set_hsadc_conf(0, 0x14, 0x80);
+}
 
+void
+vrt::quadradio::set_dc_offset_comp(bool on){
+    if (on) {
+        set_hsadc_conf(0, 0x1B, 0x80);
+        set_hsadc_conf(0, 0x1A, 0x00); //bits 6:4 set time constant
+    }
+    else set_hsadc_conf(0, 0x1B, 0x00);
+}
+
+void
+vrt::quadradio::set_digital_gain(float gain){
+    int gain_q1 = static_cast<int>(round(gain*2.0));
+    set_hsadc_conf(0, 0x17, gain_q1);
+}
+
+void
+vrt::quadradio::set_test_signal(vrt_test_sig_t type){
+    set_hsadc_conf(0, 0x16, type);
+}
+
 bool
 vrt::quadradio::open_sockets(const char *quad_radio_ip, int 
quad_radio_ctrl_port,
                             int *ctrl_fd_ptr, struct in_addr *ctrl_port_inaddr,





reply via email to

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