From 385c63d955212c61d239b7ad3301e488a4c8f00f Mon Sep 17 00:00:00 2001 From: mer0m Date: Wed, 22 Mar 2017 17:56:28 +0100 Subject: [PATCH] - --- redpitaya/client/dds_control.grc | 495 --------------------- redpitaya/client/gr_add_const_set_offset.xml | 57 --- redpitaya/client/gr_nco_counter_send_conf.xml | 78 ---- redpitaya/client/gr_source_test.xml | 30 -- redpitaya/client/gr_source_test.xml.old | 30 -- redpitaya/client/redpitaya_gnuradio.py | 71 --- redpitaya/client/redpitaya_gnuradio.pyc | Bin 1921 -> 0 bytes redpitaya/client/sourceme.bma | 1 - redpitaya/gnuradio_blocks/dds_control.grc | 6 +- .../dds_control.py} | 25 +- redpitaya/gnuradio_blocks/top_block.py | 167 ------- sdr/fm_radio/fm_radio.py | 2 +- 12 files changed, 13 insertions(+), 949 deletions(-) delete mode 100644 redpitaya/client/dds_control.grc delete mode 100644 redpitaya/client/gr_add_const_set_offset.xml delete mode 100644 redpitaya/client/gr_nco_counter_send_conf.xml delete mode 100644 redpitaya/client/gr_source_test.xml delete mode 100644 redpitaya/client/gr_source_test.xml.old delete mode 100644 redpitaya/client/redpitaya_gnuradio.py delete mode 100644 redpitaya/client/redpitaya_gnuradio.pyc delete mode 100644 redpitaya/client/sourceme.bma rename redpitaya/{client/top_block.py => gnuradio_blocks/dds_control.py} (89%) delete mode 100755 redpitaya/gnuradio_blocks/top_block.py diff --git a/redpitaya/client/dds_control.grc b/redpitaya/client/dds_control.grc deleted file mode 100644 index 0e5dd0d..0000000 --- a/redpitaya/client/dds_control.grc +++ /dev/null @@ -1,495 +0,0 @@ - - - - Thu Feb 2 22:54:58 2017 - - options - - author - - - - window_size - - - - category - [GRC Hier Blocks] - - - comment - - - - description - - - - _enabled - True - - - _coordinate - (8, 8) - - - _rotation - 0 - - - generate_options - qt_gui - - - hier_block_src_path - .: - - - id - top_block - - - max_nouts - 0 - - - qt_qss_theme - - - - realtime_scheduling - - - - run_command - {python} -u {filename} - - - run_options - prompt - - - run - True - - - thread_safe_setters - - - - title - - - - - variable_qtgui_range - - comment - - - - value - 0 - - - _enabled - True - - - _coordinate - (704, 24) - - - gui_hint - 1, 0 - - - _rotation - 0 - - - id - a_dds - - - label - DDS amplitude - - - min_len - 200 - - - orient - Qt.Horizontal - - - start - 0 - - - step - 128 - - - stop - 8191 - - - rangeType - int - - - widget - counter_slider - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (0, 248) - - - _rotation - 0 - - - id - addr - - - value - "192.168.0.202" - - - - variable_qtgui_range - - comment - - - - value - 0 - - - _enabled - True - - - _coordinate - (488, 24) - - - gui_hint - 0, 0 - - - _rotation - 0 - - - id - f_dds - - - label - DDS frequency - - - min_len - 200 - - - orient - Qt.Horizontal - - - start - 0 - - - step - 100000 - - - stop - 60000000 - - - rangeType - int - - - widget - counter_slider - - - - variable_qtgui_range - - comment - - - - value - 0 - - - _enabled - True - - - _coordinate - (328, 24) - - - gui_hint - 2, 0 - - - _rotation - 0 - - - id - offset_out1 - - - label - Offset DDS - - - min_len - 200 - - - orient - Qt.Horizontal - - - start - -8192 - - - step - 100 - - - stop - 8191 - - - rangeType - int - - - widget - counter_slider - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (0, 320) - - - _rotation - 0 - - - id - port - - - value - 1001 - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (8, 160) - - - _rotation - 0 - - - id - samp_rate - - - value - 32000 - - - - add_const_set_offset - - addr - addr - - - alias - - - - comment - - - - const - offset_out1 - - - device - /dev/dds_offset - - - _enabled - True - - - _coordinate - (304, 176) - - - _rotation - 0 - - - id - add_const_set_offset_0 - - - port - port - - - - add_const_set_offset - - addr - addr - - - alias - - - - comment - - - - const - a_dds - - - device - /dev/dds_ampl - - - _enabled - True - - - _coordinate - (704, 176) - - - _rotation - 0 - - - id - add_const_set_offset_0_0 - - - port - port - - - - nco_counter_send_conf - - acc_size - 32 - - - addr - addr - - - alias - - - - comment - - - - device - /dev/dds_freq - - - _enabled - True - - - freq_dds - f_dds - - - freq_ref - 125000000 - - - _coordinate - (488, 176) - - - _rotation - 0 - - - id - nco_counter_send_conf_0 - - - offset - 0 - - - port - port - - - diff --git a/redpitaya/client/gr_add_const_set_offset.xml b/redpitaya/client/gr_add_const_set_offset.xml deleted file mode 100644 index 26b1a88..0000000 --- a/redpitaya/client/gr_add_const_set_offset.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - add_const_set_offset - add_const_set_offset - Red Pitaya - import redpitaya_gnuradio - redpitaya_gnuradio.add_const_set_offset( - addr=$addr, - port=$port, - device=$device, - const=$const, -) - - set_const(device=$device, const=$const) - - Address - addr - 192.168.0.201 - string - - - Port - port - 1001 - int - - - Device - device - /dev/add_const_0 - string - - - Constant - const - 0 - int - - diff --git a/redpitaya/client/gr_nco_counter_send_conf.xml b/redpitaya/client/gr_nco_counter_send_conf.xml deleted file mode 100644 index f7d6d0c..0000000 --- a/redpitaya/client/gr_nco_counter_send_conf.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - nco_counter_send_conf - nco_counter_send_conf - Red Pitaya - import redpitaya_gnuradio - redpitaya_gnuradio.nco_counter_send_conf( - addr=$addr, - port=$port, - device=$device, - freq_ref=$freq_ref, - freq_dds=$freq_dds, - acc_size=$acc_size, - offset=$offset, -) - - set_nco(device=$device, freq_ref=$freq_ref, freq_dds=$freq_dds, acc_size=$acc_size, offset=$offset) - - Address - addr - 192.168.0.201 - string - - - Port - port - 1001 - int - - - Device - device - /dev/dds1 - string - - - Frequency ref - freq_ref - 125000000 - int - - - Frequency DDS - freq_dds - 0 - int - - - Accumulator size - acc_size - 28 - int - - - Offset - offset - 0 - int - - diff --git a/redpitaya/client/gr_source_test.xml b/redpitaya/client/gr_source_test.xml deleted file mode 100644 index bcc8938..0000000 --- a/redpitaya/client/gr_source_test.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - source_test - source_test - Red Pitaya - import redpitaya_gnuradio - redpitaya_gnuradio.source_test() - - out - complex - - diff --git a/redpitaya/client/gr_source_test.xml.old b/redpitaya/client/gr_source_test.xml.old deleted file mode 100644 index bcc8938..0000000 --- a/redpitaya/client/gr_source_test.xml.old +++ /dev/null @@ -1,30 +0,0 @@ - - - - source_test - source_test - Red Pitaya - import redpitaya_gnuradio - redpitaya_gnuradio.source_test() - - out - complex - - diff --git a/redpitaya/client/redpitaya_gnuradio.py b/redpitaya/client/redpitaya_gnuradio.py deleted file mode 100644 index 650fdcf..0000000 --- a/redpitaya/client/redpitaya_gnuradio.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python - -# GNU Radio blocks for the Red Pitaya transceiver -# Copyright (C) 2015 Renzo Davoli -# -# This program 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 2 -# of the License, or (at your option) any later version. -# -# This program 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 this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -import socket, os -from gnuradio import gr, blocks - -class add_const_set_offset(gr.hier_block2): - def __init__(self, addr, port, device, const): - self.name = "add_const_set_offset" - gr.hier_block2.__init__( - self, - name = self.name, - input_signature = gr.io_signature(0, 0, 0), - output_signature = gr.io_signature(0, 0, 0) - ) - self.ctrl_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.ctrl_sock.connect((addr, port)) - self.set_const(device, const) - - def set_const(self, device, const): - self.ctrl_sock.send('%s;%s;%i\n'%(self.name, device, const)) - - -class nco_counter_send_conf(gr.hier_block2): - def __init__(self, addr, port, device, freq_ref, freq_dds, acc_size, offset): - self.name = "nco_counter_send_conf" - gr.hier_block2.__init__( - self, - name = self.name, - input_signature = gr.io_signature(0, 0, 0), - output_signature = gr.io_signature(0, 0, 0) - ) - self.ctrl_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.ctrl_sock.connect((addr, port)) - self.set_nco(device, freq_ref, freq_dds, acc_size, offset) - - def set_nco(self, device, freq_ref, freq_dds, acc_size, offset): - self.ctrl_sock.send('%s;%s;%i;%i;%i;%i\n'%(self.name, device, freq_ref, freq_dds, acc_size, offset)) - -'''~ -class source_test(gr.hier_block2): - def __init__(self): - self.name = "source_test" - gr.hier_block2.__init__( - self, - name = self.name, - input_signature = gr.io_signature(0, 0, 0), - output_signature = gr.io_signature(1, 1, gr.sizeof_gr_complex) - ) - self.data_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.data_sock.connect((addr, port)) - self.data_sock.send('%s'%self.name) - fd = os.dup(self.data_sock.fileno()) - self.connect(blocks.file_descriptor_source(gr.sizeof_gr_complex, fd), self) -''' diff --git a/redpitaya/client/redpitaya_gnuradio.pyc b/redpitaya/client/redpitaya_gnuradio.pyc deleted file mode 100644 index 8f6c7b73ecbec66e263c8bae094f8484f7b5802e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1921 zcmd5-%Wl&^6uq{SG%fE}p@75&B(s185-Sj*AdnEENRuugn^EwiI3#xQOprj?l^v1VYqseC6CT0bWw;F6)h%KJ{g7)gh{W_X zf6~Sr+A-K;nEL{USyK^<Z>>L$Mp4bvD*O)UXWo;b z^{4jP#*hEQ3444hGT&@+&%t^l~~avR(rLSsRG>e zlO4ltm~(JP+WkpP=cJ#(yKIXo^1Ii*KjXH>n%E<7L z{307e9X7DDM#J-9NQzN;@hq4VaC-K6-T`c^Gxa!7nC1)}4~9~k*V%hpXZgI5rcN7! zB!L1yWvYheii`2pku-1<^A6JhOQ3OEs)1Vw4%0w$4FR>h^P3o0!@d}xhvv7S3d5Va zQG~)aSHv0zcsrXbbXVbyR2rpy7q%!6!}Dua>8O6gIrC&1{o%qO@0>G}L&Fw%)qg!z r!^Qp`W6&>#dT34p)nxW_EG&EYic0PMM!^pVkn6%-!UeT id - top_block + dds_control max_nouts @@ -168,7 +168,7 @@ value - "192.168.0.202" + "192.168.0.201" @@ -332,7 +332,7 @@ _enabled - True + 0 _coordinate diff --git a/redpitaya/client/top_block.py b/redpitaya/gnuradio_blocks/dds_control.py similarity index 89% rename from redpitaya/client/top_block.py rename to redpitaya/gnuradio_blocks/dds_control.py index 7d00ca6..a48bd5a 100755 --- a/redpitaya/client/top_block.py +++ b/redpitaya/gnuradio_blocks/dds_control.py @@ -2,8 +2,8 @@ # -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph -# Title: Top Block -# Generated: Mon Feb 13 22:24:05 2017 +# Title: Dds Control +# Generated: Tue Mar 21 12:05:52 2017 ################################################## if __name__ == '__main__': @@ -27,12 +27,12 @@ import redpitaya_gnuradio import sys -class top_block(gr.top_block, Qt.QWidget): +class dds_control(gr.top_block, Qt.QWidget): def __init__(self): - gr.top_block.__init__(self, "Top Block") + gr.top_block.__init__(self, "Dds Control") Qt.QWidget.__init__(self) - self.setWindowTitle("Top Block") + self.setWindowTitle("Dds Control") try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: @@ -49,17 +49,16 @@ class top_block(gr.top_block, Qt.QWidget): self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) - self.settings = Qt.QSettings("GNU Radio", "top_block") + self.settings = Qt.QSettings("GNU Radio", "dds_control") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## - self.samp_rate = samp_rate = 32000 self.port = port = 1001 self.offset_out1 = offset_out1 = 0 self.f_dds = f_dds = 0 - self.addr = addr = "192.168.0.202" + self.addr = addr = "192.168.0.201" self.a_dds = a_dds = 0 ################################################## @@ -100,16 +99,10 @@ class top_block(gr.top_block, Qt.QWidget): def closeEvent(self, event): - self.settings = Qt.QSettings("GNU Radio", "top_block") + self.settings = Qt.QSettings("GNU Radio", "dds_control") self.settings.setValue("geometry", self.saveGeometry()) event.accept() - def get_samp_rate(self): - return self.samp_rate - - def set_samp_rate(self, samp_rate): - self.samp_rate = samp_rate - def get_port(self): return self.port @@ -144,7 +137,7 @@ class top_block(gr.top_block, Qt.QWidget): self.add_const_set_offset_0_0.set_const(device='/dev/dds_ampl', const=self.a_dds) -def main(top_block_cls=top_block, options=None): +def main(top_block_cls=dds_control, options=None): from distutils.version import StrictVersion if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): diff --git a/redpitaya/gnuradio_blocks/top_block.py b/redpitaya/gnuradio_blocks/top_block.py deleted file mode 100755 index 7d00ca6..0000000 --- a/redpitaya/gnuradio_blocks/top_block.py +++ /dev/null @@ -1,167 +0,0 @@ -#!/usr/bin/env python2 -# -*- coding: utf-8 -*- -################################################## -# GNU Radio Python Flow Graph -# Title: Top Block -# Generated: Mon Feb 13 22:24:05 2017 -################################################## - -if __name__ == '__main__': - import ctypes - import sys - if sys.platform.startswith('linux'): - try: - x11 = ctypes.cdll.LoadLibrary('libX11.so') - x11.XInitThreads() - except: - print "Warning: failed to XInitThreads()" - -from PyQt4 import Qt -from gnuradio import eng_notation -from gnuradio import gr -from gnuradio.eng_option import eng_option -from gnuradio.filter import firdes -from gnuradio.qtgui import Range, RangeWidget -from optparse import OptionParser -import redpitaya_gnuradio -import sys - - -class top_block(gr.top_block, Qt.QWidget): - - def __init__(self): - gr.top_block.__init__(self, "Top Block") - Qt.QWidget.__init__(self) - self.setWindowTitle("Top Block") - try: - self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) - except: - pass - self.top_scroll_layout = Qt.QVBoxLayout() - self.setLayout(self.top_scroll_layout) - self.top_scroll = Qt.QScrollArea() - self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) - self.top_scroll_layout.addWidget(self.top_scroll) - self.top_scroll.setWidgetResizable(True) - self.top_widget = Qt.QWidget() - self.top_scroll.setWidget(self.top_widget) - self.top_layout = Qt.QVBoxLayout(self.top_widget) - self.top_grid_layout = Qt.QGridLayout() - self.top_layout.addLayout(self.top_grid_layout) - - self.settings = Qt.QSettings("GNU Radio", "top_block") - self.restoreGeometry(self.settings.value("geometry").toByteArray()) - - ################################################## - # Variables - ################################################## - self.samp_rate = samp_rate = 32000 - self.port = port = 1001 - self.offset_out1 = offset_out1 = 0 - self.f_dds = f_dds = 0 - self.addr = addr = "192.168.0.202" - self.a_dds = a_dds = 0 - - ################################################## - # Blocks - ################################################## - self._offset_out1_range = Range(-8192, 8191, 100, 0, 200) - self._offset_out1_win = RangeWidget(self._offset_out1_range, self.set_offset_out1, 'Offset DDS', "counter_slider", int) - self.top_grid_layout.addWidget(self._offset_out1_win, 2, 0) - self._f_dds_range = Range(0, 60000000, 100000, 0, 200) - self._f_dds_win = RangeWidget(self._f_dds_range, self.set_f_dds, 'DDS frequency', "counter_slider", int) - self.top_grid_layout.addWidget(self._f_dds_win, 0, 0) - self._a_dds_range = Range(0, 8191, 128, 0, 200) - self._a_dds_win = RangeWidget(self._a_dds_range, self.set_a_dds, 'DDS amplitude', "counter_slider", int) - self.top_grid_layout.addWidget(self._a_dds_win, 1, 0) - self.nco_counter_send_conf_0 = redpitaya_gnuradio.nco_counter_send_conf( - addr=addr, - port=port, - device='/dev/dds_freq', - freq_ref=125000000, - freq_dds=f_dds, - acc_size=32, - offset=0, - ) - - self.add_const_set_offset_0_0 = redpitaya_gnuradio.add_const_set_offset( - addr=addr, - port=port, - device='/dev/dds_ampl', - const=a_dds, - ) - - self.add_const_set_offset_0 = redpitaya_gnuradio.add_const_set_offset( - addr=addr, - port=port, - device='/dev/dds_offset', - const=offset_out1, - ) - - - def closeEvent(self, event): - self.settings = Qt.QSettings("GNU Radio", "top_block") - self.settings.setValue("geometry", self.saveGeometry()) - event.accept() - - def get_samp_rate(self): - return self.samp_rate - - def set_samp_rate(self, samp_rate): - self.samp_rate = samp_rate - - def get_port(self): - return self.port - - def set_port(self, port): - self.port = port - - def get_offset_out1(self): - return self.offset_out1 - - def set_offset_out1(self, offset_out1): - self.offset_out1 = offset_out1 - self.add_const_set_offset_0.set_const(device='/dev/dds_offset', const=self.offset_out1) - - def get_f_dds(self): - return self.f_dds - - def set_f_dds(self, f_dds): - self.f_dds = f_dds - self.nco_counter_send_conf_0.set_nco(device='/dev/dds_freq', freq_ref=125000000, freq_dds=self.f_dds, acc_size=32, offset=0) - - def get_addr(self): - return self.addr - - def set_addr(self, addr): - self.addr = addr - - def get_a_dds(self): - return self.a_dds - - def set_a_dds(self, a_dds): - self.a_dds = a_dds - self.add_const_set_offset_0_0.set_const(device='/dev/dds_ampl', const=self.a_dds) - - -def main(top_block_cls=top_block, options=None): - - from distutils.version import StrictVersion - if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): - style = gr.prefs().get_string('qtgui', 'style', 'raster') - Qt.QApplication.setGraphicsSystem(style) - qapp = Qt.QApplication(sys.argv) - - tb = top_block_cls() - tb.start() - tb.show() - - def quitting(): - tb.stop() - tb.wait() - qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting) - qapp.exec_() - - -if __name__ == '__main__': - main() diff --git a/sdr/fm_radio/fm_radio.py b/sdr/fm_radio/fm_radio.py index 8ae9f4a..63be504 100755 --- a/sdr/fm_radio/fm_radio.py +++ b/sdr/fm_radio/fm_radio.py @@ -3,7 +3,7 @@ ################################################## # GNU Radio Python Flow Graph # Title: Fm Radio -# Generated: Fri Mar 17 17:36:39 2017 +# Generated: Tue Mar 21 14:48:06 2017 ################################################## if __name__ == '__main__': -- 2.16.4