mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Extract DecodedSymbol from ManchesterDecoder.
This commit is contained in:
parent
05b55f2696
commit
3d22222689
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "string_format.hpp"
|
#include "string_format.hpp"
|
||||||
|
|
||||||
ManchesterDecoder::DecodedSymbol ManchesterDecoder::operator[](const size_t index) const {
|
DecodedSymbol ManchesterDecoder::operator[](const size_t index) const {
|
||||||
const size_t encoded_index = index * 2;
|
const size_t encoded_index = index * 2;
|
||||||
if( (encoded_index + 1) < packet.size() ) {
|
if( (encoded_index + 1) < packet.size() ) {
|
||||||
const auto value = packet[encoded_index + sense];
|
const auto value = packet[encoded_index + sense];
|
||||||
|
@ -29,13 +29,13 @@
|
|||||||
|
|
||||||
#include "baseband_packet.hpp"
|
#include "baseband_packet.hpp"
|
||||||
|
|
||||||
|
struct DecodedSymbol {
|
||||||
|
uint_fast8_t value;
|
||||||
|
uint_fast8_t error;
|
||||||
|
};
|
||||||
|
|
||||||
class ManchesterDecoder {
|
class ManchesterDecoder {
|
||||||
public:
|
public:
|
||||||
struct DecodedSymbol {
|
|
||||||
uint_fast8_t value;
|
|
||||||
uint_fast8_t error;
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr ManchesterDecoder(
|
constexpr ManchesterDecoder(
|
||||||
const baseband::Packet& packet,
|
const baseband::Packet& packet,
|
||||||
const size_t sense = 0
|
const size_t sense = 0
|
||||||
@ -54,7 +54,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T operator|(const T& l, const ManchesterDecoder::DecodedSymbol& r) {
|
T operator|(const T& l, const DecodedSymbol& r) {
|
||||||
return l | r.value;
|
return l | r.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user