summaryrefslogtreecommitdiff
path: root/gr-digital/examples/narrowband/uhd_interface.py
diff options
context:
space:
mode:
authorTom Rondeau2011-10-21 19:04:06 -0400
committerTom Rondeau2011-10-21 19:04:06 -0400
commitf896ce03e8fbe6baf18ea7b6e5bbe74f7e67c25a (patch)
treec3db006163e13547b2b75ed45bc4f7d9630e55ab /gr-digital/examples/narrowband/uhd_interface.py
parent3e7ca8bfb95658dd9204e1d859e572b82e3b80d4 (diff)
downloadgnuradio-f896ce03e8fbe6baf18ea7b6e5bbe74f7e67c25a.tar.gz
gnuradio-f896ce03e8fbe6baf18ea7b6e5bbe74f7e67c25a.tar.bz2
gnuradio-f896ce03e8fbe6baf18ea7b6e5bbe74f7e67c25a.zip
digital: added subdevspec option to digital UHD examples.
Diffstat (limited to 'gr-digital/examples/narrowband/uhd_interface.py')
-rw-r--r--gr-digital/examples/narrowband/uhd_interface.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/gr-digital/examples/narrowband/uhd_interface.py b/gr-digital/examples/narrowband/uhd_interface.py
index a0be516ec..21930ad01 100644
--- a/gr-digital/examples/narrowband/uhd_interface.py
+++ b/gr-digital/examples/narrowband/uhd_interface.py
@@ -43,7 +43,7 @@ def add_freq_option(parser):
class uhd_interface:
def __init__(self, istx, args, sym_rate, sps, freq=None,
- gain=None, antenna=None):
+ gain=None, spec=None, antenna=None):
if(istx):
self.u = uhd.usrp_sink(device_addr=args,
@@ -56,11 +56,17 @@ class uhd_interface:
self._args = args
self._ant = antenna
+ self._spec = spec
self._gain = self.set_gain(gain)
self._freq = self.set_freq(freq)
self._rate, self._sps = self.set_sample_rate(sym_rate, sps)
+ # Set the subdevice spec
+ if(spec):
+ self.u.set_subdev_spec(spec, 0)
+
+ # Set the antenna
if(antenna):
self.u.set_antenna(antenna, 0)
@@ -125,14 +131,14 @@ class uhd_interface:
class uhd_transmitter(uhd_interface, gr.hier_block2):
def __init__(self, args, sym_rate, sps, freq=None, gain=None,
- antenna=None, verbose=False):
+ spec=None, antenna=None, verbose=False):
gr.hier_block2.__init__(self, "uhd_transmitter",
gr.io_signature(1,1,gr.sizeof_gr_complex),
gr.io_signature(0,0,0))
# Set up the UHD interface as a transmitter
uhd_interface.__init__(self, True, args, sym_rate, sps,
- freq, gain, antenna)
+ freq, gain, spec, antenna)
self.connect(self, self.u)
@@ -143,6 +149,8 @@ class uhd_transmitter(uhd_interface, gr.hier_block2):
add_freq_option(parser)
parser.add_option("-a", "--args", type="string", default="",
help="UHD device address args [default=%default]")
+ parser.add_option("", "--spec", type="string", default=None,
+ help="Subdevice of UHD device where appropriate")
parser.add_option("-A", "--antenna", type="string", default=None,
help="select Rx Antenna where appropriate")
parser.add_option("", "--tx-freq", type="eng_float", default=None,
@@ -165,7 +173,7 @@ class uhd_transmitter(uhd_interface, gr.hier_block2):
print "Gain: %f dB" % (self._gain)
print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate))
print "Antenna: %s" % (self._ant)
-
+ print "Subdev Sec: %s" % (self._spec)
#-------------------------------------------------------------------#
@@ -175,14 +183,14 @@ class uhd_transmitter(uhd_interface, gr.hier_block2):
class uhd_receiver(uhd_interface, gr.hier_block2):
def __init__(self, args, sym_rate, sps, freq=None, gain=None,
- antenna=None, verbose=False):
+ spec=None, antenna=None, verbose=False):
gr.hier_block2.__init__(self, "uhd_receiver",
gr.io_signature(0,0,0),
gr.io_signature(1,1,gr.sizeof_gr_complex))
# Set up the UHD interface as a receiver
uhd_interface.__init__(self, False, args, sym_rate, sps,
- freq, gain, antenna)
+ freq, gain, spec, antenna)
self.connect(self.u, self)
@@ -193,6 +201,8 @@ class uhd_receiver(uhd_interface, gr.hier_block2):
add_freq_option(parser)
parser.add_option("-a", "--args", type="string", default="",
help="UHD device address args [default=%default]")
+ parser.add_option("", "--spec", type="string", default=None,
+ help="Subdevice of UHD device where appropriate")
parser.add_option("-A", "--antenna", type="string", default=None,
help="select Rx Antenna where appropriate")
parser.add_option("", "--rx-freq", type="eng_float", default=None,
@@ -216,4 +226,4 @@ class uhd_receiver(uhd_interface, gr.hier_block2):
print "Gain: %f dB" % (self._gain)
print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate))
print "Antenna: %s" % (self._ant)
-
+ print "Spec: %s" % (self._spec)