From 53d84cc32c960f3b312d8ad7b3b05c09cc82f839 Mon Sep 17 00:00:00 2001 From: mer0m Date: Thu, 20 Apr 2017 11:17:18 +0200 Subject: [PATCH] - --- redpitaya/client/dds_gnuradio.grc | 2 +- redpitaya/client/dds_gnuradio.py | 4 +- redpitaya/client/iq_demod_only.grc | 708 +++++++++++++++++++++++++++++++++++++ redpitaya/client/iq_demod_only.py | 203 +++++++++++ redpitaya/client/pid_only.grc | 2 +- redpitaya/client/pid_only.py | 4 +- 6 files changed, 917 insertions(+), 6 deletions(-) create mode 100644 redpitaya/client/iq_demod_only.grc create mode 100755 redpitaya/client/iq_demod_only.py diff --git a/redpitaya/client/dds_gnuradio.grc b/redpitaya/client/dds_gnuradio.grc index 44ecb46..f5b2899 100644 --- a/redpitaya/client/dds_gnuradio.grc +++ b/redpitaya/client/dds_gnuradio.grc @@ -168,7 +168,7 @@ value - "192.168.0.203" + "192.168.0.201" diff --git a/redpitaya/client/dds_gnuradio.py b/redpitaya/client/dds_gnuradio.py index 49aee71..bf562ca 100755 --- a/redpitaya/client/dds_gnuradio.py +++ b/redpitaya/client/dds_gnuradio.py @@ -3,7 +3,7 @@ ################################################## # GNU Radio Python Flow Graph # Title: Dds Gnuradio -# Generated: Sat Apr 8 10:39:47 2017 +# Generated: Thu Apr 20 11:13:10 2017 ################################################## if __name__ == '__main__': @@ -58,7 +58,7 @@ class dds_gnuradio(gr.top_block, Qt.QWidget): self.port = port = 1001 self.offset_out1 = offset_out1 = 0 self.f_dds = f_dds = 0 - self.addr = addr = "192.168.0.203" + self.addr = addr = "192.168.0.201" self.a_dds = a_dds = 0 ################################################## diff --git a/redpitaya/client/iq_demod_only.grc b/redpitaya/client/iq_demod_only.grc new file mode 100644 index 0000000..77af9b9 --- /dev/null +++ b/redpitaya/client/iq_demod_only.grc @@ -0,0 +1,708 @@ + + + + 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 + iq_demod_only + + + 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 + (568, 4) + + + gui_hint + 0, 1 + + + _rotation + 0 + + + id + adc1_offset + + + label + adc1_offset + + + min_len + 200 + + + orient + Qt.Horizontal + + + start + -2**13 + + + step + 1 + + + stop + 2**13-1 + + + rangeType + int + + + widget + counter_slider + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (8, 104) + + + _rotation + 0 + + + id + addr + + + value + "192.168.0.201" + + + + variable_qtgui_range + + comment + + + + value + 0 + + + _enabled + True + + + _coordinate + (296, 356) + + + gui_hint + 1, 0 + + + _rotation + 0 + + + id + dds_ampl + + + label + dds_ampl + + + min_len + 200 + + + orient + Qt.Horizontal + + + start + 0 + + + step + 1 + + + stop + 2**13-1 + + + rangeType + int + + + widget + counter_slider + + + + variable_qtgui_range + + comment + + + + value + 0 + + + _enabled + True + + + _coordinate + (312, 652) + + + gui_hint + 2, 0 + + + _rotation + 0 + + + id + dds_offset + + + label + dds_offset + + + min_len + 200 + + + orient + Qt.Horizontal + + + start + -2**13 + + + step + 1 + + + stop + 2**13-1 + + + rangeType + int + + + widget + counter_slider + + + + variable_qtgui_range + + comment + + + + value + 0 + + + _enabled + True + + + _coordinate + (568, 372) + + + gui_hint + 1, 1 + + + _rotation + 0 + + + id + demod_f + + + label + demod_f + + + min_len + 200 + + + orient + Qt.Horizontal + + + start + 0 + + + step + 1000 + + + stop + 60000000 + + + rangeType + float + + + widget + counter_slider + + + + variable_qtgui_range + + comment + + + + value + 0 + + + _enabled + True + + + _coordinate + (288, 4) + + + gui_hint + 0, 0 + + + _rotation + 0 + + + id + f_dds + + + label + f_dds + + + min_len + 200 + + + orient + Qt.Horizontal + + + start + 0 + + + step + 1000 + + + stop + 60000000 + + + rangeType + float + + + widget + counter_slider + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (8, 176) + + + _rotation + 0 + + + id + port + + + value + 1001 + + + + add_const_set_offset + + addr + addr + + + alias + + + + comment + + + + const + dds_offset + + + device + /dev/dds_offset + + + _enabled + True + + + _coordinate + (288, 804) + + + _rotation + 0 + + + id + add_const_set_offset_0 + + + port + port + + + + add_const_set_offset + + addr + addr + + + alias + + + + comment + + + + const + dds_ampl + + + device + /dev/dds_ampl + + + _enabled + True + + + _coordinate + (296, 508) + + + _rotation + 0 + + + id + add_const_set_offset_0_0 + + + port + port + + + + add_const_set_offset + + addr + addr + + + alias + + + + comment + + + + const + adc1_offset + + + device + /dev/adc1_offset + + + _enabled + True + + + _coordinate + (544, 156) + + + _rotation + 0 + + + id + add_const_set_offset_0_1 + + + port + port + + + + nco_counter_send_conf + + acc_size + 32 + + + addr + addr + + + alias + + + + comment + + + + device + /dev/dds_nco + + + _enabled + True + + + freq_dds + f_dds + + + freq_ref + 125000000 + + + _coordinate + (288, 152) + + + _rotation + 0 + + + id + nco_counter_send_conf_0 + + + offset + 0 + + + pinc_sw + 1 + + + poff_sw + 1 + + + port + port + + + + nco_counter_send_conf + + acc_size + 32 + + + addr + addr + + + alias + + + + comment + + + + device + /dev/demod_nco + + + _enabled + True + + + freq_dds + demod_f + + + freq_ref + 125000000 + + + _coordinate + (568, 528) + + + _rotation + 0 + + + id + nco_counter_send_conf_0_0 + + + offset + 0 + + + pinc_sw + 1 + + + poff_sw + 1 + + + port + port + + + diff --git a/redpitaya/client/iq_demod_only.py b/redpitaya/client/iq_demod_only.py new file mode 100755 index 0000000..85467c7 --- /dev/null +++ b/redpitaya/client/iq_demod_only.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python2 +# -*- coding: utf-8 -*- +################################################## +# GNU Radio Python Flow Graph +# Title: Iq Demod Only +# Generated: Thu Apr 20 11:09:14 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 iq_demod_only(gr.top_block, Qt.QWidget): + + def __init__(self): + gr.top_block.__init__(self, "Iq Demod Only") + Qt.QWidget.__init__(self) + self.setWindowTitle("Iq Demod Only") + 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", "iq_demod_only") + self.restoreGeometry(self.settings.value("geometry").toByteArray()) + + ################################################## + # Variables + ################################################## + self.port = port = 1001 + self.f_dds = f_dds = 0 + self.demod_f = demod_f = 0 + self.dds_offset = dds_offset = 0 + self.dds_ampl = dds_ampl = 0 + self.addr = addr = "192.168.0.201" + self.adc1_offset = adc1_offset = 0 + + ################################################## + # Blocks + ################################################## + self._f_dds_range = Range(0, 60000000, 1000, 0, 200) + self._f_dds_win = RangeWidget(self._f_dds_range, self.set_f_dds, 'f_dds', "counter_slider", float) + self.top_grid_layout.addWidget(self._f_dds_win, 0, 0) + self._demod_f_range = Range(0, 60000000, 1000, 0, 200) + self._demod_f_win = RangeWidget(self._demod_f_range, self.set_demod_f, 'demod_f', "counter_slider", float) + self.top_grid_layout.addWidget(self._demod_f_win, 1, 1) + self._dds_offset_range = Range(-2**13, 2**13-1, 1, 0, 200) + self._dds_offset_win = RangeWidget(self._dds_offset_range, self.set_dds_offset, 'dds_offset', "counter_slider", int) + self.top_grid_layout.addWidget(self._dds_offset_win, 2, 0) + self._dds_ampl_range = Range(0, 2**13-1, 1, 0, 200) + self._dds_ampl_win = RangeWidget(self._dds_ampl_range, self.set_dds_ampl, 'dds_ampl', "counter_slider", int) + self.top_grid_layout.addWidget(self._dds_ampl_win, 1, 0) + self._adc1_offset_range = Range(-2**13, 2**13-1, 1, 0, 200) + self._adc1_offset_win = RangeWidget(self._adc1_offset_range, self.set_adc1_offset, 'adc1_offset', "counter_slider", int) + self.top_grid_layout.addWidget(self._adc1_offset_win, 0, 1) + self.nco_counter_send_conf_0_0 = redpitaya_gnuradio.nco_counter_send_conf( + addr=addr, + port=port, + device='/dev/demod_nco', + freq_ref=125000000, + freq_dds=demod_f, + acc_size=32, + offset=0, + pinc_sw=1, + poff_sw=1, + ) + + self.nco_counter_send_conf_0 = redpitaya_gnuradio.nco_counter_send_conf( + addr=addr, + port=port, + device='/dev/dds_nco', + freq_ref=125000000, + freq_dds=f_dds, + acc_size=32, + offset=0, + pinc_sw=1, + poff_sw=1, + ) + + self.add_const_set_offset_0_1 = redpitaya_gnuradio.add_const_set_offset( + addr=addr, + port=port, + device='/dev/adc1_offset', + const=adc1_offset, + ) + + self.add_const_set_offset_0_0 = redpitaya_gnuradio.add_const_set_offset( + addr=addr, + port=port, + device='/dev/dds_ampl', + const=dds_ampl, + ) + + self.add_const_set_offset_0 = redpitaya_gnuradio.add_const_set_offset( + addr=addr, + port=port, + device='/dev/dds_offset', + const=dds_offset, + ) + + + def closeEvent(self, event): + self.settings = Qt.QSettings("GNU Radio", "iq_demod_only") + self.settings.setValue("geometry", self.saveGeometry()) + event.accept() + + def get_port(self): + return self.port + + def set_port(self, port): + self.port = port + + 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_nco', freq_ref=125000000, freq_dds=self.f_dds, acc_size=32, offset=0, pinc_sw=1, poff_sw=1) + + def get_demod_f(self): + return self.demod_f + + def set_demod_f(self, demod_f): + self.demod_f = demod_f + self.nco_counter_send_conf_0_0.set_nco(device='/dev/demod_nco', freq_ref=125000000, freq_dds=self.demod_f, acc_size=32, offset=0, pinc_sw=1, poff_sw=1) + + def get_dds_offset(self): + return self.dds_offset + + def set_dds_offset(self, dds_offset): + self.dds_offset = dds_offset + self.add_const_set_offset_0.set_const(device='/dev/dds_offset', const=self.dds_offset) + + def get_dds_ampl(self): + return self.dds_ampl + + def set_dds_ampl(self, dds_ampl): + self.dds_ampl = dds_ampl + self.add_const_set_offset_0_0.set_const(device='/dev/dds_ampl', const=self.dds_ampl) + + def get_addr(self): + return self.addr + + def set_addr(self, addr): + self.addr = addr + + def get_adc1_offset(self): + return self.adc1_offset + + def set_adc1_offset(self, adc1_offset): + self.adc1_offset = adc1_offset + self.add_const_set_offset_0_1.set_const(device='/dev/adc1_offset', const=self.adc1_offset) + + +def main(top_block_cls=iq_demod_only, 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/redpitaya/client/pid_only.grc b/redpitaya/client/pid_only.grc index a5ccc43..c8d7aea 100644 --- a/redpitaya/client/pid_only.grc +++ b/redpitaya/client/pid_only.grc @@ -168,7 +168,7 @@ value - "192.168.0.202" + "192.168.0.201" diff --git a/redpitaya/client/pid_only.py b/redpitaya/client/pid_only.py index dbb757d..e1ab246 100755 --- a/redpitaya/client/pid_only.py +++ b/redpitaya/client/pid_only.py @@ -3,7 +3,7 @@ ################################################## # GNU Radio Python Flow Graph # Title: Pid Only -# Generated: Fri Mar 31 15:40:54 2017 +# Generated: Wed Apr 19 09:35:59 2017 ################################################## if __name__ == '__main__': @@ -63,7 +63,7 @@ class pid_only(gr.top_block, Qt.QWidget): self.pid_kd = pid_kd = 0 self.pid_int_rst = pid_int_rst = 0 self.dac1_offset = dac1_offset = 0 - self.addr = addr = "192.168.0.202" + self.addr = addr = "192.168.0.201" self.adc1_offset = adc1_offset = 0 ################################################## -- 2.16.4