diff options
author | Tom Rondeau | 2010-11-29 12:57:07 -0500 |
---|---|---|
committer | Tom Rondeau | 2010-11-29 12:57:07 -0500 |
commit | 4d3bbb036cc4b910e5165c8a5dc7261ef4ebc43b (patch) | |
tree | 90a22ae5349d6238065f6ddb1b0ae54b8abe1a69 /gnuradio-examples | |
parent | 0f2bd2c94baa43fc8626f5285c0696a379ef5efd (diff) | |
download | gnuradio-4d3bbb036cc4b910e5165c8a5dc7261ef4ebc43b.tar.gz gnuradio-4d3bbb036cc4b910e5165c8a5dc7261ef4ebc43b.tar.bz2 gnuradio-4d3bbb036cc4b910e5165c8a5dc7261ef4ebc43b.zip |
Fixing up the UHD sample tag example to take command line options.
Diffstat (limited to 'gnuradio-examples')
-rwxr-xr-x | gnuradio-examples/python/tags/uhd_burst_detector.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/gnuradio-examples/python/tags/uhd_burst_detector.py b/gnuradio-examples/python/tags/uhd_burst_detector.py index 993c6807d..f8ebbe66a 100755 --- a/gnuradio-examples/python/tags/uhd_burst_detector.py +++ b/gnuradio-examples/python/tags/uhd_burst_detector.py @@ -10,7 +10,7 @@ from optparse import OptionParser class uhd_burst_detector(gr.top_block): def __init__(self, frequency, sample_rate, - uhd_address="192.168.10.2"): + uhd_address="192.168.10.2", trigger=False): gr.top_block.__init__(self) @@ -18,9 +18,10 @@ class uhd_burst_detector(gr.top_block): self.samp_rate = sample_rate self.uhd_addr = uhd_address self.gain = 32 + self.trigger = trigger self.uhd_src = uhd.single_usrp_source( - device_addr="addr="+self.uhd_addr, + device_addr=self.uhd_addr, io_type=uhd.io_type_t.COMPLEX_FLOAT32, num_channels=1, ) @@ -53,7 +54,7 @@ class uhd_burst_detector(gr.top_block): self.connect((self.uhd_src, 0), (self.tagger, 0)) self.connect((self.tagger, 0), (self.fsnk, 0)) - if 0: + if self.trigger: # Connect a dummy signaler to the burst tagger self.connect((self.signal, 0), (self.tagger, 1)) @@ -74,11 +75,24 @@ class uhd_burst_detector(gr.top_block): if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog: [options]") + parser.add_option("-a", "--address", type="string", default="addr=192.168.10.2", + help="select address of the device [default=%default]") + #parser.add_option("-A", "--antenna", default=None, + # help="select Rx Antenna (only on RFX-series boards)") + parser.add_option("-f", "--freq", type="eng_float", default=450e6, + help="set frequency to FREQ", metavar="FREQ") + parser.add_option("-g", "--gain", type="eng_float", default=0, + help="set gain in dB [default=%default]") + parser.add_option("-R", "--rate", type="eng_float", default=200000, + help="set USRP sample rate [default=%default]") + parser.add_option("-T", "--trigger", action="store_true", default=False, + help="Use internal trigger instead of detector [default=%default]") (options, args) = parser.parse_args() - frequency = 450e6 - samp_rate = samp_rate = 200000 - uhd_addr = "192.168.10.2" + frequency = options.freq + samp_rate = samp_rate = options.rate + uhd_addr = options.address + trigger = options.trigger - tb = uhd_burst_detector(frequency, samp_rate, uhd_addr) + tb = uhd_burst_detector(frequency, samp_rate, uhd_addr, trigger) tb.run() |