summaryrefslogtreecommitdiff
path: root/gr-howto-write-a-block
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2012-11-10 15:43:21 -0500
committerTom Rondeau <trondeau@vt.edu>2012-11-10 15:43:21 -0500
commit611f7e45e7a793f2489d76670a61493327838e3e (patch)
tree9c97a36fc0f5bdd8b6078fe110f330dde81a625d /gr-howto-write-a-block
parent1155ff1e58fc3311f55f28d2e95f057708b99c7d (diff)
analog: fixing up GRC and other examples to use gr-analog for sig and noise sources.
Diffstat (limited to 'gr-howto-write-a-block')
-rw-r--r--gr-howto-write-a-block/apps/howto_square_qt.grc156
-rwxr-xr-xgr-howto-write-a-block/apps/howto_square_qt.py14
2 files changed, 90 insertions, 80 deletions
diff --git a/gr-howto-write-a-block/apps/howto_square_qt.grc b/gr-howto-write-a-block/apps/howto_square_qt.grc
index 7e963f92b5..6281c3a310 100644
--- a/gr-howto-write-a-block/apps/howto_square_qt.grc
+++ b/gr-howto-write-a-block/apps/howto_square_qt.grc
@@ -1,66 +1,59 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Sun Sep 30 13:32:48 2012</timestamp>
+ <timestamp>Sat Nov 10 15:23:43 2012</timestamp>
<block>
- <key>variable</key>
+ <key>options</key>
<param>
<key>id</key>
- <value>samp_rate</value>
+ <value>howto_square_qt</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>value</key>
- <value>32000</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(183, 12)</value>
+ <key>title</key>
+ <value></value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>author</key>
+ <value></value>
</param>
- </block>
- <block>
- <key>gr_sig_source_x</key>
<param>
- <key>id</key>
- <value>gr_sig_source_x_0</value>
+ <key>description</key>
+ <value></value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>window_size</key>
+ <value>1280, 1024</value>
</param>
<param>
- <key>type</key>
- <value>float</value>
+ <key>generate_options</key>
+ <value>qt_gui</value>
</param>
<param>
- <key>samp_rate</key>
- <value>samp_rate</value>
+ <key>category</key>
+ <value>Custom</value>
</param>
<param>
- <key>waveform</key>
- <value>gr.GR_COS_WAVE</value>
+ <key>run_options</key>
+ <value>prompt</value>
</param>
<param>
- <key>freq</key>
- <value>1000</value>
+ <key>run</key>
+ <value>True</value>
</param>
<param>
- <key>amp</key>
- <value>1</value>
+ <key>max_nouts</key>
+ <value>0</value>
</param>
<param>
- <key>offset</key>
- <value>0</value>
+ <key>realtime_scheduling</key>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(19, 98)</value>
+ <value>(10, 10)</value>
</param>
<param>
<key>_rotation</key>
@@ -68,30 +61,22 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>variable</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>samp_rate</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>float</value>
- </param>
- <param>
- <key>samples_per_second</key>
- <value>samp_rate</value>
- </param>
- <param>
- <key>vlen</key>
- <value>1</value>
+ <key>value</key>
+ <value>32000</value>
</param>
<param>
<key>_coordinate</key>
- <value>(212, 130)</value>
+ <value>(183, 12)</value>
</param>
<param>
<key>_rotation</key>
@@ -159,10 +144,18 @@
<value>1024</value>
</param>
<param>
- <key>bw</key>
+ <key>srate</key>
<value>samp_rate</value>
</param>
<param>
+ <key>ymin</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>ymax</key>
+ <value>1</value>
+ </param>
+ <param>
<key>nconnections</key>
<value>3</value>
</param>
@@ -180,58 +173,73 @@
</param>
</block>
<block>
- <key>options</key>
+ <key>gr_throttle</key>
<param>
<key>id</key>
- <value>howto_square_qt</value>
+ <value>gr_throttle_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>title</key>
- <value></value>
+ <key>type</key>
+ <value>float</value>
</param>
<param>
- <key>author</key>
- <value></value>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>description</key>
- <value></value>
+ <key>vlen</key>
+ <value>1</value>
</param>
<param>
- <key>window_size</key>
- <value>1280, 1024</value>
+ <key>_coordinate</key>
+ <value>(212, 130)</value>
</param>
<param>
- <key>generate_options</key>
- <value>qt_gui</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>analog_sig_source_x</key>
<param>
- <key>category</key>
- <value>Custom</value>
+ <key>id</key>
+ <value>analog_sig_source_x_0</value>
</param>
<param>
- <key>run_options</key>
- <value>prompt</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>run</key>
- <value>True</value>
+ <key>type</key>
+ <value>float</value>
</param>
<param>
- <key>max_nouts</key>
- <value>0</value>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>realtime_scheduling</key>
- <value></value>
+ <key>waveform</key>
+ <value>analog.GR_COS_WAVE</value>
+ </param>
+ <param>
+ <key>freq</key>
+ <value>1000</value>
+ </param>
+ <param>
+ <key>amp</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>offset</key>
+ <value>0</value>
</param>
<param>
<key>_coordinate</key>
- <value>(10, 10)</value>
+ <value>(15, 98)</value>
</param>
<param>
<key>_rotation</key>
@@ -257,12 +265,6 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sig_source_x_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
- <source_key>0</source_key>
- <sink_key>0</sink_key>
- </connection>
- <connection>
<source_block_id>gr_throttle_0</source_block_id>
<sink_block_id>qtgui_time_sink_x_0</sink_block_id>
<source_key>0</source_key>
@@ -274,4 +276,10 @@
<source_key>0</source_key>
<sink_key>2</sink_key>
</connection>
+ <connection>
+ <source_block_id>analog_sig_source_x_0</source_block_id>
+ <sink_block_id>gr_throttle_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
</flow_graph>
diff --git a/gr-howto-write-a-block/apps/howto_square_qt.py b/gr-howto-write-a-block/apps/howto_square_qt.py
index 0c29ff6088..986f1c7585 100755
--- a/gr-howto-write-a-block/apps/howto_square_qt.py
+++ b/gr-howto-write-a-block/apps/howto_square_qt.py
@@ -2,14 +2,14 @@
##################################################
# Gnuradio Python Flow Graph
# Title: Howto Square Qt
-# Generated: Sun Sep 30 13:32:52 2012
+# Generated: Sat Nov 10 15:23:43 2012
##################################################
from PyQt4 import Qt
+from gnuradio import analog
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import qtgui
-from gnuradio import analog
from gnuradio.eng_option import eng_option
from gnuradio.gr import firdes
from optparse import OptionParser
@@ -50,16 +50,17 @@ class howto_square_qt(gr.top_block, Qt.QWidget):
##################################################
self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
1024, #size
- samp_rate, #bw
+ samp_rate, #samp_rate
"QT GUI Plot", #name
3 #number of inputs
)
+ self.qtgui_time_sink_x_0.set_y_axis(-1, 1)
self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
self.top_layout.addWidget(self._qtgui_time_sink_x_0_win)
self.howto_square_ff_0 = howto.square_ff()
self.howto_square2_ff_0 = howto.square2_ff()
self.gr_throttle_0 = gr.throttle(gr.sizeof_float*1, samp_rate)
- self.gr_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)
+ self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)
##################################################
# Connections
@@ -67,9 +68,9 @@ class howto_square_qt(gr.top_block, Qt.QWidget):
self.connect((self.howto_square2_ff_0, 0), (self.qtgui_time_sink_x_0, 0))
self.connect((self.gr_throttle_0, 0), (self.howto_square2_ff_0, 0))
self.connect((self.gr_throttle_0, 0), (self.howto_square_ff_0, 0))
- self.connect((self.gr_sig_source_x_0, 0), (self.gr_throttle_0, 0))
self.connect((self.gr_throttle_0, 0), (self.qtgui_time_sink_x_0, 1))
self.connect((self.howto_square_ff_0, 0), (self.qtgui_time_sink_x_0, 2))
+ self.connect((self.analog_sig_source_x_0, 0), (self.gr_throttle_0, 0))
# QT sink close method reimplementation
def closeEvent(self, event):
@@ -82,7 +83,8 @@ class howto_square_qt(gr.top_block, Qt.QWidget):
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
- self.gr_sig_source_x_0.set_sampling_freq(self.samp_rate)
+ self.qtgui_time_sink_x_0.set_samp_rate(self.samp_rate)
+ self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
if __name__ == '__main__':
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")