diff options
author | jblum | 2009-02-01 19:26:56 +0000 |
---|---|---|
committer | jblum | 2009-02-01 19:26:56 +0000 |
commit | 09f236be864aaa3b5216eb42676eafb38d47b587 (patch) | |
tree | 101aa35dabe48fd970566783ef4505aae3111f7b /grc/src | |
parent | 80fb5db88469ed5c80246846a2086338af7caea4 (diff) | |
download | gnuradio-09f236be864aaa3b5216eb42676eafb38d47b587.tar.gz gnuradio-09f236be864aaa3b5216eb42676eafb38d47b587.tar.bz2 gnuradio-09f236be864aaa3b5216eb42676eafb38d47b587.zip |
options for hb filter in usrp simple source
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10369 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'grc/src')
-rw-r--r-- | grc/src/grc_gnuradio/usrp/common.py | 6 | ||||
-rw-r--r-- | grc/src/grc_gnuradio/usrp/dual_usrp.py | 20 | ||||
-rw-r--r-- | grc/src/grc_gnuradio/usrp/simple_usrp.py | 24 |
3 files changed, 28 insertions, 22 deletions
diff --git a/grc/src/grc_gnuradio/usrp/common.py b/grc/src/grc_gnuradio/usrp/common.py index 423e35816..33eda351c 100644 --- a/grc/src/grc_gnuradio/usrp/common.py +++ b/grc/src/grc_gnuradio/usrp/common.py @@ -28,14 +28,14 @@ class usrp_helper(object): def _make_usrp(self, *args, **kwargs): self._u = self._usrp_args[0](*args, **kwargs) def _get_u(self): return self._u def _get_io_size(self): return self._usrp_args[1] - def _set_frequency(self, which, subdev, frequency, verbose=False): + def _set_frequency(self, chan, subdev, frequency, verbose=False): """ Set the carrier frequency for the given subdevice. - @param which specifies the DDC/DUC number + @param chan specifies the DDC/DUC number @param frequency the carrier frequency in Hz @param verbose if true, print usrp tuning information """ - r = self._get_u().tune(which, subdev, frequency) + r = self._get_u().tune(chan, subdev, frequency) if not verbose: return print subdev.side_and_name() if r: diff --git a/grc/src/grc_gnuradio/usrp/dual_usrp.py b/grc/src/grc_gnuradio/usrp/dual_usrp.py index fac3ab74b..f95497cda 100644 --- a/grc/src/grc_gnuradio/usrp/dual_usrp.py +++ b/grc/src/grc_gnuradio/usrp/dual_usrp.py @@ -27,10 +27,10 @@ from gnuradio import gr, usrp class _dual_source(gr.hier_block2): """A dual usrp source of IO type short or complex.""" - def __init__(self, number, side_a='A', rx_ant_a='RXA', side_b='B', rx_ant_b='RXA'): + def __init__(self, which, side_a='A', rx_ant_a='RXA', side_b='B', rx_ant_b='RXA'): """ USRP dual source contructor. - @param number the unit number + @param which the unit number @param side_a A or B @param rx_ant_a the antenna choice @param side_b A or B @@ -43,7 +43,7 @@ class _dual_source(gr.hier_block2): gr.io_signature(2, 2, self._get_io_size()), ) #create usrp object - self._make_usrp(number, nchan=2) + self._make_usrp(which=which, nchan=2) #get the mux for output A subdev_spec_a = common.to_spec(side_a, rx_ant_a) self._subdev_a = usrp.selected_subdev(self._get_u(), subdev_spec_a) @@ -62,14 +62,14 @@ class _dual_source(gr.hier_block2): def set_decim_rate(self, decim): self._get_u().set_decim_rate(int(decim)) def set_frequency_a(self, frequency, verbose=False): self._set_frequency( - which=0, #ddc0 + chan=0, #ddc0 subdev=self._subdev_a, frequency=frequency, verbose=verbose, ) def set_frequency_b(self, frequency, verbose=False): self._set_frequency( - which=1, #ddc1 + chan=1, #ddc1 subdev=self._subdev_b, frequency=frequency, verbose=verbose, @@ -88,10 +88,10 @@ class dual_source_s(_dual_source, common.usrp_source_s): pass class _dual_sink(gr.hier_block2): """A dual usrp sink of IO type short or complex.""" - def __init__(self, number): + def __init__(self, which): """ USRP simple sink contructor. - @param number the unit number + @param which the unit number """ #initialize hier2 block gr.hier_block2.__init__( @@ -100,7 +100,7 @@ class _dual_sink(gr.hier_block2): gr.io_signature(0, 0, 0), ) #create usrp object - self._make_usrp(number, nchan=2) + self._make_usrp(which=which, nchan=2) #get the mux for side A subdev_spec_a = common.to_spec('A') self._subdev_a = usrp.selected_subdev(self._get_u(), subdev_spec_a) @@ -119,14 +119,14 @@ class _dual_sink(gr.hier_block2): def set_interp_rate(self, interp): self._get_u().set_interp_rate(int(interp)) def set_frequency_a(self, frequency, verbose=False): self._set_frequency( - which=self._subdev_a.which(), + chan=self._subdev_a.which(), subdev=self._subdev_a, frequency=frequency, verbose=verbose, ) def set_frequency_b(self, frequency, verbose=False): self._set_frequency( - which=self._subdev_b.which(), + chan=self._subdev_b.which(), subdev=self._subdev_b, frequency=frequency, verbose=verbose, diff --git a/grc/src/grc_gnuradio/usrp/simple_usrp.py b/grc/src/grc_gnuradio/usrp/simple_usrp.py index 1a2cf8f44..cc1938a07 100644 --- a/grc/src/grc_gnuradio/usrp/simple_usrp.py +++ b/grc/src/grc_gnuradio/usrp/simple_usrp.py @@ -27,13 +27,15 @@ from gnuradio import gr, usrp class _simple_source(gr.hier_block2): """A single usrp source of IO type short or complex.""" - def __init__(self, number, side='A', rx_ant='RXA'): + def __init__(self, which, side='A', rx_ant='RXA', no_hb=False): """ USRP simple source contructor. - @param number the unit number + @param which the unit number @param side the usrp side A or B @param rx_ant the antenna choice + @param no_hb disable half band filters """ + self._no_hb = no_hb #initialize hier2 block gr.hier_block2.__init__( self, 'usrp_simple_source', @@ -41,7 +43,8 @@ class _simple_source(gr.hier_block2): gr.io_signature(1, 1, self._get_io_size()), ) #create usrp object - self._make_usrp(number, nchan=1) + if self._no_hb: self._make_usrp(which=which, nchan=1, fpga_filename="std_4rx_0tx.rbf") + else: self._make_usrp(which=which, nchan=1) subdev_spec = common.to_spec(side, rx_ant) self._get_u().set_mux(usrp.determine_rx_mux_value(self._get_u(), subdev_spec)) self._subdev = usrp.selected_subdev(self._get_u(), subdev_spec) @@ -49,10 +52,13 @@ class _simple_source(gr.hier_block2): #connect self.connect(self._get_u(), self) - def set_decim_rate(self, decim): self._get_u().set_decim_rate(int(decim)) + def set_decim_rate(self, decim): + self._get_u().set_decim_rate(int(decim)) + if self._no_hb: #set the BW to half the sample rate + self._subdev.set_bw(self._get_u().converter_rate()/decim/2) def set_frequency(self, frequency, verbose=False): self._set_frequency( - which=0, #ddc0 + chan=0, #ddc0 subdev=self._subdev, frequency=frequency, verbose=verbose, @@ -69,10 +75,10 @@ class simple_source_s(_simple_source, common.usrp_source_s): pass class _simple_sink(gr.hier_block2): """A single usrp sink of IO type short or complex.""" - def __init__(self, number, side='A'): + def __init__(self, which, side='A'): """ USRP simple sink contructor. - @param number the unit number + @param which the unit number @param side the usrp side A or B """ #initialize hier2 block @@ -82,7 +88,7 @@ class _simple_sink(gr.hier_block2): gr.io_signature(0, 0, 0), ) #create usrp object - self._make_usrp(number, nchan=1) + self._make_usrp(which=which, nchan=1) subdev_spec = common.to_spec(side) self._get_u().set_mux(usrp.determine_tx_mux_value(self._get_u(), subdev_spec)) self._subdev = usrp.selected_subdev(self._get_u(), subdev_spec) @@ -92,7 +98,7 @@ class _simple_sink(gr.hier_block2): def set_interp_rate(self, interp): self._get_u().set_interp_rate(int(interp)) def set_frequency(self, frequency, verbose=False): self._set_frequency( - which=self._subdev.which(), + chan=self._subdev.which(), subdev=self._subdev, frequency=frequency, verbose=verbose, |