aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri Stolnikov <horiz0n@gmx.net>2012-04-11 23:40:27 +0200
committerDimitri Stolnikov <horiz0n@gmx.net>2012-04-11 23:40:27 +0200
commit3ddcdbd8b83bebfc9c7005b65dc40f71f756cf6f (patch)
tree3bab18d28b1bb48156cf9285bcfb723885ef1609
parent619d7a5a8b7a442f565bf92fa534738f9ac40e97 (diff)
update GRC integration
-rw-r--r--apps/osmosdr_source.grc177
-rwxr-xr-xapps/osmosdr_source.py21
-rw-r--r--grc/osmosdr_sink_c.xml2
-rw-r--r--grc/osmosdr_source_c.xml52
4 files changed, 179 insertions, 73 deletions
diff --git a/apps/osmosdr_source.grc b/apps/osmosdr_source.grc
index e661ae1..446f015 100644
--- a/apps/osmosdr_source.grc
+++ b/apps/osmosdr_source.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Fri Apr 6 15:57:44 2012</timestamp>
+ <timestamp>Wed Apr 11 17:53:04 2012</timestamp>
<block>
<key>options</key>
<param>
@@ -57,29 +57,6 @@
</param>
</block>
<block>
- <key>variable</key>
- <param>
- <key>id</key>
- <value>samp_rate</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>value</key>
- <value>2048e3</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(39, 137)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>variable_slider</key>
<param>
<key>id</key>
@@ -135,41 +112,6 @@
</param>
</block>
<block>
- <key>osmosdr_source_c</key>
- <param>
- <key>id</key>
- <value>osmosdr_source_c_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>args</key>
- <value></value>
- </param>
- <param>
- <key>freq</key>
- <value>freq</value>
- </param>
- <param>
- <key>rate</key>
- <value>samp_rate</value>
- </param>
- <param>
- <key>gain</key>
- <value>gain</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(284, 297)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>variable_slider</key>
<param>
<key>id</key>
@@ -311,6 +253,123 @@
<value>0</value>
</param>
</block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>samplerate</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(39, 137)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>osmosdr_source_c</key>
+ <param>
+ <key>id</key>
+ <value>osmosdr_source_c_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>args</key>
+ <value></value>
+ </param>
+ <param>
+ <key>freq</key>
+ <value>freq</value>
+ </param>
+ <param>
+ <key>freq_corr</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>rate</key>
+ <value>samplerate</value>
+ </param>
+ <param>
+ <key>gain</key>
+ <value>gain</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(278, 276)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_slider</key>
+ <param>
+ <key>id</key>
+ <value>samplerate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value></value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>2048e3</value>
+ </param>
+ <param>
+ <key>min</key>
+ <value>1e6</value>
+ </param>
+ <param>
+ <key>max</key>
+ <value>3.2e6</value>
+ </param>
+ <param>
+ <key>num_steps</key>
+ <value>100</value>
+ </param>
+ <param>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value></value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(40, 237)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
<connection>
<source_block_id>osmosdr_source_c_0</source_block_id>
<sink_block_id>wxgui_fftsink2_0</sink_block_id>
diff --git a/apps/osmosdr_source.py b/apps/osmosdr_source.py
index f2ed63d..e7c3120 100755
--- a/apps/osmosdr_source.py
+++ b/apps/osmosdr_source.py
@@ -22,14 +22,15 @@ class osmosdr_source_c(grc_wxgui.top_block_gui):
self.src = osmosdr.source_c()
- self.src.set_samp_rate(1024000)
- self.src.set_center_freq(392.8e6)
+ self.src.set_sample_rate(1024000)
+ self.src.set_center_freq(394.5e6)
self.src.set_gain(10)
##################################################
# Variables
##################################################
- self.samp_rate = samp_rate = self.src.get_samp_rate()
+ self.sample_rate = self.src.get_sample_rate()
+ self.center_freq = self.src.get_center_freq()
##################################################
# Blocks
@@ -37,11 +38,12 @@ class osmosdr_source_c(grc_wxgui.top_block_gui):
self.sink = fftsink2.fft_sink_c(
self.GetWin(),
fft_size=1024,
- sample_rate=samp_rate,
+ baseband_freq=self.center_freq,
+ sample_rate=self.sample_rate,
ref_scale=2.0,
ref_level=0,
y_divs=10,
- fft_rate=15,
+ fft_rate=10,
average=False,
avg_alpha=0.5
)
@@ -53,10 +55,13 @@ class osmosdr_source_c(grc_wxgui.top_block_gui):
##################################################
self.connect((self.src, 0), (self.sink, 0))
+ def set_sample_rate(self, sample_rate):
+ self.sample_rate = sample_rate
+ self.sink.set_sample_rate(self.sample_rate)
- def set_samp_rate(self, samp_rate):
- self.samp_rate = samp_rate
- self.sink.set_sample_rate(self.samp_rate)
+ def set_center_freq(self, center_freq):
+ self.center_freq = center_freq
+ self.sink.set_center_freq(self.center_freq)
if __name__ == '__main__':
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
diff --git a/grc/osmosdr_sink_c.xml b/grc/osmosdr_sink_c.xml
index 727abb2..a50cef7 100644
--- a/grc/osmosdr_sink_c.xml
+++ b/grc/osmosdr_sink_c.xml
@@ -5,9 +5,9 @@
<category>OsmoSDR</category>
<import>import osmosdr</import>
<make>osmosdr.sink_c()</make>
-
<sink>
<name>in</name>
<type>complex</type>
+ <nports>1</nports>
</sink>
</block>
diff --git a/grc/osmosdr_source_c.xml b/grc/osmosdr_source_c.xml
index 6d8cb15..e343e77 100644
--- a/grc/osmosdr_source_c.xml
+++ b/grc/osmosdr_source_c.xml
@@ -5,15 +5,19 @@
<category>OsmoSDR</category>
<import>import osmosdr</import>
<make>osmosdr.source_c($args)
+self.$(id).set_sample_rate($rate)
self.$(id).set_center_freq($freq)
-self.$(id).set_samp_rate($rate)
+self.$(id).set_freq_corr($corr)
self.$(id).set_gain($gain)
+self.$(id).set_antenna($antenna)
</make>
<callback>set_center_freq($freq)</callback>
- <callback>set_samp_rate($rate)</callback>
+ <callback>set_freq_corr($corr)</callback>
+ <callback>set_sample_rate($rate)</callback>
<callback>set_gain($gain)</callback>
+ <callback>set_antenna($antenna)</callback>
<param>
- <name>Device specific arguments</name>
+ <name>Device arguments</name>
<key>args</key>
<value></value>
<type>string</type>
@@ -25,9 +29,15 @@ self.$(id).set_gain($gain)
<type>real</type>
</param>
<param>
- <name>Samplerate (Hz)</name>
+ <name>Freq. corr. (ppm)</name>
+ <key>corr</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Sample rate (Hz)</name>
<key>rate</key>
- <value>2048000</value>
+ <value>1024000</value>
<type>real</type>
</param>
<param>
@@ -36,9 +46,41 @@ self.$(id).set_gain($gain)
<value>20.0</value>
<type>real</type>
</param>
+ <param>
+ <name>Antenna</name>
+ <key>antenna</key>
+ <value></value>
+ <type>string</type>
+ </param>
<check>($freq &gt;= 50e6) and ($freq &lt;= 2.2e9)</check>
+ <check>($rate &gt;= 1e6) and ($rate &lt;= 3.2e6)</check>
<source>
<name>out</name>
<type>complex</type>
+ <nports>1</nports>
</source>
+ <doc>
+The OsmoSDR Source Block:
+
+Device Arguments:
+The device address is a delimited string used to locate devices on your system.
+Use the device address to specify a specific device or list of devices.
+If left blank, the first device found will be used.
+
+Frequency:
+The center frequency is the overall frequency of the RF chain.
+
+Frequency correction:
+The frequency correction factor in parts per million (ppm).
+
+Sample rate:
+The sample rate is the number of samples per second output by this block.
+
+Gain:
+Overall RF gain of the device.
+
+Antenna:
+For devices with only one antenna, this may be left blank.
+Otherwise, the user should specify one of the possible antenna choices.
+ </doc>
</block>