diff --git a/firmware/baseband/channel_decimator.hpp b/firmware/baseband/channel_decimator.hpp index 3177a1212..b4ee4784a 100644 --- a/firmware/baseband/channel_decimator.hpp +++ b/firmware/baseband/channel_decimator.hpp @@ -38,6 +38,17 @@ public: By32, }; + constexpr ChannelDecimator( + ) : decimation_factor { DecimationFactor::By32 } + { + } + + constexpr ChannelDecimator( + const DecimationFactor decimation_factor + ) : decimation_factor { decimation_factor } + { + } + void set_decimation_factor(const DecimationFactor f) { decimation_factor = f; } @@ -69,7 +80,7 @@ private: dsp::decimate::DecimateBy2CIC3 cic_3; dsp::decimate::DecimateBy2CIC3 cic_4; - DecimationFactor decimation_factor = DecimationFactor::By32; + DecimationFactor decimation_factor; buffer_c16_t execute_decimation(buffer_c8_t buffer); }; diff --git a/firmware/baseband/clock_recovery.hpp b/firmware/baseband/clock_recovery.hpp index 3289729f3..bd17255d7 100644 --- a/firmware/baseband/clock_recovery.hpp +++ b/firmware/baseband/clock_recovery.hpp @@ -116,6 +116,16 @@ private: template class ClockRecovery { public: + ClockRecovery( + const float sampling_rate, + const float symbol_rate, + ErrorFilter error_filter, + std::function symbol_handler + ) : symbol_handler { symbol_handler } + { + configure(sampling_rate, symbol_rate, error_filter); + } + ClockRecovery( std::function symbol_handler ) : symbol_handler { symbol_handler } diff --git a/firmware/baseband/matched_filter.hpp b/firmware/baseband/matched_filter.hpp index b33d7a9a2..741f50180 100644 --- a/firmware/baseband/matched_filter.hpp +++ b/firmware/baseband/matched_filter.hpp @@ -49,9 +49,17 @@ public: using taps_t = tap_t[]; template - void configure( + MatchedFilter( const T& taps, size_t decimation_factor = 1 + ) { + configure(taps, decimation_factor); + } + + template + void configure( + const T& taps, + size_t decimation_factor ) { samples_ = std::make_unique(taps.size()); taps_reversed_ = std::make_unique(taps.size()); diff --git a/firmware/baseband/proc_fsk.hpp b/firmware/baseband/proc_fsk.hpp index ee74b756c..01b13ad89 100644 --- a/firmware/baseband/proc_fsk.hpp +++ b/firmware/baseband/proc_fsk.hpp @@ -37,6 +37,8 @@ #include #include +#include "ais_baseband.hpp" + class FSKProcessor : public BasebandProcessor { public: using payload_t = std::bitset<1024>; @@ -49,10 +51,11 @@ public: void execute(buffer_c8_t buffer) override; private: - ChannelDecimator decimator; - dsp::matched_filter::MatchedFilter mf; + ChannelDecimator decimator { ChannelDecimator::DecimationFactor::By32 }; + dsp::matched_filter::MatchedFilter mf { baseband::ais::rrc_taps_76k8_4t_p, 4 }; clock_recovery::ClockRecovery clock_recovery { + 19200, 9600, { 0.0555f }, [this](const float symbol) { this->consume_symbol(symbol); } }; symbol_coding::NRZIDecoder nrzi_decode;