summaryrefslogtreecommitdiff
path: root/grc/grc_gnuradio/usrp/common.py
diff options
context:
space:
mode:
authorJohnathan Corgan2011-03-16 08:18:30 -0700
committerJohnathan Corgan2011-03-16 08:18:30 -0700
commit4cd06fadac972d4cac559c15488bc39823063afe (patch)
tree6fe57896bc216d8c9e672194f2e4e0e75aedb645 /grc/grc_gnuradio/usrp/common.py
parent4ad736e21f45f64fd616bb53f54e45e1c63e7330 (diff)
parent1d70ed2bd928d52a383e688949cc7f747dd584fa (diff)
downloadgnuradio-4cd06fadac972d4cac559c15488bc39823063afe.tar.gz
gnuradio-4cd06fadac972d4cac559c15488bc39823063afe.tar.bz2
gnuradio-4cd06fadac972d4cac559c15488bc39823063afe.zip
Merge remote branch 'gnuradio/next'
* gnuradio/next: (806 commits) gruel: added missing ignores gruel: fixed swig interface file to dereference pmt_t. qtgui: fix distcheck error gruel: fixing structure. Passes make check. gruel: SWIGing Gruel into Python to access PMTs. gnuradio-examples: add C++ audio examples using new gr-audio created gruel/attributes.h to house compiler specific attribute macros audio: remove obsoleted individual top-level components gr-audio: added README and default config fix volk: simplify the get new method for the aligned pool grc: moved all usrp1 and usrp2 stuff out of grc and into gr-usrp*/grc grc: swap store the subprocess object rather than the pid when executing qtgui: removed python directory that was added, never used uhd: use %ignore to hide warnings and fix errors Added/updated ignore files. Fixing gr_filter_design program to import from gnuradio Python package. audio: high prio for platform specific audio osx audio: added windows and osx audio source files audio: added config checks for other audios, added jack and port audio: make prefs look like old audio, removed old audio.py ...
Diffstat (limited to 'grc/grc_gnuradio/usrp/common.py')
-rw-r--r--grc/grc_gnuradio/usrp/common.py75
1 files changed, 0 insertions, 75 deletions
diff --git a/grc/grc_gnuradio/usrp/common.py b/grc/grc_gnuradio/usrp/common.py
deleted file mode 100644
index 65c1e7e29..000000000
--- a/grc/grc_gnuradio/usrp/common.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# Copyright 2009 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
-
-##################################################
-# USRP base class with common methods
-##################################################
-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, chan, subdev, frequency, verbose=False):
- """
- Set the carrier frequency for the given subdevice.
- @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(chan, subdev, frequency)
- if not verbose: return
- print subdev.side_and_name()
- if r:
- print "\tr.baseband_frequency =", r.baseband_freq
- print "\tr.dxc_frequency =", r.dxc_freq
- print "\tr.residual_frequency =", r.residual_freq
- print "\tr.inverted =", r.inverted, "\n"
- else: print >> sys.stderr, 'Error calling tune on subdevice.'
- def set_format(self, width, shift): self._get_u().set_format(self._get_u().make_format(width, shift))
-
-##################################################
-# Classes to associate usrp constructor w/ io size
-##################################################
-class usrp_source_c(usrp_helper): _usrp_args = (usrp.source_c, gr.sizeof_gr_complex)
-class usrp_source_s(usrp_helper): _usrp_args = (usrp.source_s, gr.sizeof_short)
-class usrp_sink_c(usrp_helper): _usrp_args = (usrp.sink_c, gr.sizeof_gr_complex)
-class usrp_sink_s(usrp_helper): _usrp_args = (usrp.sink_s, gr.sizeof_short)
-
-##################################################
-# Side spec and antenna spec functions
-##################################################
-def is_flex(rx_ant): return rx_ant.upper() in ('TX/RX', 'RX2')
-def to_spec(side, rx_ant='RXA'):
- """
- Convert the side to a spec number.
- @param side A or B
- @param rx_ant antenna type
- @return the spec (0/1, 0/1/2)
- """
- #determine the side spec
- try: side_spec = {'A': 0, 'B': 1}[side.upper()]
- except: raise ValueError, 'Side A or B expected.'
- #determine the subdevice spec
- if rx_ant.upper() == 'RXB': subdev_spec = 1
- elif rx_ant.upper() == 'RXAB': subdev_spec = 2
- else: subdev_spec = 0
- return (side_spec, subdev_spec)