diff options
Diffstat (limited to 'gnuradio-examples/python/hier/usrp')
-rwxr-xr-x | gnuradio-examples/python/hier/usrp/usrp_fft.py | 6 | ||||
-rwxr-xr-x | gnuradio-examples/python/hier/usrp/usrp_siggen.py | 21 |
2 files changed, 5 insertions, 22 deletions
diff --git a/gnuradio-examples/python/hier/usrp/usrp_fft.py b/gnuradio-examples/python/hier/usrp/usrp_fft.py index 5cd5c1482..b31213004 100755 --- a/gnuradio-examples/python/hier/usrp/usrp_fft.py +++ b/gnuradio-examples/python/hier/usrp/usrp_fft.py @@ -74,7 +74,6 @@ class app_top_block(stdgui2.std_top_block): self.show_debug_info = True self.u = usrp.source_c(decim_rate=options.decim) - self.define_component("usrp", self.u) if options.rx_subdev_spec is None: options.rx_subdev_spec = pick_subdevice(self.u) self.u.set_mux(usrp.determine_rx_mux_value(self.u, options.rx_subdev_spec)) @@ -99,11 +98,8 @@ class app_top_block(stdgui2.std_top_block): self.scope = scopesink2.scope_sink_c(panel, sample_rate=input_rate) else: self.scope = fftsink2.fft_sink_c (panel, fft_size=1024, sample_rate=input_rate) - self.define_component("scope", self.scope) - # Ultimately this will be - # self.connect("usrp scope") - self.connect("usrp", 0, "scope", 0) + self.connect(self.u, self.scope) self._build_gui(vbox) diff --git a/gnuradio-examples/python/hier/usrp/usrp_siggen.py b/gnuradio-examples/python/hier/usrp/usrp_siggen.py index 28f80a822..f1eb2a6bc 100755 --- a/gnuradio-examples/python/hier/usrp/usrp_siggen.py +++ b/gnuradio-examples/python/hier/usrp/usrp_siggen.py @@ -7,15 +7,9 @@ from gnuradio import eng_notation from optparse import OptionParser import sys - -class my_graph(gr.hier_block2): +class my_graph(gr.top_block): def __init__ (self, type, ampl, wfreq, offset, subdev_spec, interp, rf_freq): - # Call hierarchical block constructor - # Top-level blocks have no inputs or outputs - gr.hier_block2.__init__(self, - "usrp_siggen", # Block type - gr.io_signature(0,0,0), # Input signature - gr.io_signature(0,0,0)) # Output signature + gr.top_block.__init__(self, "usrp_siggen") # controllable values self.interp = interp @@ -40,28 +34,21 @@ class my_graph(gr.hier_block2): sys.stderr.write('Failed to set RF frequency\n') raise SystemExit - self.define_component("usrp", self.u) - if type == gr.GR_SIN_WAVE or type == gr.GR_CONST_WAVE: self.src = gr.sig_source_c (self.usb_freq (), gr.GR_SIN_WAVE, self.waveform_freq, self.waveform_ampl, self.waveform_offset) - self.define_component("src", self.src) elif type == gr.GR_UNIFORM or type == gr.GR_GAUSSIAN: self.src = gr.noise_source_c (gr.GR_UNIFORM, self.waveform_ampl) - self.define_component("src", self.src) - + else: raise ValueError, type - # self.file_sink = gr.file_sink (gr.sizeof_gr_complex, "siggen.dat") - # self.define_component("file_sink", self.file_sink) - - self.connect ("src", 0, "usrp", 0) + self.connect (self.src, self.u) def usb_freq (self): |