update GRC integration

gr3.6
Dimitri Stolnikov 11 years ago
parent 619d7a5a8b
commit 3ddcdbd8b8
  1. 177
      apps/osmosdr_source.grc
  2. 21
      apps/osmosdr_source.py
  3. 2
      grc/osmosdr_sink_c.xml
  4. 52
      grc/osmosdr_source_c.xml

@ -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>
@ -56,29 +56,6 @@
<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>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>
@ -134,41 +111,6 @@
<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>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>
@ -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>

@ -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]")

@ -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>

@ -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>

Loading…
Cancel
Save