mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-02 11:36:38 -04:00
Move more Manchester code from .hpp to .cpp.
This commit is contained in:
parent
1aa1286ec1
commit
61dc25e132
2 changed files with 17 additions and 13 deletions
|
@ -24,6 +24,21 @@
|
|||
// TODO: SERIOUSLY!? Including this, just to use to_string_hex?! Refactor!!!1
|
||||
#include "ui_widget.hpp"
|
||||
|
||||
ManchesterDecoder::DecodedSymbol ManchesterDecoder::operator[](const size_t index) const {
|
||||
const size_t encoded_index = index * 2;
|
||||
if( (encoded_index + 1) < count ) {
|
||||
const auto value = encoded[encoded_index + sense];
|
||||
const auto error = encoded[encoded_index + 0] == encoded[encoded_index + 1];
|
||||
return { value, error };
|
||||
} else {
|
||||
return { 0, 1 };
|
||||
}
|
||||
}
|
||||
|
||||
size_t ManchesterDecoder::symbols_count() const {
|
||||
return count / 2;
|
||||
}
|
||||
|
||||
ManchesterFormatted format_manchester(
|
||||
const ManchesterDecoder& decoder
|
||||
) {
|
||||
|
|
|
@ -44,20 +44,9 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
DecodedSymbol operator[](const size_t index) const {
|
||||
const size_t encoded_index = index * 2;
|
||||
if( (encoded_index + 1) < count ) {
|
||||
const auto value = encoded[encoded_index + sense];
|
||||
const auto error = encoded[encoded_index + 0] == encoded[encoded_index + 1];
|
||||
return { value, error };
|
||||
} else {
|
||||
return { 0, 1 };
|
||||
}
|
||||
}
|
||||
DecodedSymbol operator[](const size_t index) const;
|
||||
|
||||
size_t symbols_count() const {
|
||||
return count / 2;
|
||||
}
|
||||
size_t symbols_count() const;
|
||||
|
||||
private:
|
||||
const std::bitset<1024>& encoded;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue