summaryrefslogtreecommitdiff
path: root/gr-analog
diff options
context:
space:
mode:
authorMarcus Müller <mmueller@gnuradio.org>2021-04-09 23:49:10 +0200
committermormj <34754695+mormj@users.noreply.github.com>2021-04-17 20:05:55 -0400
commit39a173fe78a127e57019600e52173e02e492827d (patch)
tree672e81d8b9d0a891bfa6df5a810d9f2e7528e82f /gr-analog
parenta9e4368866a650f767b88e9ad3e22097b5374141 (diff)
analog: PLL Freq Det: refactor (implementation in .cc, not .h)
Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
Diffstat (limited to 'gr-analog')
-rw-r--r--gr-analog/lib/pll_freqdet_cf_impl.cc16
-rw-r--r--gr-analog/lib/pll_freqdet_cf_impl.h20
2 files changed, 16 insertions, 20 deletions
diff --git a/gr-analog/lib/pll_freqdet_cf_impl.cc b/gr-analog/lib/pll_freqdet_cf_impl.cc
index a450b00f5f..33d46f1135 100644
--- a/gr-analog/lib/pll_freqdet_cf_impl.cc
+++ b/gr-analog/lib/pll_freqdet_cf_impl.cc
@@ -35,6 +35,22 @@ pll_freqdet_cf_impl::pll_freqdet_cf_impl(float loop_bw, float max_freq, float mi
}
pll_freqdet_cf_impl::~pll_freqdet_cf_impl() {}
+constexpr float mod_2pi(float in)
+{
+ if (in > GR_M_PI) {
+ return in - static_cast<float>(2.0 * GR_M_PI);
+ }
+ if (in < -GR_M_PI) {
+ return in + static_cast<float>(2.0 * GR_M_PI);
+ }
+ return in;
+}
+
+float phase_detector(gr_complex sample, float ref_phase)
+{
+ float sample_phase = gr::fast_atan2f(sample.imag(), sample.real());
+ return mod_2pi(sample_phase - ref_phase);
+}
int pll_freqdet_cf_impl::work(int noutput_items,
gr_vector_const_void_star& input_items,
diff --git a/gr-analog/lib/pll_freqdet_cf_impl.h b/gr-analog/lib/pll_freqdet_cf_impl.h
index 53af570ed7..c2aa4f7228 100644
--- a/gr-analog/lib/pll_freqdet_cf_impl.h
+++ b/gr-analog/lib/pll_freqdet_cf_impl.h
@@ -12,32 +12,12 @@
#define INCLUDED_ANALOG_PLL_FREQDET_CF_IMPL_H
#include <gnuradio/analog/pll_freqdet_cf.h>
-#include <gnuradio/math.h>
namespace gr {
namespace analog {
class pll_freqdet_cf_impl : public pll_freqdet_cf
{
-private:
- 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 = gr::fast_atan2f(sample.imag(), sample.real());
- return mod_2pi(sample_phase - ref_phase);
- }
-
-
public:
pll_freqdet_cf_impl(float loop_bw, float max_freq, float min_freq);
~pll_freqdet_cf_impl() override;