commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10976 - gnuradio/branches/developers/jblum/digital


From: jblum
Subject: [Commit-gnuradio] r10976 - gnuradio/branches/developers/jblum/digital
Date: Tue, 5 May 2009 19:40:37 -0600 (MDT)

Author: jblum
Date: 2009-05-05 19:40:37 -0600 (Tue, 05 May 2009)
New Revision: 10976

Modified:
   gnuradio/branches/developers/jblum/digital/generic_usrp.py
   gnuradio/branches/developers/jblum/digital/receive_path.py
   gnuradio/branches/developers/jblum/digital/transmit_path.py
   gnuradio/branches/developers/jblum/digital/usrp_options.py
Log:
Added LO offset to usrp options.
Set gain and lo offset on init in generic usrp.

Modified: gnuradio/branches/developers/jblum/digital/generic_usrp.py
===================================================================
--- gnuradio/branches/developers/jblum/digital/generic_usrp.py  2009-05-06 
01:11:54 UTC (rev 10975)
+++ gnuradio/branches/developers/jblum/digital/generic_usrp.py  2009-05-06 
01:40:37 UTC (rev 10976)
@@ -29,8 +29,9 @@
 ########################################################################
 class _generic_usrp_base(object):
 
-    def __init__(self, which=0, subdev_spec=None, interface="", mac_addr="", 
fusb_block_size=0, fusb_nblocks=0, usrpx=None):
-        self._gain = 0
+    def __init__(self, which=0, subdev_spec=None, interface="", mac_addr="", 
fusb_block_size=0, fusb_nblocks=0, usrpx=None, lo_offset=None, gain=None):
+        self._gain = gain
+        self._lo_offset = lo_offset
         self._usrpx = usrpx
         #usrp options
         self._which = which
@@ -42,6 +43,12 @@
         self._fusb_block_size = fusb_block_size
         self._fusb_nblocks = fusb_nblocks
 
+    def _post_setup_usrp(self):
+        if self._lo_offset is not None:
+            self.set_lo_offset(self._lo_offset)
+        self.set_gain(self._gain)
+        self.set_auto_tr(True)
+
     def __str__(self):
         if self._type == USRP1_TYPE: return self._subdev.side_and_name()
         elif self._type == USRP2_TYPE:
@@ -72,6 +79,10 @@
         if self._type == USRP1_TYPE: return self._subdev.freq_range()
         elif self._type == USRP2_TYPE: return self._u.freq_range()
 
+    def set_lo_offset(self, lo_offset):
+        if self._type == USRP1_TYPE: return 
self._subdev.set_lo_offset(lo_offset)
+        elif self._type == USRP2_TYPE: return self._u.set_lo_offset(lo_offset)
+
     def set_auto_tr(self, enable):
         if self._type == USRP1_TYPE: return self._subdev.set_auto_tr(enable)
 
@@ -103,7 +114,7 @@
             try: self._setup_usrp2()
             except: self._setup_usrp1()
         self.connect(self._u, self)
-        self.set_auto_tr(True)
+        self._post_setup_usrp()
 
     ####################################################################
     # generic access methods
@@ -160,7 +171,7 @@
         if self._type == USRP1_TYPE: #scale 0.0 to 1.0 input for usrp1
             self.connect(self, gr.multiply_const_cc((2**15)-1), self._u)
         elif self._type == USRP2_TYPE: self.connect(self, self._u)
-        self.set_auto_tr(True)
+        self._post_setup_usrp()
 
     ####################################################################
     # generic access methods

Modified: gnuradio/branches/developers/jblum/digital/receive_path.py
===================================================================
--- gnuradio/branches/developers/jblum/digital/receive_path.py  2009-05-06 
01:11:54 UTC (rev 10975)
+++ gnuradio/branches/developers/jblum/digital/receive_path.py  2009-05-06 
01:40:37 UTC (rev 10976)
@@ -45,7 +45,6 @@
 
         self._verbose            = options.verbose
         self._rx_freq            = options.rx_freq         # receiver's center 
