3 * Copyright 2008 Free Software Foundation, Inc.
5 * GNU Radio is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3, or (at your option)
10 * GNU Radio is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Radio; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street,
18 * Boston, MA 02110-1301, USA.
25 #include <gr_cpfsk_bc.h>
26 #include <gr_io_signature.h>
29 #define M_TWOPI (2*M_PI)
32 gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym)
34 return gr_cpfsk_bc_sptr(new gr_cpfsk_bc(k, ampl, samples_per_sym));
37 gr_cpfsk_bc::gr_cpfsk_bc(float k, float ampl, int samples_per_sym)
38 : gr_sync_interpolator("cpfsk_bc",
39 gr_make_io_signature(1, 1, sizeof(char)),
40 gr_make_io_signature(1, 1, sizeof(gr_complex)),
43 d_samples_per_sym = samples_per_sym;
44 d_freq = k*M_PI/samples_per_sym;
49 gr_cpfsk_bc::~gr_cpfsk_bc()
54 gr_cpfsk_bc::work(int noutput_items,
55 gr_vector_const_void_star &input_items,
56 gr_vector_void_star &output_items)
58 const char *in = (const char *)input_items[0];
59 gr_complex *out = (gr_complex *)output_items[0];
61 for (int i = 0; i < noutput_items/d_samples_per_sym; i++) {
62 for (int j = 0; j < d_samples_per_sym; j++) {
68 while (d_phase > M_TWOPI)
70 while (d_phase < -M_TWOPI)
73 *out++ = gr_expj(d_phase)*d_ampl;