mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-17 19:54:35 -05:00
Change interface to AccessCodeCorrelator, inline in header.
This commit is contained in:
parent
a3cce5632e
commit
5c31e803c8
@ -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);
|
||||
}
|
||||
|
@ -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 };
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user