Statistics
| Branch: | Tag: | Revision:

root / gnuradio-core / src / lib / general / gr_pll_freqdet_cf.h @ c7dbfcc7

History | View | Annotate | Download (2.3 kB)

1 5d69a524 jcorgan
/* -*- c++ -*- */
2 5d69a524 jcorgan
/*
3 5d69a524 jcorgan
 * Copyright 2004 Free Software Foundation, Inc.
4 5d69a524 jcorgan
 * 
5 5d69a524 jcorgan
 * This file is part of GNU Radio
6 5d69a524 jcorgan
 * 
7 5d69a524 jcorgan
 * GNU Radio is free software; you can redistribute it and/or modify
8 5d69a524 jcorgan
 * it under the terms of the GNU General Public License as published by
9 5d69a524 jcorgan
 * the Free Software Foundation; either version 2, or (at your option)
10 5d69a524 jcorgan
 * any later version.
11 5d69a524 jcorgan
 * 
12 5d69a524 jcorgan
 * GNU Radio is distributed in the hope that it will be useful,
13 5d69a524 jcorgan
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 5d69a524 jcorgan
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 5d69a524 jcorgan
 * GNU General Public License for more details.
16 5d69a524 jcorgan
 * 
17 5d69a524 jcorgan
 * You should have received a copy of the GNU General Public License
18 5d69a524 jcorgan
 * along with GNU Radio; see the file COPYING.  If not, write to
19 86f5c924 eb
 * the Free Software Foundation, Inc., 51 Franklin Street,
20 86f5c924 eb
 * Boston, MA 02110-1301, USA.
21 5d69a524 jcorgan
 */
22 5d69a524 jcorgan
23 5d69a524 jcorgan
#ifndef INCLUDED_GR_PLL_FREQDET_CF_H
24 5d69a524 jcorgan
#define INCLUDED_GR_PLL_FREQDET_CF_H
25 5d69a524 jcorgan
26 5d69a524 jcorgan
#include <gr_sync_block.h>
27 5d69a524 jcorgan
28 5d69a524 jcorgan
class gr_pll_freqdet_cf;
29 5d69a524 jcorgan
typedef boost::shared_ptr<gr_pll_freqdet_cf> gr_pll_freqdet_cf_sptr;
30 5d69a524 jcorgan
31 5d69a524 jcorgan
gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float alpha, float beta,
32 5d69a524 jcorgan
                                               float max_freq, float min_freq);
33 5d69a524 jcorgan
/*!
34 5d69a524 jcorgan
 * \brief Implements a PLL which locks to the input frequency and outputs 
35 5d69a524 jcorgan
 * an estimate of that frequency.  Useful for FM Demod.
36 5d69a524 jcorgan
 * \ingroup block
37 5d69a524 jcorgan
 *
38 5d69a524 jcorgan
 * input: stream of complex; output: stream of floats
39 5d69a524 jcorgan
 *
40 5d69a524 jcorgan
 * This PLL locks onto a [possibly noisy] reference carrier on
41 5d69a524 jcorgan
 * the input and outputs an estimate of that frequency in radians per sample.
42 5d69a524 jcorgan
 * All settings max_freq and min_freq are in terms of radians per sample, 
43 5d69a524 jcorgan
 * NOT HERTZ.  Alpha is the phase gain (first order, units of radians per radian) 
44 5d69a524 jcorgan
 * and beta is the frequency gain (second order, units of radians per sample per radian)
45 5d69a524 jcorgan
 * \sa gr_pll_refout_cc, gr_pll_carriertracking_cc
46 5d69a524 jcorgan
 */
47 5d69a524 jcorgan
48 5d69a524 jcorgan
class gr_pll_freqdet_cf : public gr_sync_block
49 5d69a524 jcorgan
{
50 5d69a524 jcorgan
  friend gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float alpha, float beta,
51 5d69a524 jcorgan
                                                        float max_freq, float min_freq);
52 5d69a524 jcorgan
53 5d69a524 jcorgan
  float d_alpha,d_beta,d_max_freq,d_min_freq,d_phase,d_freq;
54 5d69a524 jcorgan
  gr_pll_freqdet_cf (float alpha, float beta, float max_freq, float min_freq);
55 5d69a524 jcorgan
56 5d69a524 jcorgan
  int work (int noutput_items,
57 5d69a524 jcorgan
            gr_vector_const_void_star &input_items,
58 5d69a524 jcorgan
            gr_vector_void_star &output_items);
59 5d69a524 jcorgan
private:
60 5d69a524 jcorgan
  float mod_2pi (float in);
61 5d69a524 jcorgan
  float phase_detector(gr_complex sample,float ref_phase);
62 5d69a524 jcorgan
};
63 5d69a524 jcorgan
64 5d69a524 jcorgan
#endif