diff options
author | ghostop14 <ghostop14@gmail.com> | 2020-02-14 11:47:37 -0500 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2020-02-15 14:25:57 +0100 |
commit | 504ab76d9e4fc3e9f497b9fd34f01c1bad346a5d (patch) | |
tree | c64edca089a87217e56d8840a38382d7e2b4ec56 /gr-analog/lib/pll_carriertracking_cc_impl.h | |
parent | a56c3a7f4908133dc6ceb93ffd3b2f9e1dda8e0e (diff) |
gr-digital: Improve PLL Loops and Clock Recovery
These updates incorporate the same inlining of loop functions and
the newly pushed fast_cc_multiply function to ensure
consistent performance improvements across systems that do not
support the cx-limited-range compiler parameter (Macs and Windows).
Diffstat (limited to 'gr-analog/lib/pll_carriertracking_cc_impl.h')
-rw-r--r-- | gr-analog/lib/pll_carriertracking_cc_impl.h | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.h b/gr-analog/lib/pll_carriertracking_cc_impl.h index 3cb7146da9..82a2f1c21c 100644 --- a/gr-analog/lib/pll_carriertracking_cc_impl.h +++ b/gr-analog/lib/pll_carriertracking_cc_impl.h @@ -12,6 +12,7 @@ #define INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_IMPL_H #include <gnuradio/analog/pll_carriertracking_cc.h> +#include <gnuradio/math.h> namespace gr { namespace analog { @@ -22,14 +23,30 @@ private: float d_locksig, d_lock_threshold; bool d_squelch_enable; - float mod_2pi(float in); - float phase_detector(gr_complex sample, float ref_phase); + float mod_2pi(float in) + { + if (in > GR_M_PI) + return in - (2.0 * GR_M_PI); + else if (in < -GR_M_PI) + return in + (2.0 * GR_M_PI); + else + return in; + } + + float phase_detector(gr_complex sample, float ref_phase) + { + float sample_phase; + // sample_phase = atan2(sample.imag(),sample.real()); + sample_phase = gr::fast_atan2f(sample.imag(), sample.real()); + return mod_2pi(sample_phase - ref_phase); + } public: pll_carriertracking_cc_impl(float loop_bw, float max_freq, float min_freq); ~pll_carriertracking_cc_impl(); - bool lock_detector(void); + bool lock_detector(void) { return (fabsf(d_locksig) > d_lock_threshold); } + bool squelch_enable(bool); float set_lock_threshold(float); |