frequency
-        self._rx_gain            = options.rx_gain         # receiver's gain
         self._bitrate            = options.bitrate         # desired bit rate
         self._decim              = options.decim           # Decimating rate 
for the USRP (prelim)
         self._samples_per_symbol = options.samples_per_symbol  # desired 
samples/symbol
@@ -60,11 +59,6 @@
         # Set up USRP source; also adjusts decim, samples_per_symbol, and 
bitrate
         self._setup_usrp_source(options)
 
-        if options.show_rx_gain_range:
-            print "Rx Gain Range: minimum = %g, maximum = %g, step size = 
%g"%tuple(self.u.gain_range())
-
-        self.set_gain(options.rx_gain)
-
         # Set RF frequency
         ok = self.set_freq(self._rx_freq)
         if not ok:
@@ -142,12 +136,6 @@
         determine the value for the digital up converter.
         """
         return self.u.set_center_freq(target_freq)
-
-    def set_gain(self, gain):
-        """
-        Sets the analog gain in the USRP
-        """
-        return self.u.set_gain(gain)
         
     def bitrate(self):
         return self._bitrate

Modified: gnuradio/branches/developers/jblum/digital/transmit_path.py
===================================================================
--- gnuradio/branches/developers/jblum/digital/transmit_path.py 2009-05-06 
01:11:54 UTC (rev 10975)
+++ gnuradio/branches/developers/jblum/digital/transmit_path.py 2009-05-06 
01:40:37 UTC (rev 10976)
@@ -87,7 +87,7 @@
 
         # Set the USRP for maximum transmit gain
         # (Note that on the RFX cards this is a nop.)
-        self.set_gain(self.u.gain_range()[1])
+        #self.set_gain(self.u.gain_range()[1])
 
         self.amp = gr.multiply_const_cc(1)
         self.set_tx_amplitude(self._tx_amplitude)
@@ -128,12 +128,6 @@
         determine the value for the digital up converter.
         """
         return self.u.set_center_freq(target_freq)
-        
-    def set_gain(self, gain):
-        """
-        Sets the analog gain in the USRP
-        """
-        return self.u.set_gain(gain)
 
     def set_tx_amplitude(self, ampl):
         """

Modified: gnuradio/branches/developers/jblum/digital/usrp_options.py
===================================================================
--- gnuradio/branches/developers/jblum/digital/usrp_options.py  2009-05-06 
01:11:54 UTC (rev 10975)
+++ gnuradio/branches/developers/jblum/digital/usrp_options.py  2009-05-06 
01:40:37 UTC (rev 10976)
@@ -35,6 +35,9 @@
                       help="specify fast usb block size [default=%default]")
     if expert: expert.add_option("-N", "--fusb-nblocks", type="int", default=0,
                       help="specify number of fast usb blocks 
[default=%default]")
+    #lo offset
+    parser.add_option("--lo-offset", type="eng_float", default=None,
+                      help="set LO Offset in Hz [default=automatic].")
     #usrp options
     parser.add_option("-w", "--which", type="int", default=0,
                       help="select USRP board [default=%default]")
@@ -77,6 +80,8 @@
         mac_addr=options.mac_addr,
         fusb_block_size=options.fusb_block_size,
         fusb_nblocks=options.fusb_nblocks,
+        lo_offset=options.lo_offset,
+        gain=options.rx_gain,
     )
     if options.show_rx_gain_range:
         print "Rx Gain Range: minimum = %g, maximum = %g, step size = 
%g"%tuple(u.gain_range())
@@ -107,6 +112,8 @@
         mac_addr=options.mac_addr,
         fusb_block_size=options.fusb_block_size,
         fusb_nblocks=options.fusb_nblocks,
+        lo_offset=options.lo_offset,
+        gain=options.tx_gain,
     )
     if options.show_tx_gain_range:
         print "Tx Gain Range: minimum = %g, maximum = %g, step size = 
%g"%tuple(u.gain_range())





reply via email to

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