summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-core/src/lib/general/gr_cpm.cc3
-rw-r--r--gnuradio-core/src/lib/general/gr_cpm.h4
-rw-r--r--gnuradio-core/src/lib/general/gr_cpm.i2
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_cpm.cc2
-rw-r--r--gnuradio-core/src/lib/hier/gr_cpmmod_bc.cc2
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_cpm.py6
6 files changed, 10 insertions, 9 deletions
diff --git a/gnuradio-core/src/lib/general/gr_cpm.cc b/gnuradio-core/src/lib/general/gr_cpm.cc
index f2d032a22..a00526b52 100644
--- a/gnuradio-core/src/lib/general/gr_cpm.cc
+++ b/gnuradio-core/src/lib/general/gr_cpm.cc
@@ -28,6 +28,9 @@
#include <cfloat>
#include <gr_cpm.h>
+#ifndef M_TWOPI
+# define M_TWOPI (2*M_PI)
+#endif
//! Normalised sinc function, sinc(x)=sin(pi*x)/pi*x
inline double
diff --git a/gnuradio-core/src/lib/general/gr_cpm.h b/gnuradio-core/src/lib/general/gr_cpm.h
index 09598024a..cae6fe313 100644
--- a/gnuradio-core/src/lib/general/gr_cpm.h
+++ b/gnuradio-core/src/lib/general/gr_cpm.h
@@ -24,10 +24,6 @@
#include <vector>
-#ifndef M_TWOPI
-# define M_TWOPI (2*M_PI)
-#endif
-
class gr_cpm
{
public:
diff --git a/gnuradio-core/src/lib/general/gr_cpm.i b/gnuradio-core/src/lib/general/gr_cpm.i
index 7145f5edd..f01aba34e 100644
--- a/gnuradio-core/src/lib/general/gr_cpm.i
+++ b/gnuradio-core/src/lib/general/gr_cpm.i
@@ -34,7 +34,7 @@ class gr_cpm
GENERIC = 999
};
- std::vector<float>
+ static std::vector<float>
phase_response(cpm_type type, unsigned samples_per_sym, unsigned L, double beta=0.3);
};
diff --git a/gnuradio-core/src/lib/general/qa_gr_cpm.cc b/gnuradio-core/src/lib/general/qa_gr_cpm.cc
index ae391c48c..cc32d1117 100644
--- a/gnuradio-core/src/lib/general/qa_gr_cpm.cc
+++ b/gnuradio-core/src/lib/general/qa_gr_cpm.cc
@@ -135,8 +135,6 @@ qa_gr_cpm::t5 ()
sum += taps[i];
}
- // Need to cut this guy some slack; in theory, sum only equals one for
- // L => infinity
CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA);
}
diff --git a/gnuradio-core/src/lib/hier/gr_cpmmod_bc.cc b/gnuradio-core/src/lib/hier/gr_cpmmod_bc.cc
index d14deee34..24c25e22f 100644
--- a/gnuradio-core/src/lib/hier/gr_cpmmod_bc.cc
+++ b/gnuradio-core/src/lib/hier/gr_cpmmod_bc.cc
@@ -42,7 +42,7 @@ gr_cpmmod_bc::gr_cpmmod_bc(gr_cpm::cpm_type type, float h, unsigned samples_per_
d_taps(gr_cpm::phase_response(type, samples_per_sym, L, beta)),
d_char_to_float(gr_make_char_to_float()),
d_pulse_shaper(gr_make_interp_fir_filter_fff(samples_per_sym, d_taps)),
- d_fm(gr_make_frequency_modulator_fc(M_TWOPI * h / samples_per_sym))
+ d_fm(gr_make_frequency_modulator_fc(M_PI * h))
{
switch (type) {
case gr_cpm::LRC:
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_cpm.py b/gnuradio-core/src/python/gnuradio/gr/qa_cpm.py
index b28decce2..776173466 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_cpm.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_cpm.py
@@ -33,7 +33,7 @@ class test_cpm(gr_unittest.TestCase):
def do_check_phase_shift(self, type, name):
sps = 2
- L = 5
+ L = 1
in_bits = (1,) * 20
src = gr.vector_source_b(in_bits, False)
cpm = gr.cpmmod_bc(type, 0.5, sps, L)
@@ -80,6 +80,10 @@ class test_cpm(gr_unittest.TestCase):
self.assertFloatTuplesAlmostEqual(tuple(phase_diff), (0.5 * numpy.pi,) * len(phase_diff), 5,
msg="Phase shift was not correct for GMSK")
+ def test_phase_response(self):
+ phase_response = gr.cpm.phase_response(gr.cpm.LREC, 2, 4)
+ self.assertAlmostEqual(numpy.sum(phase_response), 1)
+
if __name__ == '__main__':
gr_unittest.run(test_cpm, "test_cpm.xml")