mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-15 01:47:41 +00:00
Move common matchers to PacketBuilder.
This commit is contained in:
@@ -29,6 +29,20 @@
|
|||||||
|
|
||||||
#include "bit_pattern.hpp"
|
#include "bit_pattern.hpp"
|
||||||
|
|
||||||
|
struct NeverMatch {
|
||||||
|
bool operator()(const BitHistory&, const size_t) const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FixedLength {
|
||||||
|
bool operator()(const BitHistory&, const size_t symbols_received) const {
|
||||||
|
return symbols_received >= length;
|
||||||
|
}
|
||||||
|
|
||||||
|
const size_t length;
|
||||||
|
};
|
||||||
|
|
||||||
template<typename PreambleMatcher, typename UnstuffMatcher, typename EndMatcher>
|
template<typename PreambleMatcher, typename UnstuffMatcher, typename EndMatcher>
|
||||||
class PacketBuilder {
|
class PacketBuilder {
|
||||||
public:
|
public:
|
||||||
|
@@ -37,20 +37,6 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|
||||||
struct NeverMatch {
|
|
||||||
bool operator()(const BitHistory&, const size_t) const {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FixedLength {
|
|
||||||
bool operator()(const BitHistory&, const size_t symbols_received) const {
|
|
||||||
return symbols_received >= length;
|
|
||||||
}
|
|
||||||
|
|
||||||
const size_t length;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Translate+rectangular filter
|
// Translate+rectangular filter
|
||||||
// sample=153.6k, deviation=38400, symbol=19200
|
// sample=153.6k, deviation=38400, symbol=19200
|
||||||
// Length: 8 taps, 1 symbols, 2 cycles of sinusoid
|
// Length: 8 taps, 1 symbols, 2 cycles of sinusoid
|
||||||
|
Reference in New Issue
Block a user