diff options
author | Tom Rondeau | 2011-10-21 19:43:05 -0400 |
---|---|---|
committer | Tom Rondeau | 2011-10-21 19:43:05 -0400 |
commit | d053db2aec8fe9640f7a33b6804d68281c02f820 (patch) | |
tree | b17f76dd1fbbbd25e5ac1ce9d3019ecfbc4c9f64 /gr-uhd/examples | |
parent | f896ce03e8fbe6baf18ea7b6e5bbe74f7e67c25a (diff) | |
download | gnuradio-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')
-rwxr-xr-x | gr-uhd/examples/fm_tx4.py | 7 | ||||
-rwxr-xr-x | gr-uhd/examples/fm_tx_2_daughterboards.py | 11 | ||||
-rwxr-xr-x | gr-uhd/examples/usrp_am_mw_rcv.py | 7 | ||||
-rwxr-xr-x | gr-uhd/examples/usrp_nbfm_ptt.py | 27 | ||||
-rwxr-xr-x | gr-uhd/examples/usrp_nbfm_rcv.py | 11 | ||||
-rwxr-xr-x | gr-uhd/examples/usrp_spectrum_sense.py | 9 | ||||
-rwxr-xr-x | gr-uhd/examples/usrp_tv_rcv.py | 12 | ||||
-rwxr-xr-x | gr-uhd/examples/usrp_tv_rcv_nogui.py | 11 | ||||
-rwxr-xr-x | gr-uhd/examples/usrp_wfm_rcv.py | 9 | ||||
-rwxr-xr-x | gr-uhd/examples/usrp_wfm_rcv2_nogui.py | 8 | ||||
-rwxr-xr-x | gr-uhd/examples/usrp_wfm_rcv_fmdet.py | 9 | ||||
-rwxr-xr-x | gr-uhd/examples/usrp_wfm_rcv_nogui.py | 10 | ||||
-rwxr-xr-x | gr-uhd/examples/usrp_wfm_rcv_pll.py | 9 | ||||
-rwxr-xr-x | gr-uhd/examples/usrp_wfm_rcv_sca.py | 11 | ||||
-rwxr-xr-x | gr-uhd/examples/usrp_wxapt_rcv.py | 9 |
15 files changed, 151 insertions, 9 deletions
diff --git a/gr-uhd/examples/fm_tx4.py b/gr-uhd/examples/fm_tx4.py index 7b04ebd73..11148ea63 100755 --- a/gr-uhd/examples/fm_tx4.py +++ b/gr-uhd/examples/fm_tx4.py @@ -85,6 +85,8 @@ class fm_tx_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("-s", "--samp-rate", type="eng_float", default=400e3, @@ -134,6 +136,11 @@ class fm_tx_block(stdgui2.std_top_block): self.set_gain(options.gain) self.set_freq(options.freq) + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna if(options.antenna): self.u.set_antenna(options.antenna, 0) diff --git a/gr-uhd/examples/fm_tx_2_daughterboards.py b/gr-uhd/examples/fm_tx_2_daughterboards.py index 25325bd19..61c437a98 100755 --- a/gr-uhd/examples/fm_tx_2_daughterboards.py +++ b/gr-uhd/examples/fm_tx_2_daughterboards.py @@ -90,6 +90,8 @@ class my_top_block(gr.top_block): parser = OptionParser (option_class=eng_option, usage=usage) 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("-s", "--samp-rate", type="eng_float", default=320e3, @@ -170,6 +172,15 @@ class my_top_block(gr.top_block): self.set_gain(options.gain, 0) self.set_gain(options.gain, 1) + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + self.u.set_antenna(options.antenna, 1) + def set_freq(self, target_freq, chan): """ Set the center frequency we're interested in. diff --git a/gr-uhd/examples/usrp_am_mw_rcv.py b/gr-uhd/examples/usrp_am_mw_rcv.py index a4fba9f0e..db3b35760 100755 --- a/gr-uhd/examples/usrp_am_mw_rcv.py +++ b/gr-uhd/examples/usrp_am_mw_rcv.py @@ -40,6 +40,8 @@ class wfm_rx_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("-s", "--samp-rate", type="eng_float", default=1e6, @@ -150,6 +152,11 @@ class wfm_rx_block (stdgui2.std_top_block): if not(self.set_freq(options.freq)): self._set_status_msg("Failed to set initial frequency") + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna if(options.antenna): self.u.set_antenna(options.antenna, 0) 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) diff --git a/gr-uhd/examples/usrp_nbfm_rcv.py b/gr-uhd/examples/usrp_nbfm_rcv.py index 829381e7a..a558b9347 100755 --- a/gr-uhd/examples/usrp_nbfm_rcv.py +++ b/gr-uhd/examples/usrp_nbfm_rcv.py @@ -40,6 +40,8 @@ class my_top_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=146.585e6, @@ -67,7 +69,7 @@ class my_top_block (stdgui2.std_top_block): self.freq = 0 self.freq_step = 25e3 - self.rxpath = receive_path(options.args, options.antenna, + self.rxpath = receive_path(options.args, options.spec, options.antenna, options.gain, options.audio_output) self.connect(self.rxpath) @@ -259,7 +261,7 @@ class my_top_block (stdgui2.std_top_block): USE_SIMPLE_SQUELCH = False class receive_path(gr.hier_block2): - def __init__(self, args, antenna, gain, audio_output): + def __init__(self, args, spec, antenna, gain, audio_output): gr.hier_block2.__init__(self, "receive_path", gr.io_signature(0, 0, 0), # Input signature gr.io_signature(0, 0, 0)) # Output signature @@ -320,6 +322,11 @@ 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) diff --git a/gr-uhd/examples/usrp_spectrum_sense.py b/gr-uhd/examples/usrp_spectrum_sense.py index cf41e7043..01ca60396 100755 --- a/gr-uhd/examples/usrp_spectrum_sense.py +++ b/gr-uhd/examples/usrp_spectrum_sense.py @@ -86,6 +86,8 @@ class my_top_block(gr.top_block): parser = OptionParser(option_class=eng_option, usage=usage) parser.add_option("-a", "--args", type="string", default="", help="UHD device 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("-s", "--samp-rate", type="eng_float", default=1e6, @@ -182,6 +184,13 @@ class my_top_block(gr.top_block): self.set_gain(options.gain) print "gain =", options.gain + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) def set_next_freq(self): target_freq = self.next_freq diff --git a/gr-uhd/examples/usrp_tv_rcv.py b/gr-uhd/examples/usrp_tv_rcv.py index 2ad1f2122..22493dd00 100755 --- a/gr-uhd/examples/usrp_tv_rcv.py +++ b/gr-uhd/examples/usrp_tv_rcv.py @@ -64,6 +64,8 @@ class tv_rx_block (stdgui2.std_top_block): parser=OptionParser(option_class=eng_option, usage=usage) 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("-s", "--samp-rate", type="eng_float", default=1e6, @@ -143,7 +145,15 @@ class tv_rx_block (stdgui2.std_top_block): self.src=self.u - self.gain = options.gain + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + + self.gain = options.gain f2uc=gr.float_to_uchar() diff --git a/gr-uhd/examples/usrp_tv_rcv_nogui.py b/gr-uhd/examples/usrp_tv_rcv_nogui.py index 3fe426fbc..2324eb29e 100755 --- a/gr-uhd/examples/usrp_tv_rcv_nogui.py +++ b/gr-uhd/examples/usrp_tv_rcv_nogui.py @@ -61,6 +61,8 @@ class my_top_block(gr.top_block): parser = OptionParser(option_class=eng_option, usage=usage) 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("-s", "--samp-rate", type="eng_float", default=1e6, @@ -148,6 +150,15 @@ class my_top_block(gr.top_block): if not r: sys.stderr.write('Failed to set frequency\n') raise SystemExit, 1 + + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + self.agc = gr.agc_cc(1e-7,1.0,1.0) #1e-7 self.am_demod = gr.complex_to_mag () diff --git a/gr-uhd/examples/usrp_wfm_rcv.py b/gr-uhd/examples/usrp_wfm_rcv.py index 138e5045b..cfdaa6d6f 100755 --- a/gr-uhd/examples/usrp_wfm_rcv.py +++ b/gr-uhd/examples/usrp_wfm_rcv.py @@ -36,6 +36,8 @@ class wfm_rx_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=100.1e6, @@ -129,6 +131,13 @@ class wfm_rx_block (stdgui2.std_top_block): if not(self.set_freq(options.freq)): self._set_status_msg("Failed to set initial frequency") + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) def _set_status_msg(self, msg, which=0): self.frame.GetStatusBar().SetStatusText(msg, which) diff --git a/gr-uhd/examples/usrp_wfm_rcv2_nogui.py b/gr-uhd/examples/usrp_wfm_rcv2_nogui.py index 13f89c71c..8cbd18475 100755 --- a/gr-uhd/examples/usrp_wfm_rcv2_nogui.py +++ b/gr-uhd/examples/usrp_wfm_rcv2_nogui.py @@ -35,6 +35,8 @@ class wfm_rx_block (gr.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="A:0 A:0", + 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("", "--f1", type="eng_float", default=100.7e6, @@ -73,7 +75,7 @@ class wfm_rx_block (gr.top_block): num_channels=2) # Set front end channel mapping - self.u.set_subdev_spec("A:0 A:0") + self.u.set_subdev_spec(options.spec) usrp_rate = 320e3 demod_rate = 320e3 @@ -134,6 +136,10 @@ class wfm_rx_block (gr.top_block): # Set gain for each channel self.set_gain(options.gain, n) + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, n) + def set_vol (self, vol): self.vol = vol self.volume_control.set_k(self.vol) diff --git a/gr-uhd/examples/usrp_wfm_rcv_fmdet.py b/gr-uhd/examples/usrp_wfm_rcv_fmdet.py index d13ebe829..39c711a6d 100755 --- a/gr-uhd/examples/usrp_wfm_rcv_fmdet.py +++ b/gr-uhd/examples/usrp_wfm_rcv_fmdet.py @@ -35,6 +35,8 @@ class wfm_rx_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=100.1e6, @@ -151,6 +153,13 @@ class wfm_rx_block (stdgui2.std_top_block): if not(self.set_freq(options.freq)): self._set_status_msg("Failed to set initial frequency") + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) def _set_status_msg(self, msg, which=0): self.frame.GetStatusBar().SetStatusText(msg, which) diff --git a/gr-uhd/examples/usrp_wfm_rcv_nogui.py b/gr-uhd/examples/usrp_wfm_rcv_nogui.py index 7c2c6050d..90caf7d08 100755 --- a/gr-uhd/examples/usrp_wfm_rcv_nogui.py +++ b/gr-uhd/examples/usrp_wfm_rcv_nogui.py @@ -34,6 +34,8 @@ class wfm_rx_block (gr.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=100.1e6, @@ -119,6 +121,14 @@ class wfm_rx_block (gr.top_block): if not(self.set_freq(options.freq)): self._set_status_msg("Failed to set initial frequency") + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + def set_vol (self, vol): g = self.volume_range() self.vol = max(g[0], min(g[1], vol)) diff --git a/gr-uhd/examples/usrp_wfm_rcv_pll.py b/gr-uhd/examples/usrp_wfm_rcv_pll.py index 78c05e057..2901bf735 100755 --- a/gr-uhd/examples/usrp_wfm_rcv_pll.py +++ b/gr-uhd/examples/usrp_wfm_rcv_pll.py @@ -36,6 +36,8 @@ class wfm_rx_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=100.1e6, @@ -149,6 +151,13 @@ class wfm_rx_block (stdgui2.std_top_block): if not(self.set_freq(options.freq)): self._set_status_msg("Failed to set initial frequency") + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) def _set_status_msg(self, msg, which=0): self.frame.GetStatusBar().SetStatusText(msg, which) diff --git a/gr-uhd/examples/usrp_wfm_rcv_sca.py b/gr-uhd/examples/usrp_wfm_rcv_sca.py index f0f6aec66..9caef7499 100755 --- a/gr-uhd/examples/usrp_wfm_rcv_sca.py +++ b/gr-uhd/examples/usrp_wfm_rcv_sca.py @@ -66,6 +66,8 @@ class wfm_rx_sca_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=100.1e6, @@ -211,7 +213,14 @@ class wfm_rx_sca_block (stdgui2.std_top_block): self._set_status_msg("Failed to set initial frequency") self.set_sca_freq(67000) # A common SCA Frequency - + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) + def _set_status_msg(self, msg, which=0): self.frame.GetStatusBar().SetStatusText(msg, which) diff --git a/gr-uhd/examples/usrp_wxapt_rcv.py b/gr-uhd/examples/usrp_wxapt_rcv.py index 809756d96..1da51d363 100755 --- a/gr-uhd/examples/usrp_wxapt_rcv.py +++ b/gr-uhd/examples/usrp_wxapt_rcv.py @@ -36,6 +36,8 @@ class wxapt_rx_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=137.5e6, @@ -124,6 +126,13 @@ class wxapt_rx_block (stdgui2.std_top_block): if not(self.set_freq(options.freq)): self._set_status_msg("Failed to set initial frequency") + # Set the subdevice spec + if(options.spec): + self.u.set_subdev_spec(options.spec, 0) + + # Set the antenna + if(options.antenna): + self.u.set_antenna(options.antenna, 0) def _set_status_msg(self, msg, which=0): self.frame.GetStatusBar().SetStatusText(msg, which) |