commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10143 - gnuradio/branches/developers/n4hy/pfb_iq_fm/g


From: n4hy
Subject: [Commit-gnuradio] r10143 - gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general
Date: Sat, 20 Dec 2008 11:11:46 -0700 (MST)

Author: n4hy
Date: 2008-12-20 11:11:45 -0700 (Sat, 20 Dec 2008)
New Revision: 10143

Added:
   
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/gr_fmdet_cf.cc
   
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/gr_fmdet_cf.h
   
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/gr_fmdet_cf.i
Modified:
   
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/Makefile.am
Log:
adding fm detector to working branch

Modified: 
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/Makefile.am
       2008-12-20 14:44:03 UTC (rev 10142)
+++ 
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/Makefile.am
       2008-12-20 18:11:45 UTC (rev 10143)
@@ -79,6 +79,7 @@
        gr_float_to_complex.cc          \
        gr_float_to_short.cc            \
        gr_float_to_uchar.cc            \
+       gr_fmdet_cf.c                   \
        gr_frequency_modulator_fc.cc    \
        gr_fxpt.cc                      \
        gr_framer_sink_1.cc             \
@@ -230,6 +231,7 @@
        gr_float_to_complex.h           \
        gr_float_to_short.h             \
        gr_float_to_uchar.h             \
+       gr_fmdet_cf.h                   \
        gr_framer_sink_1.h              \
        gr_frequency_modulator_fc.h     \
        gr_fxpt.h                       \
@@ -394,6 +396,7 @@
        gr_float_to_complex.i           \
        gr_float_to_short.i             \
        gr_float_to_uchar.i             \
+       gr_fmdet_cf.i                   \
        gr_frequency_modulator_fc.i     \
        gr_framer_sink_1.i              \
        gr_glfsr_source_b.i             \

Added: 
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/gr_fmdet_cf.cc
===================================================================
--- 
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/gr_fmdet_cf.cc
                            (rev 0)
+++ 
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/gr_fmdet_cf.cc
    2008-12-20 18:11:45 UTC (rev 10143)
@@ -0,0 +1,88 @@
+/* -*- 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.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_fmdet_cf.h>
+#include <gr_io_signature.h>
+#include <math.h>
+#include <gr_math.h>
+
+#define M_TWOPI (2*M_PI)
+
+gr_fmdet_cf_sptr
+gr_make_fmdet_cf (float samplerate)
+{
+  return gr_fmdet_cf_sptr (new gr_fmdet_cf (samplerate));
+}
+
+gr_fmdet_cf::gr_fmdet_cf (float samplerate)
+  : gr_sync_block ("fmdet_cf",
+                  gr_make_io_signature (1, 1, sizeof (gr_complex)),
+                  gr_make_io_signature (1, 1, sizeof (float))),
+    d_S1(0),d_S2(0),
+    d_S3(0),d_S4(0),d_twelveDeltaT(12.0/samplerate)
+
+{
+}
+
+
+
+int
+gr_fmdet_cf::work (int noutput_items,
+                  gr_vector_const_void_star &input_items,
+                  gr_vector_void_star &output_items)
+{
+  const gr_complex *iptr = (gr_complex *) input_items[0];
+  float *optr = (float *) output_items[0];
+
+  int  size = noutput_items;
+
+  gr_complex Sdot,S0,S1=d_S1,S2=d_S2,S3=d_S3,S4=d_S4;
+
+  while (size-- > 0) {
+    S0=*iptr++;
+
+    Sdot = gr_complex(d_twelveDeltaT*
+                     (-S0.real() + 8.0*S1.real() - 8.0*S3.real() + S4.real()),
+                     d_twelveDeltaT*
+                     (-S0.imag() + 8.0*S1.imag() - 8.0*S3.imag() + S4.imag()));
+    d_freq = (S2.real()*Sdot.imag()-S2.imag()*Sdot.real())/
+      (S2.real()*S2.real()+S2.imag()*S2.imag());
+
+    S4=S3;
+    S3=S2;
+    S2=S1;
+    S1=S0;
+
+    
+    *optr++ = d_freq;
+  }
+  d_S1=S1;
+  d_S2=S2;
+  d_S3=S3;
+  d_S4=S4;
+  return noutput_items;
+}

Added: 
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/gr_fmdet_cf.h
===================================================================
--- 
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/gr_fmdet_cf.h
                             (rev 0)
+++ 
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/gr_fmdet_cf.h
     2008-12-20 18:11:45 UTC (rev 10143)
@@ -0,0 +1,57 @@
+/* -*- 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.
+ */
+
+#ifndef INCLUDED_GR_FMDET_CF_H
+#define INCLUDED_GR_FMDET_CF_H
+
+#include <gr_sync_block.h>
+
+class gr_fmdet_cf;
+typedef boost::shared_ptr<gr_fmdet_cf> gr_fmdet_cf_sptr;
+
+gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate);
+
+/*!
+ * \brief Implements a IQ slope detector
+ * 
+ *
+ * input: stream of complex; output: stream of floats
+ *
+ * This implements a limiting slope detector.  The limiter is in the
+ * normalization by the magnitude of the sample 
+ */
+
+class gr_fmdet_cf : public gr_sync_block
+{
+  friend gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate);
+
+  gr_complex d_S1,d_S2,d_S3,d_S4;
+  float d_freq,d_twelveDeltaT;
+  gr_fmdet_cf (float samplerate);
+
+  int work (int noutput_items,
+           gr_vector_const_void_star &input_items,
+           gr_vector_void_star &output_items);
+
+};
+
+#endif

Added: 
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/gr_fmdet_cf.i
===================================================================
--- 
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/gr_fmdet_cf.i
                             (rev 0)
+++ 
gnuradio/branches/developers/n4hy/pfb_iq_fm/gnuradio-core/src/lib/general/gr_fmdet_cf.i
     2008-12-20 18:11:45 UTC (rev 10143)
@@ -0,0 +1,31 @@
+/* -*- 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,fmdet_cf)
+
+gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate);
+
+class gr_fmdet_cf : public gr_sync_block
+{
+ private:
+  gr_fmdet_cf (float samplerate);
+};





reply via email to

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