diff --git a/firmware/baseband/access_code_correlator.cpp b/firmware/baseband/access_code_correlator.cpp index f45052b09..654983e9e 100644 --- a/firmware/baseband/access_code_correlator.cpp +++ b/firmware/baseband/access_code_correlator.cpp @@ -32,13 +32,3 @@ void AccessCodeCorrelator::configure( maximum_hamming_distance = new_maximum_hamming_distance; } } - -bool AccessCodeCorrelator::execute( - const uint_fast8_t in -) { - history = (history << 1) | (in & 1); - const auto delta_bits = (history ^ code) & mask; - //const size_t count = __builtin_popcountll(delta_bits); - const size_t count = __builtin_popcountl(delta_bits); - return (count <= maximum_hamming_distance); -} diff --git a/firmware/baseband/access_code_correlator.hpp b/firmware/baseband/access_code_correlator.hpp index 0570dcf43..e1e447f4f 100644 --- a/firmware/baseband/access_code_correlator.hpp +++ b/firmware/baseband/access_code_correlator.hpp @@ -33,7 +33,15 @@ public: const size_t new_maximum_hamming_distance ); - bool execute(const uint_fast8_t in); + bool operator()( + const uint_fast8_t in + ) { + history = (history << 1) | (in & 1); + const auto delta_bits = (history ^ code) & mask; + //const size_t count = __builtin_popcountll(delta_bits); + const size_t count = __builtin_popcountl(delta_bits); + return (count <= maximum_hamming_distance); + } private: uint32_t code { 0 }; diff --git a/firmware/baseband/proc_fsk.cpp b/firmware/baseband/proc_fsk.cpp index f2b1ef060..23e9c6886 100644 --- a/firmware/baseband/proc_fsk.cpp +++ b/firmware/baseband/proc_fsk.cpp @@ -107,7 +107,7 @@ void FSKProcessor::consume_symbol( const uint_fast8_t sliced_symbol = (raw_symbol >= 0.0f) ? 1 : 0; const auto decoded_symbol = nrzi_decode(sliced_symbol); - const bool access_code_found = access_code_correlator.execute(decoded_symbol); + const bool access_code_found = access_code_correlator(decoded_symbol); packet_builder.execute( decoded_symbol,