[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 03/16: analog: Added frequency accessor and
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 03/16: analog: Added frequency accessor and modifier to CTCSS squelch |
Date: |
Sun, 29 Mar 2015 02:27:25 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 0b8122391963e423ca4b291a49431ffc401cafd1
Author: Jon Szymaniak <address@hidden>
Date: Tue Feb 3 15:04:10 2015 -0500
analog: Added frequency accessor and modifier to CTCSS squelch
---
gr-analog/grc/analog_ctcss_squelch_ff.xml | 1 +
.../include/gnuradio/analog/ctcss_squelch_ff.h | 2 ++
gr-analog/lib/ctcss_squelch_ff_impl.cc | 22 +++++++++++++++++-----
gr-analog/lib/ctcss_squelch_ff_impl.h | 10 ++++++++++
4 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/gr-analog/grc/analog_ctcss_squelch_ff.xml
b/gr-analog/grc/analog_ctcss_squelch_ff.xml
index 9585835..7a2248a 100644
--- a/gr-analog/grc/analog_ctcss_squelch_ff.xml
+++ b/gr-analog/grc/analog_ctcss_squelch_ff.xml
@@ -32,6 +32,7 @@
<import>from gnuradio import analog</import>
<make>analog.ctcss_squelch_ff($rate, $freq, $level, $len, $ramp,
$gate)</make>
<callback>set_level($level)</callback>
+ <callback>set_frequency($freq)</callback>
<param>
<name>Sampling Rate (Hz)</name>
<key>rate</key>
diff --git a/gr-analog/include/gnuradio/analog/ctcss_squelch_ff.h
b/gr-analog/include/gnuradio/analog/ctcss_squelch_ff.h
index 6d1b529..2655c84 100644
--- a/gr-analog/include/gnuradio/analog/ctcss_squelch_ff.h
+++ b/gr-analog/include/gnuradio/analog/ctcss_squelch_ff.h
@@ -63,6 +63,8 @@ namespace gr {
virtual float level() const = 0;
virtual void set_level(float level) = 0;
virtual int len() const = 0;
+ virtual float frequency() const = 0;
+ virtual void set_frequency(float frequency) = 0;
virtual int ramp() const = 0;
virtual void set_ramp(int ramp) = 0;
diff --git a/gr-analog/lib/ctcss_squelch_ff_impl.cc
b/gr-analog/lib/ctcss_squelch_ff_impl.cc
index a82ca46..fb34485 100644
--- a/gr-analog/lib/ctcss_squelch_ff_impl.cc
+++ b/gr-analog/lib/ctcss_squelch_ff_impl.cc
@@ -74,6 +74,17 @@ namespace gr {
f_r = ctcss_tones[i+1];
}
+ void
+ ctcss_squelch_ff_impl::update_fft_params()
+ {
+ float f_l, f_r;
+ compute_freqs(d_freq, f_l, f_r);
+
+ d_goertzel_l->set_params(d_rate, d_len, f_l);
+ d_goertzel_c->set_params(d_rate, d_len, d_freq);
+ d_goertzel_r->set_params(d_rate, d_len, f_r);
+ }
+
ctcss_squelch_ff_impl::ctcss_squelch_ff_impl(int rate, float freq, float
level,
int len, int ramp, bool gate)
: block("ctcss_squelch_ff",
@@ -83,19 +94,20 @@ namespace gr {
{
d_freq = freq;
d_level = level;
+ d_rate = rate;
// Default is 100 ms detection time
if(len == 0)
- d_len = (int)(rate/10.0);
+ d_len = (int)(d_rate/10.0);
else
- d_len = len;
+ d_len = len;
float f_l, f_r;
compute_freqs(d_freq, f_l, f_r);
- d_goertzel_l = new fft::goertzel(rate, d_len, f_l);
- d_goertzel_c = new fft::goertzel(rate, d_len, freq);
- d_goertzel_r = new fft::goertzel(rate, d_len, f_r);
+ d_goertzel_l = new fft::goertzel(d_rate, d_len, f_l);
+ d_goertzel_c = new fft::goertzel(d_rate, d_len, freq);
+ d_goertzel_r = new fft::goertzel(d_rate, d_len, f_r);
d_mute = true;
}
diff --git a/gr-analog/lib/ctcss_squelch_ff_impl.h
b/gr-analog/lib/ctcss_squelch_ff_impl.h
index 6a137e0..67ce66c 100644
--- a/gr-analog/lib/ctcss_squelch_ff_impl.h
+++ b/gr-analog/lib/ctcss_squelch_ff_impl.h
@@ -36,6 +36,7 @@ namespace gr {
float d_freq;
float d_level;
int d_len;
+ int d_rate;
bool d_mute;
fft::goertzel *d_goertzel_l;
@@ -45,6 +46,8 @@ namespace gr {
static int find_tone(float freq);
static void compute_freqs(const float &freq, float &f_l, float &f_r);
+ void update_fft_params();
+
protected:
virtual void update_state(const float &in);
virtual bool mute() const { return d_mute; }
@@ -58,6 +61,13 @@ namespace gr {
float level() const { return d_level; }
void set_level(float level) { d_level = level; }
int len() const { return d_len; }
+ float frequency() const { return d_freq; }
+
+ void set_frequency(float frequency)
+ {
+ d_freq = frequency;
+ update_fft_params();
+ }
int ramp() const { return squelch_base_ff_impl::ramp(); }
void set_ramp(int ramp) { squelch_base_ff_impl::set_ramp(ramp); }
- [Commit-gnuradio] [gnuradio] branch master updated (28ba7e4 -> 72c11a0), git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 10/16: gr-uhd: support for IQ imbalance enable/disable, git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 15/16: Merge remote-tracking branch 'jarn0ld/jarn0ld/uhd-iq-imbalance-on-off', git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 08/16: analog: Wrapped squelch blocks' setter methods with lock, git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 03/16: analog: Added frequency accessor and modifier to CTCSS squelch,
git <=
- [Commit-gnuradio] [gnuradio] 06/16: filter: exporting IIR filter kernels from library., git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 14/16: Merge remote-tracking branch 'drmpeg/dvb-s2', git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 01/16: analog: Made CTCSS squelch find_tone() a static member function, git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 13/16: Merge remote-tracking branch 'tom/iir_filter_stability', git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 11/16: gr-dtv: Fix ATSC compile issue as reported on mailing list., git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 12/16: Merge remote-tracking branch 'jynik/ctcss_squelch_add_freq_getset', git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 16/16: Merge remote-tracking branch 'drmpeg/atsc-fix', git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 05/16: docs: adding better docs for using IIR kernels., git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 09/16: gr-dtv: Add DVB-S2 transmitter update., git, 2015/03/28
- [Commit-gnuradio] [gnuradio] 02/16: analog: Moved CTCSS squelch FFT parameter calculations, git, 2015/03/28