summaryrefslogtreecommitdiff
path: root/gr-digital/lib/fll_band_edge_cc_impl.h
blob: 7bec7452627fc6f13eb4fb9b11abae44e6a85de5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* -*- c++ -*- */
/*
 * Copyright 2009,2011,2012 Free Software Foundation, Inc.
 * 
 * This file is part of GNU Radio
 * 
 * GNU Radio is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 * 
 * GNU Radio is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with GNU Radio; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 */

#ifndef INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_IMPL_H
#define	INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_IMPL_H

#include <gnuradio/digital/fll_band_edge_cc.h>
#include <gnuradio/blocks/control_loop.h>
#include <gnuradio/filter/fir_filter.h>

namespace gr {
  namespace digital {

    class fll_band_edge_cc_impl :
      public fll_band_edge_cc
    {
    private:
      float                   d_sps;
      float                   d_rolloff;
      int                     d_filter_size;

      std::vector<gr_complex> d_taps_lower;
      std::vector<gr_complex> d_taps_upper;
      bool		      d_updated;
      std::vector<gr_complex> d_output_hist;
      std::vector<gr_complex> d_fllbuffer;
      gr::filter::kernel::fir_filter_ccc* d_filter_lower;
      gr::filter::kernel::fir_filter_ccc* d_filter_upper;

      /*!
       * Design the band-edge filter based on the number of samples
       * per symbol, filter rolloff factor, and the filter size
       *
       * \param samps_per_sym    (float) Number of samples per symbol of signal
       * \param rolloff          (float) Rolloff factor of signal
       * \param filter_size      (int)   Size (in taps) of the filter
       */
      void design_filter(float samps_per_sym, float rolloff, int filter_size);

    public:
      fll_band_edge_cc_impl(float samps_per_sym, float rolloff,
			   int filter_size, float bandwidth);
      ~fll_band_edge_cc_impl();

      void set_samples_per_symbol(float sps);
      void set_rolloff(float rolloff);
      void set_filter_size(int filter_size);

      float samples_per_symbol() const;
      float rolloff() const;
      int filter_size() const;

      void print_taps();
   
      int work(int noutput_items,
	       gr_vector_const_void_star &input_items,
	       gr_vector_void_star &output_items);
    };

  } /* namespace digital */
} /* namespace gr */

#endif /* INCLUDED_DIGITAL_FLL_BAND_EDGE_CC_IMPL_H */