summaryrefslogtreecommitdiff
path: root/gr-uhd/examples/usrp_nbfm_ptt.py
diff options
context:
space:
mode:
authorTom Rondeau2011-10-21 19:43:05 -0400
committerTom Rondeau2011-10-21 19:43:05 -0400
commitd053db2aec8fe9640f7a33b6804d68281c02f820 (patch)
treeb17f76dd1fbbbd25e5ac1ce9d3019ecfbc4c9f64 /gr-uhd/examples/usrp_nbfm_ptt.py
parentf896ce03e8fbe6baf18ea7b6e5bbe74f7e67c25a (diff)
downloadgnuradio-d053db2aec8fe9640f7a33b6804d68281c02f820.tar.gz
gnuradio-d053db2aec8fe9640f7a33b6804d68281c02f820.tar.bz2
gnuradio-d053db2aec8fe9640f7a33b6804d68281c02f820.zip
uhd: added subdevspec option to UHD examples and sets antenna based on option.
Diffstat (limited to 'gr-uhd/examples/usrp_nbfm_ptt.py')
-rwxr-xr-xgr-uhd/examples/usrp_nbfm_ptt.py27
1 files changed, 23 insertions, 4 deletions
diff --git a/gr-uhd/examples/usrp_nbfm_ptt.py b/gr-uhd/examples/usrp_nbfm_ptt.py
index 1f8a72e79..8f7ddee7d 100755
--- a/gr-uhd/examples/usrp_nbfm_ptt.py
+++ b/gr-uhd/examples/usrp_nbfm_ptt.py
@@ -50,6 +50,8 @@ class ptt_block(stdgui2.std_top_block):
parser = OptionParser (option_class=eng_option)
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 ("-f", "--freq", type="eng_float", default=442.1e6,
@@ -72,9 +74,11 @@ class ptt_block(stdgui2.std_top_block):
if options.freq < 1e6:
options.freq *= 1e6
- self.txpath = transmit_path(options.args, options.tx_gain,
+ self.txpath = transmit_path(options.args, options.spec,
+ options.antenna, options.tx_gain,
options.audio_input)
- self.rxpath = receive_path(options.args, options.rx_gain,
+ self.rxpath = receive_path(options.args, options.spec,
+ options.antenna, options.rx_gain,
options.audio_output)
self.connect(self.txpath)
self.connect(self.rxpath)
@@ -272,7 +276,7 @@ class ptt_block(stdgui2.std_top_block):
# ////////////////////////////////////////////////////////////////////////
class transmit_path(gr.hier_block2):
- def __init__(self, args, gain, audio_input):
+ def __init__(self, args, spec, antenna, gain, audio_input):
gr.hier_block2.__init__(self, "transmit_path",
gr.io_signature(0, 0, 0), # Input signature
gr.io_signature(0, 0, 0)) # Output signature
@@ -331,6 +335,14 @@ class transmit_path(gr.hier_block2):
self.set_enable(False)
+ # Set the subdevice spec
+ if(spec):
+ self.u.set_subdev_spec(spec, 0)
+
+ # Set the antenna
+ if(antenna):
+ self.u.set_antenna(antenna, 0)
+
def set_freq(self, target_freq):
"""
Set the center frequency we're interested in.
@@ -415,7 +427,14 @@ class receive_path(gr.hier_block2):
s = self.squelch_range()
self.set_squelch((s[0]+s[1])/2)
-
+ # Set the subdevice spec
+ if(spec):
+ self.u.set_subdev_spec(spec, 0)
+
+ # Set the antenna
+ if(antenna):
+ self.u.set_antenna(antenna, 0)
+
def volume_range(self):
return (-20.0, 0.0, 0.5)