From 474eaa85415cc1f9bb94a7459121c42337faf1c7 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Fri, 2 Oct 2015 22:32:58 -0700 Subject: [PATCH] Template ClockRecovery for ErrorFilter type. --- firmware/baseband/clock_recovery.hpp | 5 ++++- firmware/baseband/proc_fsk.hpp | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/firmware/baseband/clock_recovery.hpp b/firmware/baseband/clock_recovery.hpp index 040ba018..8a6438a6 100644 --- a/firmware/baseband/clock_recovery.hpp +++ b/firmware/baseband/clock_recovery.hpp @@ -105,13 +105,16 @@ private: const float weight; }; +template class ClockRecovery { public: ClockRecovery( const float sampling_rate, const float symbol_rate, + const ErrorFilter error_filter, std::function symbol_handler ) : resampler(sampling_rate, symbol_rate * timing_error_detector.samples_per_symbol), + error_filter { error_filter }, symbol_handler { symbol_handler } { } @@ -136,7 +139,7 @@ public: private: dsp::interpolation::LinearResampler resampler; GardnerTimingErrorDetector timing_error_detector; - FixedErrorFilter error_filter; + ErrorFilter error_filter; std::function symbol_handler; void resampler_callback(const float interpolated_sample) { diff --git a/firmware/baseband/proc_fsk.hpp b/firmware/baseband/proc_fsk.hpp index e2f4d8ed..01115324 100644 --- a/firmware/baseband/proc_fsk.hpp +++ b/firmware/baseband/proc_fsk.hpp @@ -78,9 +78,10 @@ private: 1 }; - clock_recovery::ClockRecovery clock_recovery { + clock_recovery::ClockRecovery clock_recovery { static_cast(sampling_rate / 4), 9600, + { 0.0012f }, [this](const float symbol) { this->consume_symbol(symbol); } }; symbol_coding::NRZIDecoder nrzi_decode;