commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r8193 - gnuradio/trunk/gnuradio-core/src/lib/general


From: jcorgan
Subject: [Commit-gnuradio] r8193 - gnuradio/trunk/gnuradio-core/src/lib/general
Date: Sat, 12 Apr 2008 14:03:11 -0600 (MDT)

Author: jcorgan
Date: 2008-04-12 14:03:11 -0600 (Sat, 12 Apr 2008)
New Revision: 8193

Added:
   gnuradio/trunk/gnuradio-core/src/lib/general/gr_cpfsk_bc.cc
   gnuradio/trunk/gnuradio-core/src/lib/general/gr_cpfsk_bc.h
   gnuradio/trunk/gnuradio-core/src/lib/general/gr_cpfsk_bc.i
Modified:
   gnuradio/trunk/gnuradio-core/src/lib/general/Makefile.am
   gnuradio/trunk/gnuradio-core/src/lib/general/general.i
Log:
Addes gr.cpfsk_bc(), a continuous phase frequency shift keying modulator block.

Modified: gnuradio/trunk/gnuradio-core/src/lib/general/Makefile.am
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/general/Makefile.am    2008-04-12 
18:42:06 UTC (rev 8192)
+++ gnuradio/trunk/gnuradio-core/src/lib/general/Makefile.am    2008-04-12 
20:03:11 UTC (rev 8193)
@@ -55,6 +55,7 @@
        gr_correlate_access_code_bb.cc  \
        gr_costas_loop_cc.cc            \
        gr_count_bits.cc                \
+       gr_cpfsk_bc.cc                  \
        gr_crc32.cc                     \
        gr_ctcss_squelch_ff.cc          \
        gr_dd_mpsk_sync_cc.cc           \
@@ -197,7 +198,8 @@
        gr_correlate_access_code_bb.h   \
        gr_costas_loop_cc.h             \
        gr_count_bits.h                 \
-       gr_crc32.h                      \
+       gr_cpfsk_bc.h                   \
+       gr_crc32.h                      \
        gr_ctcss_squelch_ff.h           \
        gr_dd_mpsk_sync_cc.h            \
        gr_diff_decoder_bb.h            \
@@ -352,6 +354,7 @@
        gr_constellation_decoder_cb.i   \
        gr_correlate_access_code_bb.i   \
        gr_costas_loop_cc.i             \
+       gr_cpfsk_bc.i                   \
        gr_crc32.i                      \
        gr_ctcss_squelch_ff.i           \
        gr_dd_mpsk_sync_cc.i            \

Modified: gnuradio/trunk/gnuradio-core/src/lib/general/general.i
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/general/general.i      2008-04-12 
18:42:06 UTC (rev 8192)
+++ gnuradio/trunk/gnuradio-core/src/lib/general/general.i      2008-04-12 
20:03:11 UTC (rev 8193)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2004,2005,2006,2007 Free Software Foundation, Inc.
+ * Copyright 2004,2005,2006,2007,2008 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -130,6 +130,7 @@
 #include <gr_glfsr_source_f.h>
 #include <gr_peak_detector2_fb.h>
 #include <gr_repeat.h>
+#include <gr_cpfsk_bc.h>
 %}
 
 %include "gr_nop.i"
@@ -240,3 +241,4 @@
 %include "gr_glfsr_source_f.i"
 %include "gr_peak_detector2_fb.i"
 %include "gr_repeat.i"
+%include "gr_cpfsk_bc.i"

Added: gnuradio/trunk/gnuradio-core/src/lib/general/gr_cpfsk_bc.cc
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/general/gr_cpfsk_bc.cc                 
        (rev 0)
