[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 03/11: analog: enable setting max dev. duri
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 03/11: analog: enable setting max dev. during runtime for NBFM transmitter and receiver hier_blocks. |
Date: |
Sun, 17 Jan 2016 18:02:47 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch maint
in repository gnuradio.
commit 32d1d46c7b6404a2b36d37ebfdc7f4afd88e4d6f
Author: Tom Rondeau <address@hidden>
Date: Wed Jan 6 17:04:20 2016 -0500
analog: enable setting max dev. during runtime for NBFM transmitter
and receiver hier_blocks.
Also fixes up the XML files to allow for the callback along with
indent formatting.
---
gr-analog/grc/analog_nbfm_rx.xml | 80 +++++++++++++++++++++-----------------
gr-analog/grc/analog_nbfm_tx.xml | 80 +++++++++++++++++++++-----------------
gr-analog/python/analog/nbfm_rx.py | 8 +++-
gr-analog/python/analog/nbfm_tx.py | 9 ++++-
4 files changed, 101 insertions(+), 76 deletions(-)
diff --git a/gr-analog/grc/analog_nbfm_rx.xml b/gr-analog/grc/analog_nbfm_rx.xml
index fca1d3a..9250b77 100644
--- a/gr-analog/grc/analog_nbfm_rx.xml
+++ b/gr-analog/grc/analog_nbfm_rx.xml
@@ -5,44 +5,52 @@
###################################################
-->
<block>
- <name>NBFM Receive</name>
- <key>analog_nbfm_rx</key>
- <import>from gnuradio import analog</import>
- <make>analog.nbfm_rx(
+ <name>NBFM Receive</name>
+ <key>analog_nbfm_rx</key>
+ <import>from gnuradio import analog</import>
+ <make>analog.nbfm_rx(
audio_rate=$audio_rate,
quad_rate=$quad_rate,
tau=$tau,
max_dev=$max_dev,
-)</make>
- <param>
- <name>Audio Rate</name>
- <key>audio_rate</key>
- <type>int</type>
- </param>
- <param>
- <name>Quadrature Rate</name>
- <key>quad_rate</key>
- <type>int</type>
- </param>
- <param>
- <name>Tau</name>
- <key>tau</key>
- <value>75e-6</value>
- <type>real</type>
- </param>
- <param>
- <name>Max Deviation</name>
- <key>max_dev</key>
- <value>5e3</value>
- <type>real</type>
- </param>
- <check>($quad_rate)%($audio_rate) == 0</check>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
+ )</make>
+ <callback>set_max_deviation($max_dev)</callback>
+
+ <param>
+ <name>Audio Rate</name>
+ <key>audio_rate</key>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Quadrature Rate</name>
+ <key>quad_rate</key>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Tau</name>
+ <key>tau</key>
+ <value>75e-6</value>
+ <type>real</type>
+ </param>
+
+ <param>
+ <name>Max Deviation</name>
+ <key>max_dev</key>
+ <value>5e3</value>
+ <type>real</type>
+ </param>
+
+ <check>($quad_rate)%($audio_rate) == 0</check>
+
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
</block>
diff --git a/gr-analog/grc/analog_nbfm_tx.xml b/gr-analog/grc/analog_nbfm_tx.xml
index 0ec4f48..ea13b8f 100644
--- a/gr-analog/grc/analog_nbfm_tx.xml
+++ b/gr-analog/grc/analog_nbfm_tx.xml
@@ -5,44 +5,52 @@
###################################################
-->
<block>
- <name>NBFM Transmit</name>
- <key>analog_nbfm_tx</key>
- <import>from gnuradio import analog</import>
- <make>analog.nbfm_tx(
+ <name>NBFM Transmit</name>
+ <key>analog_nbfm_tx</key>
+ <import>from gnuradio import analog</import>
+ <make>analog.nbfm_tx(
audio_rate=$audio_rate,
quad_rate=$quad_rate,
tau=$tau,
max_dev=$max_dev,
-)</make>
- <param>
- <name>Audio Rate</name>
- <key>audio_rate</key>
- <type>int</type>
- </param>
- <param>
- <name>Quadrature Rate</name>
- <key>quad_rate</key>
- <type>int</type>
- </param>
- <param>
- <name>Tau</name>
- <key>tau</key>
- <value>75e-6</value>
- <type>real</type>
- </param>
- <param>
- <name>Max Deviation</name>
- <key>max_dev</key>
- <value>5e3</value>
- <type>real</type>
- </param>
- <check>($quad_rate)%($audio_rate) == 0</check>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
+ )</make>
+ <callback>set_max_deviation($max_dev)</callback>
+
+ <param>
+ <name>Audio Rate</name>
+ <key>audio_rate</key>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Quadrature Rate</name>
+ <key>quad_rate</key>
+ <type>int</type>
+ </param>
+
+ <param>
+ <name>Tau</name>
+ <key>tau</key>
+ <value>75e-6</value>
+ <type>real</type>
+ </param>
+
+ <param>
+ <name>Max Deviation</name>
+ <key>max_dev</key>
+ <value>5e3</value>
+ <type>real</type>
+ </param>
+
+ <check>($quad_rate)%($audio_rate) == 0</check>
+
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
</block>
diff --git a/gr-analog/python/analog/nbfm_rx.py
b/gr-analog/python/analog/nbfm_rx.py
index b2c86db..38fbf80 100644
--- a/gr-analog/python/analog/nbfm_rx.py
+++ b/gr-analog/python/analog/nbfm_rx.py
@@ -57,8 +57,8 @@ class nbfm_rx(gr.hier_block2):
gr.io_signature(1, 1, gr.sizeof_float)) #
Output signature
# FIXME audio_rate and quad_rate ought to be exact rationals
- audio_rate = int(audio_rate)
- quad_rate = int(quad_rate)
+ self._audio_rate = audio_rate = int(audio_rate)
+ self._quad_rate = quad_rate = int(quad_rate)
if quad_rate % audio_rate != 0:
raise ValueError, "quad_rate is not an integer multiple of
audio_rate"
@@ -88,3 +88,7 @@ class nbfm_rx(gr.hier_block2):
self.audio_filter = filter.fir_filter_fff(audio_decim, audio_taps)
self.connect(self, self.quad_demod, self.deemph, self.audio_filter,
self)
+
+ def set_max_deviation(self, max_dev):
+ k = self._quad_rate/(2*math.pi*max_dev)
+ self.quad_demod.set_gain(k)
diff --git a/gr-analog/python/analog/nbfm_tx.py
b/gr-analog/python/analog/nbfm_tx.py
index 62b56ba..ffd539e 100644
--- a/gr-analog/python/analog/nbfm_tx.py
+++ b/gr-analog/python/analog/nbfm_tx.py
@@ -50,8 +50,8 @@ class nbfm_tx(gr.hier_block2):
gr.io_signature(1, 1, gr.sizeof_gr_complex)) #
Output signature
# FIXME audio_rate and quad_rate ought to be exact rationals
- audio_rate = int(audio_rate)
- quad_rate = int(quad_rate)
+ self._audio_rate = audio_rate = int(audio_rate)
+ self._quad_rate = quad_rate = int(quad_rate)
if quad_rate % audio_rate != 0:
raise ValueError, "quad_rate is not an integer multiple of
audio_rate"
@@ -81,6 +81,11 @@ class nbfm_tx(gr.hier_block2):
else:
self.connect(self, self.preemph, self.modulator, self)
+ def set_max_deviation(self, max_dev):
+ k = 2 * math.pi * max_dev / self._quad_rate
+ self.modulator.set_sensitivity(k)
+
+
class ctcss_gen_f(gr.hier_block2):
def __init__(self, sample_rate, tone_freq):
- [Commit-gnuradio] [gnuradio] branch maint updated (dec480a -> 4ce1d49), git, 2016/01/17
- [Commit-gnuradio] [gnuradio] 08/11: Merge remote-tracking branch 'tom/issue812' into maint, git, 2016/01/17
- [Commit-gnuradio] [gnuradio] 11/11: Merge remote-tracking branch 'gnuradio-wg-grc/maint_grcwg' into maint, git, 2016/01/17
- [Commit-gnuradio] [gnuradio] 04/11: gru: Fixes an obsolete numpy function call., git, 2016/01/17
- [Commit-gnuradio] [gnuradio] 02/11: analog: Addresses issue #831., git, 2016/01/17
- [Commit-gnuradio] [gnuradio] 03/11: analog: enable setting max dev. during runtime for NBFM transmitter and receiver hier_blocks.,
git <=
- [Commit-gnuradio] [gnuradio] 05/11: digital: Addresses issue #812., git, 2016/01/17
- [Commit-gnuradio] [gnuradio] 06/11: Updated URL to UHD manual in USRP sink and source blocks, git, 2016/01/17
- [Commit-gnuradio] [gnuradio] 10/11: Merge remote-tracking branch 'dkozel/fix-uhd-manual-url' into maint, git, 2016/01/17
- [Commit-gnuradio] [gnuradio] 09/11: gr-utils: Update error message, git, 2016/01/17
- [Commit-gnuradio] [gnuradio] 07/11: Merge remote-tracking branch 'tom/nbfm' into maint, git, 2016/01/17
- [Commit-gnuradio] [gnuradio] 01/11: grc: fix 'Parser errors' menu item, git, 2016/01/17