diff options
Diffstat (limited to 'gr-uhd/examples/python/usrp_nbfm_ptt.py')
-rwxr-xr-x | gr-uhd/examples/python/usrp_nbfm_ptt.py | 69 |
1 files changed, 37 insertions, 32 deletions
diff --git a/gr-uhd/examples/python/usrp_nbfm_ptt.py b/gr-uhd/examples/python/usrp_nbfm_ptt.py index 791b8cb990..76e1f47c3c 100755 --- a/gr-uhd/examples/python/usrp_nbfm_ptt.py +++ b/gr-uhd/examples/python/usrp_nbfm_ptt.py @@ -25,7 +25,10 @@ import sys import wx from optparse import OptionParser -from gnuradio import gr, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import analog +from gnuradio import blocks +from gnuradio import filter from gnuradio.eng_option import eng_option from gnuradio.wxgui import stdgui2, fftsink2, scopesink2, slider, form @@ -300,32 +303,32 @@ class transmit_path(gr.hier_block2): self.normal_gain = 32000 self.audio = audio.source(int(self.audio_rate), audio_input) - self.audio_amp = gr.multiply_const_ff(self.audio_gain) + self.audio_amp = blocks.multiply_const_ff(self.audio_gain) - lpf = gr.firdes.low_pass (1, # gain - self.audio_rate, # sampling rate - 3800, # low pass cutoff freq - 300, # width of trans. band - gr.firdes.WIN_HANN) # filter type + lpf = filter.firdes.low_pass(1, # gain + self.audio_rate, # sampling rate + 3800, # low pass cutoff freq + 300, # width of trans. band + filter.firdes.WIN_HANN) # filter type - hpf = gr.firdes.high_pass (1, # gain - self.audio_rate, # sampling rate - 325, # low pass cutoff freq - 50, # width of trans. band - gr.firdes.WIN_HANN) # filter type + hpf = filter.firdes.high_pass(1, # gain + self.audio_rate, # sampling rate + 325, # low pass cutoff freq + 50, # width of trans. band + filter.firdes.WIN_HANN) # filter type audio_taps = convolve(array(lpf),array(hpf)) - self.audio_filt = gr.fir_filter_fff(1,audio_taps) + self.audio_filt = filter.fir_filter_fff(1,audio_taps) - self.pl = blks2.ctcss_gen_f(self.audio_rate,123.0) - self.add_pl = gr.add_ff() + self.pl = analog.ctcss_gen_f(self.audio_rate,123.0) + self.add_pl = blocks.add_ff() self.connect(self.pl,(self.add_pl,1)) - self.fmtx = blks2.nbfm_tx(self.audio_rate, self.if_rate) - self.amp = gr.multiply_const_cc (self.normal_gain) + self.fmtx = analog.nbfm_tx(self.audio_rate, self.if_rate) + self.amp = blocks.multiply_const_cc (self.normal_gain) rrate = dev_rate / self.if_rate - self.resamp = blks2.pfb_arb_resampler_ccf(rrate) + self.resamp = filter.pfb.arb_resampler_ccf(rrate) self.connect(self.audio, self.audio_amp, self.audio_filt, (self.add_pl,0), self.fmtx, self.amp, @@ -344,7 +347,8 @@ class transmit_path(gr.hier_block2): """ Set the center frequency we're interested in. - @param target_freq: frequency in Hz + Args: + target_freq: frequency in Hz @rypte: bool """ r = self.u.set_center_freq(target_freq) @@ -387,30 +391,30 @@ class receive_path(gr.hier_block2): # Create filter to get actual channel we want nfilts = 32 - chan_coeffs = gr.firdes.low_pass (nfilts, # gain - nfilts*dev_rate, # sampling rate - 13e3, # low pass cutoff freq - 4e3, # width of trans. band - gr.firdes.WIN_HANN) # filter type + chan_coeffs = filter.firdes.low_pass(nfilts, # gain + nfilts*dev_rate, # sampling rate + 13e3, # low pass cutoff freq + 4e3, # width of trans. band + filter.firdes.WIN_HANN) # filter type rrate = self.quad_rate / dev_rate - self.resamp = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) + self.resamp = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) # instantiate the guts of the single channel receiver - self.fmrx = blks2.nbfm_rx(self.audio_rate, self.quad_rate) + self.fmrx = analog.nbfm_rx(self.audio_rate, self.quad_rate) # standard squelch block - self.squelch = blks2.standard_squelch(self.audio_rate) + self.squelch = analog.standard_squelch(self.audio_rate) # audio gain / mute block - self._audio_gain = gr.multiply_const_ff(1.0) + self._audio_gain = blocks.multiply_const_ff(1.0) # sound card as final sink - audio_sink = audio.sink (int(self.audio_rate), audio_output) + audio_sink = audio.sink(int(self.audio_rate), audio_output) # now wire it all together - self.connect (self.u, self.resamp, self.fmrx, self.squelch, - self._audio_gain, audio_sink) + self.connect(self.u, self.resamp, self.fmrx, self.squelch, + self._audio_gain, audio_sink) if gain is None: # if no gain was specified, use the mid-point in dB @@ -464,7 +468,8 @@ class receive_path(gr.hier_block2): """ Set the center frequency we're interested in. - @param target_freq: frequency in Hz + Args: + target_freq: frequency in Hz @rypte: bool """ r = self.u.set_center_freq(target_freq) |