[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8818 - in grc/trunk: scripts src/grc_gnuradio/blocks/
From: |
jblum |
Subject: |
[Commit-gnuradio] r8818 - in grc/trunk: scripts src/grc_gnuradio/blocks/usrp src/grc_gnuradio/usrp src/grc_gnuradio/wxgui |
Date: |
Mon, 7 Jul 2008 15:39:03 -0600 (MDT) |
Author: jblum
Date: 2008-07-07 15:39:02 -0600 (Mon, 07 Jul 2008)
New Revision: 8818
Modified:
grc/trunk/scripts/grc
grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_dual_sink_x.xml
grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_dual_source_x.xml
grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_simple_sink_x.xml
grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_simple_source_x.xml
grc/trunk/src/grc_gnuradio/usrp/simple_usrp.py
grc/trunk/src/grc_gnuradio/wxgui/top_block_gui.py
Log:
usrp with set decim/interp callback
Modified: grc/trunk/scripts/grc
===================================================================
--- grc/trunk/scripts/grc 2008-07-07 21:34:56 UTC (rev 8817)
+++ grc/trunk/scripts/grc 2008-07-07 21:39:02 UTC (rev 8818)
@@ -25,7 +25,7 @@
from optparse import OptionParser
if __name__ == "__main__":
- usage = 'usage: %prog
[optional_flow_graphs'+FLOW_GRAPH_FILE_EXTENSION+']'
+ usage = 'usage: %%prog
[optional_flow_graphs%s]'%FLOW_GRAPH_FILE_EXTENSION
version = """
GNU Radio Companion %s
Modified: grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_dual_sink_x.xml
===================================================================
--- grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_dual_sink_x.xml 2008-07-07
21:34:56 UTC (rev 8817)
+++ grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_dual_sink_x.xml 2008-07-07
21:39:02 UTC (rev 8818)
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE block SYSTEM "../block.dtd">
-<!--
+<!--
###################################################
##USRP Dual Sink
###################################################
@@ -11,16 +11,17 @@
<import>from grc_gnuradio import usrp as grc_usrp</import>
<make>grc_usrp.dual_sink_$(type.fcn)(
number=$number,
- frequency_a=$frequency_a,
- frequency_b=$frequency_b,
- interpolation=$interpolation,
+ frequency_a=$frequency_a,
+ frequency_b=$frequency_b,
+ interpolation=$interpolation,
gain_a=$gain_a,
gain_b=$gain_b,
- mux=$mux,
- auto_tr=$auto_tr,
+ mux=$mux,
+ auto_tr=$auto_tr,
tx_enb_a=$tx_enb_a,
tx_enb_b=$tx_enb_b,
)</make>
+ <callback>set_interp_rate($interpolation)</callback>
<callback>set_frequency_a($frequency_a)</callback>
<callback>set_gain_a($gain_a)</callback>
<callback>set_frequency_b($frequency_b)</callback>
@@ -32,50 +33,50 @@
<option>
<name>Complex</name>
<key>complex</key>
- <opt>fcn:c</opt>
+ <opt>fcn:c</opt>
</option>
<option>
<name>Short</name>
<key>short</key>
- <opt>fcn:s</opt>
+ <opt>fcn:s</opt>
</option>
- </param>
+ </param>
<param>
<name>Unit Number</name>
<key>number</key>
<value>0</value>
- <type>int</type>
+ <type>int</type>
</param>
<param>
<name>Frequency A</name>
<key>frequency_a</key>
- <type>real</type>
+ <type>real</type>
</param>
<param>
<name>Frequency B</name>
<key>frequency_b</key>
- <type>real</type>
+ <type>real</type>
</param>
<param>
<name>Interpolation</name>
<key>interpolation</key>
- <type>int</type>
+ <type>int</type>
</param>
<param>
<name>Gain A</name>
<key>gain_a</key>
- <type>real</type>
+ <type>real</type>
</param>
<param>
<name>Gain B</name>
<key>gain_b</key>
- <type>real</type>
+ <type>real</type>
</param>
<param>
<name>Mux</name>
<key>mux</key>
<value>0xba98</value>
- <type>hex</type>
+ <type>hex</type>
</param>
<param>
<name>Auto T/R</name>
@@ -84,15 +85,15 @@
<type>enum</type>
<option>
<name>Ignore</name>
- <key>None</key>
+ <key>None</key>
</option>
<option>
<name>Enable</name>
- <key>True</key>
+ <key>True</key>
</option>
<option>
<name>Disable</name>
- <key>False</key>
+ <key>False</key>
</option>
</param>
<param>
@@ -102,15 +103,15 @@
<type>enum</type>
<option>
<name>Ignore</name>
- <key>None</key>
+ <key>None</key>
</option>
<option>
<name>Enable</name>
- <key>True</key>
+ <key>True</key>
</option>
<option>
<name>Disable</name>
- <key>False</key>
+ <key>False</key>
</option>
</param>
<param>
@@ -120,15 +121,15 @@
<type>enum</type>
<option>
<name>Ignore</name>
- <key>None</key>
+ <key>None</key>
</option>
<option>
<name>Enable</name>
- <key>True</key>
+ <key>True</key>
</option>
<option>
<name>Disable</name>
- <key>False</key>
+ <key>False</key>
</option>
</param>
<sink>
@@ -149,6 +150,6 @@
By default, "Auto TR" is disabled.
The "Transmit Enable" configures the transmitter to be on or off. \
-Do not leave this unconfigured.
+Do not leave this unconfigured.
</doc>
</block>
Modified: grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_dual_source_x.xml
===================================================================
--- grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_dual_source_x.xml
2008-07-07 21:34:56 UTC (rev 8817)
+++ grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_dual_source_x.xml
2008-07-07 21:39:02 UTC (rev 8818)
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE block SYSTEM "../block.dtd">
-<!--
+<!--
###################################################
##USRP Dual Source
###################################################
@@ -11,16 +11,17 @@
<import>from grc_gnuradio import usrp as grc_usrp</import>
<make>grc_usrp.dual_source_$(type.fcn)(
number=$number,
- frequency_a=$frequency_a,
+ frequency_a=$frequency_a,
frequency_b=$frequency_b,
- decimation=$decimation,
+ decimation=$decimation,
gain_a=$gain_a,
gain_b=$gain_b,
- mux=$mux,
- auto_tr=$auto_tr,
+ mux=$mux,
+ auto_tr=$auto_tr,
rx_ant_a=$rx_ant_a,
rx_ant_b=$rx_ant_b,
)</make>
+ <callback>set_decim_rate($decimation)</callback>
<callback>set_frequency_a($frequency_a)</callback>
<callback>set_gain_a($gain_a)</callback>
<callback>set_frequency_b($frequency_b)</callback>
@@ -32,50 +33,50 @@
<option>
<name>Complex</name>
<key>complex</key>
- <opt>fcn:c</opt>
+ <opt>fcn:c</opt>
</option>
<option>
<name>Short</name>
<key>short</key>
- <opt>fcn:s</opt>
+ <opt>fcn:s</opt>
</option>
- </param>
+ </param>
<param>
<name>Unit Number</name>
<key>number</key>
<value>0</value>
- <type>int</type>
+ <type>int</type>
</param>
<param>
<name>Frequency A</name>
<key>frequency_a</key>
- <type>real</type>
+ <type>real</type>
</param>
<param>
<name>Frequency B</name>
<key>frequency_b</key>
- <type>real</type>
+ <type>real</type>
</param>
<param>
<name>Decimation</name>
<key>decimation</key>
- <type>int</type>
+ <type>int</type>
</param>
<param>
<name>Gain A</name>
<key>gain_a</key>
- <type>real</type>
+ <type>real</type>
</param>
<param>
<name>Gain B</name>
<key>gain_b</key>
- <type>real</type>
+ <type>real</type>
</param>
<param>
<name>Mux</name>
<key>mux</key>
<value>0x3210</value>
- <type>hex</type>
+ <type>hex</type>
</param>
<param>
<name>Auto T/R</name>
@@ -84,15 +85,15 @@
<type>enum</type>
<option>
<name>Ignore</name>
- <key>None</key>
+ <key>None</key>
</option>
<option>
<name>Enable</name>
- <key>True</key>
+ <key>True</key>
</option>
<option>
<name>Disable</name>
- <key>False</key>
+ <key>False</key>
</option>
</param>
<param>
@@ -102,15 +103,15 @@
<type>enum</type>
<option>
<name>Ignore</name>
- <key>None</key>
+ <key>None</key>
</option>
<option>
<name>TX/RX</name>
- <key>"TX/RX"</key>
+ <key>"TX/RX"</key>
</option>
<option>
<name>RX2</name>
- <key>"RX2"</key>
+ <key>"RX2"</key>
</option>
</param>
<param>
@@ -120,15 +121,15 @@
<type>enum</type>
<option>
<name>Ignore</name>
- <key>None</key>
+ <key>None</key>
</option>
<option>
<name>TX/RX</name>
- <key>"TX/RX"</key>
+ <key>"TX/RX"</key>
</option>
<option>
<name>RX2</name>
- <key>"RX2"</key>
+ <key>"RX2"</key>
</option>
</param>
<source>
@@ -149,6 +150,6 @@
By default, "Auto TR" is disabled.
The "Receive Antenna Setting" selects one of the SMA connectors as the data
source. \
-By default, 'TX/RX' is selected.
+By default, 'TX/RX' is selected.
</doc>
</block>
Modified: grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_simple_sink_x.xml
===================================================================
--- grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_simple_sink_x.xml
2008-07-07 21:34:56 UTC (rev 8817)
+++ grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_simple_sink_x.xml
2008-07-07 21:39:02 UTC (rev 8818)
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE block SYSTEM "../block.dtd">
-<!--
+<!--
###################################################
##USRP Simple Sink
###################################################
@@ -11,18 +11,19 @@
<import>from grc_gnuradio import usrp as grc_usrp</import>
<make>grc_usrp.simple_sink_$(type.fcn)(
number=$number,
- subdev_spec=$subdev_spec,
- frequency=$frequency,
- interpolation=$interpolation,
+ subdev_spec=$subdev_spec,
+ frequency=$frequency,
+ interpolation=$interpolation,
gain=$gain,
#if $mux.eval == hex(0)
mux=None,
-#else
- mux=$mux,
+#else
+ mux=$mux,
#end if
- auto_tr=$auto_tr,
+ auto_tr=$auto_tr,
tx_enb=$tx_enb,
)</make>
+ <callback>set_interp_rate($interpolation)</callback>
<callback>set_frequency($frequency)</callback>
<callback>set_gain($gain)</callback>
<param>
@@ -32,19 +33,19 @@
<option>
<name>Complex</name>
<key>complex</key>
- <opt>fcn:c</opt>
+ <opt>fcn:c</opt>
</option>
<option>
<name>Short</name>
<key>short</key>
- <opt>fcn:s</opt>
+ <opt>fcn:s</opt>
</option>
- </param>
+ </param>
<param>
<name>Unit Number</name>
<key>number</key>
<value>0</value>
- <type>int</type>
+ <type>int</type>
</param>
<param>
<name>Subdev Spec</name>
@@ -53,37 +54,37 @@
<type>enum</type>
<option>
<name>Auto</name>
- <key>None</key>
+ <key>None</key>
</option>
<option>
<name>Side A</name>
- <key>(0, 0)</key>
+ <key>(0, 0)</key>
</option>
<option>
<name>Side B</name>
- <key>(1, 0)</key>
+ <key>(1, 0)</key>
</option>
</param>
<param>
<name>Frequency</name>
<key>frequency</key>
- <type>real</type>
+ <type>real</type>
</param>
<param>
<name>Interpolation</name>
<key>interpolation</key>
- <type>int</type>
+ <type>int</type>
</param>
<param>
<name>Gain</name>
<key>gain</key>
- <type>real</type>
+ <type>real</type>
</param>
<param>
<name>Mux</name>
<key>mux</key>
<value>0x0</value>
- <type>hex</type>
+ <type>hex</type>
</param>
<param>
<name>Auto T/R</name>
@@ -92,15 +93,15 @@
<type>enum</type>
<option>
<name>Ignore</name>
- <key>None</key>
+ <key>None</key>
</option>
<option>
<name>Enable</name>
- <key>True</key>
+ <key>True</key>
</option>
<option>
<name>Disable</name>
- <key>False</key>
+ <key>False</key>
</option>
</param>
<param>
@@ -110,15 +111,15 @@
<type>enum</type>
<option>
<name>Ignore</name>
- <key>None</key>
+ <key>None</key>
</option>
<option>
<name>Enable</name>
- <key>True</key>
+ <key>True</key>
</option>
<option>
<name>Disable</name>
- <key>False</key>
+ <key>False</key>
</option>
</param>
<sink>
@@ -135,6 +136,6 @@
By default, "Auto TR" is disabled.
The "Transmit Enable" configures the transmitter to be on or off. \
-Do not leave this unconfigured.
+Do not leave this unconfigured.
</doc>
</block>
Modified: grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_simple_source_x.xml
===================================================================
--- grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_simple_source_x.xml
2008-07-07 21:34:56 UTC (rev 8817)
+++ grc/trunk/src/grc_gnuradio/blocks/usrp/usrp_simple_source_x.xml
2008-07-07 21:39:02 UTC (rev 8818)
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE block SYSTEM "../block.dtd">
-<!--
+<!--
###################################################
##USRP Simple Source
###################################################
@@ -11,18 +11,19 @@
<import>from grc_gnuradio import usrp as grc_usrp</import>
<make>grc_usrp.simple_source_$(type.fcn)(
number=$number,
- subdev_spec=$subdev_spec,
- frequency=$frequency,
- decimation=$decimation,
+ subdev_spec=$subdev_spec,
+ frequency=$frequency,
+ decimation=$decimation,
gain=$gain,
#if $mux.eval == hex(0)
mux=None,
-#else
- mux=$mux,
+#else
+ mux=$mux,
#end if
- auto_tr=$auto_tr,
+ auto_tr=$auto_tr,
rx_ant=$rx_ant,
)</make>
+ <callback>set_decim_rate($decimation)</callback>
<callback>set_frequency($frequency)</callback>
<callback>set_gain($gain)</callback>
<param>
@@ -32,19 +33,19 @@
<option>
<name>Complex</name>
<key>complex</key>
- <opt>fcn:c</opt>
+ <opt>fcn:c</opt>
</option>
<option>
<name>Short</name>
<key>short</key>
- <opt>fcn:s</opt>
+ <opt>fcn:s</opt>
</option>
- </param>
+ </param>
<param>
<name>Unit Number</name>
<key>number</key>
<value>0</value>
- <type>int</type>
+ <type>int</type>
</param>
<param>
<name>Subdev Spec</name>
@@ -53,45 +54,45 @@
<type>enum</type>
<option>
<name>Auto</name>
- <key>None</key>
+ <key>None</key>
</option>
<option>
<name>Side A:0</name>
- <key>(0, 0)</key>
+ <key>(0, 0)</key>
</option>
<option>
<name>Side B:0</name>
- <key>(1, 0)</key>
+ <key>(1, 0)</key>
</option>
<option>
<name>Side A:1</name>
- <key>(0, 1)</key>
+ <key>(0, 1)</key>
</option>
<option>
<name>Side B:1</name>
- <key>(1, 1)</key>
+ <key>(1, 1)</key>
</option>
</param>
<param>
<name>Frequency</name>
<key>frequency</key>
- <type>real</type>
+ <type>real</type>
</param>
<param>
<name>Decimation</name>
<key>decimation</key>
- <type>int</type>
+ <type>int</type>
</param>
<param>
<name>Gain</name>
<key>gain</key>
- <type>real</type>
+ <type>real</type>
</param>
<param>
<name>Mux</name>
<key>mux</key>
<value>0x0</value>
- <type>hex</type>
+ <type>hex</type>
</param>
<param>
<name>Auto T/R</name>
@@ -100,15 +101,15 @@
<type>enum</type>
<option>
<name>Ignore</name>
- <key>None</key>
+ <key>None</key>
</option>
<option>
<name>Enable</name>
- <key>True</key>
+ <key>True</key>
</option>
<option>
<name>Disable</name>
- <key>False</key>
+ <key>False</key>
</option>
</param>
<param>
@@ -118,15 +119,15 @@
<type>enum</type>
<option>
<name>Ignore</name>
- <key>None</key>
+ <key>None</key>
</option>
<option>
<name>TX/RX</name>
- <key>"TX/RX"</key>
+ <key>"TX/RX"</key>
</option>
<option>
<name>RX2</name>
- <key>"RX2"</key>
+ <key>"RX2"</key>
</option>
</param>
<source>
@@ -143,6 +144,6 @@
By default, "Auto TR" is disabled.
The "Receive Antenna Setting" selects one of the SMA connectors as the data
source. \
-By default, 'TX/RX' is selected.
+By default, 'TX/RX' is selected.
</doc>
</block>
Modified: grc/trunk/src/grc_gnuradio/usrp/simple_usrp.py
===================================================================
--- grc/trunk/src/grc_gnuradio/usrp/simple_usrp.py 2008-07-07 21:34:56 UTC
(rev 8817)
+++ grc/trunk/src/grc_gnuradio/usrp/simple_usrp.py 2008-07-07 21:39:02 UTC
(rev 8818)
@@ -1,22 +1,22 @@
# Copyright 2008 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
-#
+#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
import sys
from gnuradio import usrp, gr
@@ -27,7 +27,7 @@
def _set_frequency(u, which, subdev, frequency, verbose=False):
"""!
- Set the carrier frequency for the given subdevice.
+ Set the carrier frequency for the given subdevice.
@param u the usrp source/sink
@param which specifies the DDC/DUC number
@param frequency the carrier frequency in Hz
@@ -42,12 +42,12 @@
print " r.residual_frequency =", r.residual_freq
print " r.inverted =", r.inverted
else: print >> sys.stderr, 'Error calling tune on subdevice.'
-
+
def _setup_rx_subdev(u, subdev_spec, ddc, gain, frequency, auto_tr=None,
rx_ant=None):
"""!
Setup a usrp receive subdevice by setting gain and frequency.
Add the gain and frequency callbacks to the flow graph.
- FlexRF: Handle auto transmit/receive and set the receive antenna.
+ FlexRF: Handle auto transmit/receive and set the receive antenna.
@param u the usrp object
@param subdev_spec the sub-device specification
@param ddc which ddc to use: 0 or 1
@@ -58,7 +58,7 @@
@return the subdevice
"""
subdev = usrp.selected_subdev(u, subdev_spec)#get the subdev
- subdev.set_gain(gain)
+ subdev.set_gain(gain)
_set_frequency(u, ddc, subdev, frequency, verbose=True)
if auto_tr is not None: subdev.set_auto_tr(auto_tr)
if rx_ant is not None: subdev.select_rx_antenna(rx_ant)
@@ -68,7 +68,7 @@
"""!
Setup a usrp receive subdevice by setting gain and frequency.
Add the gain and frequency callbacks to the flow graph.
- FlexRF: Handle auto transmit/receive and enable the transmitter.
+ FlexRF: Handle auto transmit/receive and enable the transmitter.
@param u the usrp object
@param subdev_spec the sub-device specification
@param gain the gain to set
@@ -78,7 +78,7 @@
@return the subdevice
"""
subdev = usrp.selected_subdev(u, subdev_spec)#get the subdev
- subdev.set_gain(gain)
+ subdev.set_gain(gain)
_set_frequency(u, subdev._which, subdev, frequency, verbose=True)
if auto_tr is not None: subdev.set_auto_tr(auto_tr)
if tx_enb is not None: subdev.set_enable(tx_enb)
@@ -100,7 +100,7 @@
class _simple_usrp(object):
"""A single usrp source/sink base class."""
-
+
def __init__(self, u, subdev, which):
"""!
Create a simple usrp base class.
@@ -111,41 +111,41 @@
self._u = u
self._subdev = subdev
self._which = which
-
+
def get_u(self):
"""!
Get the underlying usrp object.
@return the usrp source/sink object.
"""
return self._u
-
+
def get_subdev(self):
"""!
Get the underlying subdevice.
@return the subdev object.
"""
return self._subdev
-
+
def set_frequency(self, frequency):
"""!
Set the frequency of the subdevice.
@param frequency the frequency to tune
"""
_set_frequency(self.get_u(), self._which, self.get_subdev(),
frequency)
-
+
def set_gain(self, gain):
"""!
Set the gain of the subdevice.
@param gain the gain to set
"""
self.get_subdev().set_gain(gain)
-
+
####################################################################
# Simple USRP Source
####################################################################
class _simple_source(gr.hier_block2, _simple_usrp):
"""A single usrp source of IO type short or complex."""
-
+
def __init__(self, number, subdev_spec, frequency, decimation, gain,
mux=None, auto_tr=None, rx_ant=None):
"""!
USRP simple source contructor.
@@ -160,8 +160,8 @@
"""
#initialize hier2 block
gr.hier_block2.__init__(
- self, 'usrp_simple_source',
- gr.io_signature(0, 0, 0),
+ self, 'usrp_simple_source',
+ gr.io_signature(0, 0, 0),
gr.io_signature(1, 1,
constructor_to_size[self.constructor]),
)
#create usrp object
@@ -169,12 +169,14 @@
if subdev_spec is None: subdev_spec = usrp.pick_rx_subdevice(u)
u.set_decim_rate(decimation)
if mux is None: mux = usrp.determine_rx_mux_value(u,
subdev_spec)
- u.set_mux(mux)
+ u.set_mux(mux)
subdev = _setup_rx_subdev(u, subdev_spec, 0, gain, frequency,
auto_tr, rx_ant)
- _simple_usrp.__init__(self, u, subdev, 0)
+ _simple_usrp.__init__(self, u, subdev, 0)
#connect
self.connect(u, self)
-
+
+ def set_decim_rate(self, decim): self.get_u().set_decim_rate(int(decim))
+
class simple_source_c(_simple_source): constructor = usrp.source_c
class simple_source_s(_simple_source): constructor = usrp.source_s
@@ -183,7 +185,7 @@
####################################################################
class _simple_sink(gr.hier_block2, _simple_usrp):
"""A single usrp sink of IO type short or complex."""
-
+
def __init__(self, number, subdev_spec, frequency, interpolation, gain,
mux=None, auto_tr=None, tx_enb=None):
"""!
USRP simple sink contructor.
@@ -198,33 +200,35 @@
"""
#initialize hier2 block
gr.hier_block2.__init__(
- self, 'usrp_simple_sink',
+ self, 'usrp_simple_sink',
gr.io_signature(1, 1,
constructor_to_size[self.constructor]),
- gr.io_signature(0, 0, 0),
+ gr.io_signature(0, 0, 0),
)
#create usrp object
u = self.constructor(number, nchan=1)
if subdev_spec is None: subdev_spec = usrp.pick_tx_subdevice(u)
u.set_interp_rate(interpolation)
if mux is None: mux = usrp.determine_tx_mux_value(u,
subdev_spec)
- u.set_mux(mux)
+ u.set_mux(mux)
subdev = _setup_tx_subdev(u, subdev_spec, gain, frequency,
auto_tr, tx_enb)
- _simple_usrp.__init__(self, u, subdev, subdev._which)
+ _simple_usrp.__init__(self, u, subdev, subdev._which)
#connect
self.connect(self, u)
+ def set_interp_rate(self, interp):
self.get_u().set_interp_rate(int(interp))
+
class simple_sink_c(_simple_sink): constructor = usrp.sink_c
class simple_sink_s(_simple_sink): constructor = usrp.sink_s
-####################################################################
####################################################################
+####################################################################
# Dual USRP Base Classes
####################################################################
####################################################################
class _dual_usrp(object):
"""A dual usrp source/sink base class."""
-
+
def __init__(self, u, subdev_a, subdev_b, which_a, which_b):
"""!
Create a dual usrp base class.
@@ -239,62 +243,62 @@
self._subdev_b = subdev_b
self._which_a = which_a
self._which_b = which_b
-
+
def get_u(self):
"""!
Get the underlying usrp object.
@return the usrp source/sink object.
"""
return self._u
-
+
def get_subdev_a(self):
"""!
Get the underlying subdevice.
@return the subdev object.
"""
return self._subdev_a
-
+
def get_subdev_b(self):
"""!
Get the underlying subdevice.
@return the subdev object.
"""
return self._subdev_b
-
+
def set_frequency_a(self, frequency):
"""!
Set the frequency of the subdevice.
@param frequency the frequency to tune
"""
_set_frequency(self.get_u(), self._which_a,
self.get_subdev_a(), frequency)
-
+
def set_frequency_b(self, frequency):
"""!
Set the frequency of the subdevice.
@param frequency the frequency to tune
"""
_set_frequency(self.get_u(), self._which_b,
self.get_subdev_b(), frequency)
-
+
def set_gain_a(self, gain):
"""!
Set the gain of the subdevice.
@param gain the gain to set
"""
- self.get_subdev_a().set_gain(gain)
-
+ self.get_subdev_a().set_gain(gain)
+
def set_gain_b(self, gain):
"""!
Set the gain of the subdevice.
@param gain the gain to set
"""
- self.get_subdev_b().set_gain(gain)
+ self.get_subdev_b().set_gain(gain)
####################################################################
# Dual USRP Source
####################################################################
class _dual_source(gr.hier_block2, _dual_usrp):
"""A dual usrp source of IO type short or complex."""
-
+
def __init__(self, number, frequency_a, frequency_b, decimation,
gain_a, gain_b, mux=0x3210, auto_tr=None, rx_ant_a=None, rx_ant_b=None):
"""!
USRP dual source contructor.
@@ -311,22 +315,24 @@
"""
#initialize hier2 block
gr.hier_block2.__init__(
- self, 'usrp_dual_source',
- gr.io_signature(0, 0, 0),
+ self, 'usrp_dual_source',
+ gr.io_signature(0, 0, 0),
gr.io_signature(2, 2,
constructor_to_size[self.constructor]),
)
#create usrp object
u = self.constructor(number, nchan=2)
u.set_decim_rate(decimation)
- u.set_mux(mux)
- subdev_a = _setup_rx_subdev(u, (0, 0), 0, gain_a, frequency_a,
auto_tr, rx_ant_a)
- subdev_b = _setup_rx_subdev(u, (1, 0), 1, gain_b, frequency_b,
auto_tr, rx_ant_b)
+ u.set_mux(mux)
+ subdev_a = _setup_rx_subdev(u, (0, 0), 0, gain_a, frequency_a,
auto_tr, rx_ant_a)
+ subdev_b = _setup_rx_subdev(u, (1, 0), 1, gain_b, frequency_b,
auto_tr, rx_ant_b)
_dual_usrp.__init__(self, u, subdev_a, subdev_b, 0, 1)
#connect
deinter = gr.deinterleave(constructor_to_size[self.constructor])
self.connect(u, deinter)
for i in range(2): self.connect((deinter, i), (self, i))
+ def set_decim_rate(self, decim): self.get_u().set_decim_rate(int(decim))
+
class dual_source_c(_dual_source): constructor = usrp.source_c
class dual_source_s(_dual_source): constructor = usrp.source_s
@@ -335,7 +341,7 @@
####################################################################
class _dual_sink(gr.hier_block2, _dual_usrp):
"""A dual usrp sink of IO type short or complex."""
-
+
def __init__(self, number, frequency_a, frequency_b, interpolation,
gain_a, gain_b, mux=0xba98, auto_tr=None, tx_enb_a=None, tx_enb_b=None):
"""!
USRP dual sink contructor.
@@ -350,14 +356,14 @@
"""
#initialize hier2 block
gr.hier_block2.__init__(
- self, 'usrp_dual_sink',
+ self, 'usrp_dual_sink',
gr.io_signature(2, 2,
constructor_to_size[self.constructor]),
- gr.io_signature(0, 0, 0),
+ gr.io_signature(0, 0, 0),
)
#create usrp object
u = self.constructor(number, nchan=2)
u.set_interp_rate(interpolation)
- u.set_mux(mux)
+ u.set_mux(mux)
subdev_a = _setup_tx_subdev(u, (0, 0), gain_a, frequency_a,
auto_tr, tx_enb_a)
subdev_b = _setup_tx_subdev(u, (1, 0), gain_b, frequency_b,
auto_tr, tx_enb_b)
_dual_usrp.__init__(self, u, subdev_a, subdev_b,
subdev_a._which, subdev_b._which)
@@ -366,6 +372,8 @@
self.connect(inter, u)
for i in range(2): self.connect((self, i), (inter, i))
+ def set_interp_rate(self, interp):
self.get_u().set_interp_rate(int(interp))
+
class dual_sink_c(_dual_sink): constructor = usrp.sink_c
class dual_sink_s(_dual_sink): constructor = usrp.sink_s
Modified: grc/trunk/src/grc_gnuradio/wxgui/top_block_gui.py
===================================================================
--- grc/trunk/src/grc_gnuradio/wxgui/top_block_gui.py 2008-07-07 21:34:56 UTC
(rev 8817)
+++ grc/trunk/src/grc_gnuradio/wxgui/top_block_gui.py 2008-07-07 21:39:02 UTC
(rev 8818)
@@ -1,22 +1,22 @@
# Copyright 2008 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
-#
+#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
import wx
import sys, os
@@ -26,14 +26,14 @@
class top_block_gui(gr.top_block):
"""gr top block with wx gui app and grid sizer."""
-
+
def __init__(self, title='', size=default_gui_size, icon=None):
"""!
Initialize the gr top block.
Create the wx gui elements.
@param title the main window title
@param size the main window size tuple in pixels
- @param icon the file path to an icon or None
+ @param icon the file path to an icon or None
"""
#initialize
gr.top_block.__init__(self)
@@ -41,26 +41,26 @@
#set the icon
if icon and os.path.isfile(icon): self._icon = icon
else: self._icon = None
- #create gui elements
+ #create gui elements
self._wx_app = wx.App()
self._wx_frame = wx.Frame(None , -1, title)
self._wx_grid = wx.GridBagSizer(5, 5)
self._wx_vbox = wx.BoxSizer(wx.VERTICAL)
-
- def GetWin(self):
+
+ def GetWin(self):
"""!
Get the window for wx elements to fit within.
- @return the wx frame
+ @return the wx frame
"""
return self._wx_frame
-
+
def Add(self, win):
"""!
Add a window to the wx vbox.
@param win the wx window
"""
- self._wx_vbox.Add(win)
-
+ self._wx_vbox.Add(win, 0, wx.EXPAND)
+
def GridAdd(self, win, row, col, row_span=1, col_span=1):
"""!
Add a window to the wx grid at the given position.
@@ -70,8 +70,8 @@
@param row_span the row span specification (integer >= 1)
@param col_span the column span specification (integer >= 1)
"""
- self._wx_grid.Add(win, wx.GBPosition(row, col),
wx.GBSpan(row_span, col_span))
-
+ self._wx_grid.Add(win, wx.GBPosition(row, col),
wx.GBSpan(row_span, col_span), wx.EXPAND)
+
def Run(self):
"""!
Setup the wx gui elements.
@@ -79,22 +79,22 @@
Block with the wx main loop.
"""
#set wx app icon
- if self._icon: self._wx_frame.SetIcon(wx.Icon(self._icon,
wx.BITMAP_TYPE_ANY))
+ if self._icon: self._wx_frame.SetIcon(wx.Icon(self._icon,
wx.BITMAP_TYPE_ANY))
#set minimal window size
- self._wx_frame.SetSizeHints(*self._size)
- #create callback for quit
+ self._wx_frame.SetSizeHints(*self._size)
+ #create callback for quit
def _quit(event):
gr.top_block.stop(self)
self._wx_frame.Destroy()
exit(0)
- #setup app
- self.Add(self._wx_grid)
+ #setup app
+ self._wx_vbox.Add(self._wx_grid, 0, wx.EXPAND)
self._wx_frame.Bind(wx.EVT_CLOSE, _quit)
- self._wx_frame.SetSizerAndFit(self._wx_vbox)
+ self._wx_frame.SetSizerAndFit(self._wx_vbox)
self._wx_frame.Show()
self._wx_app.SetTopWindow(self._wx_frame)
#start flow graph
gr.top_block.start(self)
#blocking main loop
self._wx_app.MainLoop()
-
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8818 - in grc/trunk: scripts src/grc_gnuradio/blocks/usrp src/grc_gnuradio/usrp src/grc_gnuradio/wxgui,
jblum <=