From d92c962c0c4b1f6794bb7a8baeeec551bd3288cf Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Fri, 2 Oct 2015 22:45:04 -0700 Subject: [PATCH] Set MatchedFilter taps with separate method. --- firmware/baseband/matched_filter.hpp | 15 ++++++++++----- firmware/baseband/proc_fsk.cpp | 3 +++ firmware/baseband/proc_fsk.hpp | 10 ++-------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/firmware/baseband/matched_filter.hpp b/firmware/baseband/matched_filter.hpp index be13e1ea..2a09c4ad 100644 --- a/firmware/baseband/matched_filter.hpp +++ b/firmware/baseband/matched_filter.hpp @@ -42,14 +42,19 @@ public: using taps_t = std::vector; - template MatchedFilter( - const std::array& taps, size_t decimation_factor = 1 - ) : taps(taps.cbegin(), taps.cend()), - decimation_factor { decimation_factor } + ) : decimation_factor { decimation_factor } { - samples.assign(taps.size(), 0.0f); + } + + template + void set_taps(const T& new_taps) { + taps.assign(new_taps.cbegin(), new_taps.cend()); + taps.shrink_to_fit(); + + samples.assign(new_taps.size(), 0); + samples.shrink_to_fit(); } bool execute_once( diff --git a/firmware/baseband/proc_fsk.cpp b/firmware/baseband/proc_fsk.cpp index 4500506d..55edc77b 100644 --- a/firmware/baseband/proc_fsk.cpp +++ b/firmware/baseband/proc_fsk.cpp @@ -30,6 +30,9 @@ FSKProcessor::FSKProcessor( MessageHandlerMap& message_handlers ) : message_handlers(message_handlers) { + mf_0.set_taps(baseband::ais::rrc_taps_8_n); + mf_1.set_taps(baseband::ais::rrc_taps_8_p); + message_handlers.register_handler(Message::ID::FSKConfiguration, [this](const Message* const p) { auto m = reinterpret_cast(p); diff --git a/firmware/baseband/proc_fsk.hpp b/firmware/baseband/proc_fsk.hpp index 70802df0..3224581f 100644 --- a/firmware/baseband/proc_fsk.hpp +++ b/firmware/baseband/proc_fsk.hpp @@ -57,14 +57,8 @@ private: const fir_taps_real<64>& channel_filter_taps = taps_64_lp_031_070_tfilter; dsp::decimate::FIRAndDecimateBy2Complex<64> channel_filter { channel_filter_taps.taps }; - dsp::matched_filter::MatchedFilter mf_0 { - baseband::ais::rrc_taps_8_n, - 1 - }; - dsp::matched_filter::MatchedFilter mf_1 { - baseband::ais::rrc_taps_8_p, - 1 - }; + dsp::matched_filter::MatchedFilter mf_0 { 1 }; + dsp::matched_filter::MatchedFilter mf_1 { 1 }; clock_recovery::ClockRecovery clock_recovery { static_cast(sampling_rate / 4),