summaryrefslogtreecommitdiff
path: root/gnuradio-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_refout_cc.cc23
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_refout_cc.h20
-rw-r--r--gnuradio-core/src/lib/general/gr_pll_refout_cc.i10
3 files changed, 22 insertions, 31 deletions
diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc
index 8a7fbf88b..8968cd3f1 100644
--- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc
+++ b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,8 +20,6 @@
* Boston, MA 02110-1301, USA.
*/
-// WARNING: this file is machine generated. Edits will be over written
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -35,18 +33,16 @@
#define M_TWOPI (2*M_PI)
gr_pll_refout_cc_sptr
-gr_make_pll_refout_cc (float alpha, float beta, float max_freq, float min_freq)
+gr_make_pll_refout_cc (float loop_bw, float max_freq, float min_freq)
{
- return gnuradio::get_initial_sptr(new gr_pll_refout_cc (alpha, beta, max_freq, min_freq));
+ return gnuradio::get_initial_sptr(new gr_pll_refout_cc (loop_bw, max_freq, min_freq));
}
-gr_pll_refout_cc::gr_pll_refout_cc (float alpha, float beta, float max_freq, float min_freq)
+gr_pll_refout_cc::gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq)
: gr_sync_block ("pll_refout_cc",
gr_make_io_signature (1, 1, sizeof (gr_complex)),
gr_make_io_signature (1, 1, sizeof (gr_complex))),
- d_alpha(alpha), d_beta(beta),
- d_max_freq(max_freq), d_min_freq(min_freq),
- d_phase(0), d_freq((max_freq+min_freq)/2)
+ gri_control_loop(loop_bw, max_freq, min_freq)
{
}
@@ -84,13 +80,10 @@ gr_pll_refout_cc::work (int noutput_items,
while (size-- > 0) {
error = phase_detector(*iptr++,d_phase);
- d_freq = d_freq + d_beta * error;
- d_phase = mod_2pi(d_phase + d_freq + d_alpha * error);
+ advance_loop(error);
+ phase_wrap();
+ frequency_limit();
- if (d_freq > d_max_freq)
- d_freq = d_max_freq;
- else if (d_freq < d_min_freq)
- d_freq = d_min_freq;
gr_sincosf(d_phase,&t_imag,&t_real);
*optr++ = gr_complex(t_real,t_imag);
}
diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.h b/gnuradio-core/src/lib/general/gr_pll_refout_cc.h
index 3263c957f..226ca8f9e 100644
--- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.h
+++ b/gnuradio-core/src/lib/general/gr_pll_refout_cc.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,18 +20,17 @@
* Boston, MA 02110-1301, USA.
*/
-
-
#ifndef INCLUDED_GR_PLL_REFOUT_CC_H
#define INCLUDED_GR_PLL_REFOUT_CC_H
#include <gr_sync_block.h>
+#include <gri_control_loop.h>
class gr_pll_refout_cc;
typedef boost::shared_ptr<gr_pll_refout_cc> gr_pll_refout_cc_sptr;
-gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float alpha, float beta,
- float max_freq, float min_freq);
+gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw,
+ float max_freq, float min_freq);
/*!
* \brief Implements a PLL which locks to the input frequency and outputs a carrier
* \ingroup sync_blk
@@ -47,20 +46,19 @@ gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float alpha, float beta,
* and beta is the frequency gain (second order, units of radians per sample per radian)
* \sa gr_pll_freqdet_cf, gr_pll_carriertracking_cc
*/
-class gr_pll_refout_cc : public gr_sync_block
+class gr_pll_refout_cc : public gr_sync_block, public gri_control_loop
{
- friend gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float alpha, float beta,
- float max_freq, float min_freq);
+ friend gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw,
+ float max_freq, float min_freq);
- float d_alpha,d_beta,d_max_freq,d_min_freq,d_phase,d_freq;
- gr_pll_refout_cc (float alpha, float beta, float max_freq, float min_freq);
+ gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq);
int work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
private:
float mod_2pi (float in);
- float phase_detector(gr_complex sample,float ref_phase);
+ float phase_detector(gr_complex sample, float ref_phase);
};
#endif
diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.i b/gnuradio-core/src/lib/general/gr_pll_refout_cc.i
index 026a684ed..834ea1e36 100644
--- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.i
+++ b/gnuradio-core/src/lib/general/gr_pll_refout_cc.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005 Free Software Foundation, Inc.
+ * Copyright 2005,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -22,11 +22,11 @@
GR_SWIG_BLOCK_MAGIC(gr,pll_refout_cc)
- gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float alpha, float beta,
- float max_freq, float min_freq);
+gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw,
+ float max_freq, float min_freq);
-class gr_pll_refout_cc : public gr_sync_block
+class gr_pll_refout_cc : public gr_sync_block, public gri_control_loop
{
private:
- gr_pll_refout_cc (float alpha, float beta, float max_freq, float min_freq);
+ gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq);
};