+++ gnuradio/trunk/gnuradio-core/src/lib/general/gr_cpfsk_bc.cc 2008-04-12 
20:03:11 UTC (rev 8193)
@@ -0,0 +1,78 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ * 
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_cpfsk_bc.h>
+#include <gr_io_signature.h>
+#include <gr_expj.h>
+
+#define M_TWOPI (2*M_PI)
+
+gr_cpfsk_bc_sptr 
+gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym)
+{
+  return gr_cpfsk_bc_sptr(new gr_cpfsk_bc(k, ampl, samples_per_sym));
+}
+
+gr_cpfsk_bc::gr_cpfsk_bc(float k, float ampl, int samples_per_sym)
+  : gr_sync_interpolator("cpfsk_bc",
+                        gr_make_io_signature(1, 1, sizeof(char)),
+                        gr_make_io_signature(1, 1, sizeof(gr_complex)),
+                        samples_per_sym)
+{
+  d_samples_per_sym = samples_per_sym;
+  d_freq = k*M_PI/samples_per_sym;
+  d_ampl = ampl;
+  d_phase = 0.0;
+}
+
+gr_cpfsk_bc::~gr_cpfsk_bc()
+{
+}
+
+int 
+gr_cpfsk_bc::work(int noutput_items,
+                     gr_vector_const_void_star &input_items,
+                     gr_vector_void_star &output_items)
+{
+  const char *in = (const char *)input_items[0];
+  gr_complex *out = (gr_complex *)output_items[0];
+
+  for (int i = 0; i < noutput_items/d_samples_per_sym; i++) {
+    for (int j = 0; j < d_samples_per_sym; j++) {
+      if (in[i] == 1)
+       d_phase += d_freq;
+      else
+       d_phase -= d_freq;
+      
+      while (d_phase > M_TWOPI)
+       d_phase -= M_TWOPI;
+      while (d_phase < -M_TWOPI)
+       d_phase += M_TWOPI;
+      
+      *out++ = gr_expj(d_phase)*d_ampl;
+    }
+  }
+
+  return noutput_items;
+}

Added: gnuradio/trunk/gnuradio-core/src/lib/general/gr_cpfsk_bc.h
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/general/gr_cpfsk_bc.h                  
        (rev 0)
+++ gnuradio/trunk/gnuradio-core/src/lib/general/gr_cpfsk_bc.h  2008-04-12 
20:03:11 UTC (rev 8193)
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ * 
+ * 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_GR_CPFSK_BC_H
+#define INCLUDED_GR_CPFSK_BC_H
+
+#include <gr_sync_interpolator.h>
+
+class gr_cpfsk_bc;
+
+typedef boost::shared_ptr<gr_cpfsk_bc> gr_cpfsk_bc_sptr;
+
+gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym);
+
+/*!
+ * \brief Perform continuous phase 2-level frequncy modulation on an input 
stream
+ * of unpacked bits.
+ * \ingroup modulation
+ *
+ * \param k                     modulation index
+ * \param ampl                 output amplitude
+ * \param samples_per_sym      number of output samples per input bit
+ */
+
+class gr_cpfsk_bc : public gr_sync_interpolator
+{
+private:
+  friend gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int 
samples_per_sym);
+
+  gr_cpfsk_bc(float k, float ampl, int samples_per_sym);
+
+  int   d_samples_per_sym;     // Samples per symbol, square pulse
+  float d_freq;                        // Modulation index*pi/samples_per_sym
+  float d_ampl;                        // Output amplitude
+  float d_phase;               // Current phase
+
+ public:
+  ~gr_cpfsk_bc();
+
+  void set_amplitude(float amplitude) { d_ampl = amplitude; }
+
+  int work (int noutput_items,
+           gr_vector_const_void_star &input_items,
+           gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_CPFSK_BC_H */

Added: gnuradio/trunk/gnuradio-core/src/lib/general/gr_cpfsk_bc.i
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/general/gr_cpfsk_bc.i                  
        (rev 0)
+++ gnuradio/trunk/gnuradio-core/src/lib/general/gr_cpfsk_bc.i  2008-04-12 
20:03:11 UTC (rev 8193)
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,cpfsk_bc);
+
+gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym);
+
+class gr_cpfsk_bc : public gr_sync_interpolator
+{
+private:
+  gr_cpfsk_bc(float k, float ampl, int samples_per_sym);
+
+public:
+  void set_amplitude(float amplitude);
+};





reply via email to

[Prev in Thread] Current Thread [Next in Thread]