mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 09:57:50 +00:00
Formatted code (#1007)
* Updated style * Updated files * fixed new line * Updated spacing * File fix WIP * Updated to clang 13 * updated comment style * Removed old comment code
This commit is contained in:
@@ -30,57 +30,55 @@
|
||||
#include "baseband_packet.hpp"
|
||||
|
||||
struct DecodedSymbol {
|
||||
uint_fast8_t value;
|
||||
uint_fast8_t error;
|
||||
uint_fast8_t value;
|
||||
uint_fast8_t error;
|
||||
};
|
||||
|
||||
class ManchesterBase {
|
||||
public:
|
||||
constexpr ManchesterBase(
|
||||
const baseband::Packet& packet,
|
||||
const size_t sense = 0
|
||||
) : packet { packet },
|
||||
sense { sense }
|
||||
{
|
||||
}
|
||||
|
||||
virtual DecodedSymbol operator[](const size_t index) const = 0;
|
||||
public:
|
||||
constexpr ManchesterBase(
|
||||
const baseband::Packet& packet,
|
||||
const size_t sense = 0)
|
||||
: packet{packet},
|
||||
sense{sense} {
|
||||
}
|
||||
|
||||
virtual size_t symbols_count() const;
|
||||
|
||||
virtual ~ManchesterBase() { };
|
||||
|
||||
protected:
|
||||
const baseband::Packet& packet;
|
||||
const size_t sense;
|
||||
virtual DecodedSymbol operator[](const size_t index) const = 0;
|
||||
|
||||
virtual size_t symbols_count() const;
|
||||
|
||||
virtual ~ManchesterBase(){};
|
||||
|
||||
protected:
|
||||
const baseband::Packet& packet;
|
||||
const size_t sense;
|
||||
};
|
||||
|
||||
class ManchesterDecoder : public ManchesterBase {
|
||||
public:
|
||||
using ManchesterBase::ManchesterBase;
|
||||
DecodedSymbol operator[](const size_t index) const;
|
||||
public:
|
||||
using ManchesterBase::ManchesterBase;
|
||||
DecodedSymbol operator[](const size_t index) const;
|
||||
};
|
||||
|
||||
class BiphaseMDecoder : public ManchesterBase {
|
||||
public:
|
||||
using ManchesterBase::ManchesterBase;
|
||||
DecodedSymbol operator[](const size_t index) const;
|
||||
public:
|
||||
using ManchesterBase::ManchesterBase;
|
||||
DecodedSymbol operator[](const size_t index) const;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
T operator|(const T& l, const DecodedSymbol& r) {
|
||||
return l | r.value;
|
||||
return l | r.value;
|
||||
}
|
||||
|
||||
struct FormattedSymbols {
|
||||
const std::string data;
|
||||
const std::string errors;
|
||||
const std::string data;
|
||||
const std::string errors;
|
||||
};
|
||||
|
||||
FormattedSymbols format_symbols(
|
||||
const ManchesterBase& decoder
|
||||
);
|
||||
const ManchesterBase& decoder);
|
||||
|
||||
void manchester_encode(uint8_t * dest, uint8_t * src, const size_t length, const size_t sense = 0);
|
||||
void manchester_encode(uint8_t* dest, uint8_t* src, const size_t length, const size_t sense = 0);
|
||||
|
||||
#endif/*__MANCHESTER_H__*/
|
||||
#endif /*__MANCHESTER_H__*/
|
||||
|
Reference in New Issue
Block a user