arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
HammingFEC< bytecount, block_t > Class Template Reference

Hamming forware error correction. Inspired by https://github.com/nasserkessas/hamming-codes. More...

#include <HammingFEC.h>

Inheritance diagram for HammingFEC< bytecount, block_t >:
BaseStream Stream Print

Public Member Functions

 HammingFEC (Print &print)
 
 HammingFEC (Stream &stream)
 
int available () override
 
int availableForWrite () override
 
virtual bool begin ()
 
virtual void end ()
 
virtual void flush () override
 
 operator bool ()
 
size_t readBytes (uint8_t *data, size_t len) override
 
void setWriteBufferSize (int size)
 
size_t write (const uint8_t *data, size_t len) override
 
virtual size_t write (uint8_t ch) override
 

Protected Member Functions

bool decode (block_t input[], int len)
 
int encode (uint8_t *input, int len)
 
int encodedSize ()
 
bool getBit (block_t b, int i)
 
int getBlocks ()
 
bool getCharBit (uint8_t b, int i)
 
int inList (uint8_t **list, uint8_t *testString, int listLen)
 
block_t modifyBit (block_t n, int p, bool b)
 
uint8_t modifyCharBit (uint8_t n, int p, bool b)
 
int multipleXor (int *indicies, int len)
 
void refillReadBuffer ()
 
block_t toggleBit (block_t b, int i)
 

Protected Attributes

int _timeout = 10
 
SingleBuffer< uint8_tencoded {encodedSize()}
 
Printp_print = nullptr
 
Streamp_stream = nullptr
 
SingleBuffer< uint8_traw {bytecount}
 
RingBuffer< uint8_ttmp_in {0}
 
RingBuffer< uint8_ttmp_out {0}
 
int write_buffer_size = MAX_SINGLE_CHARS
 

Detailed Description

template<int bytecount, class block_t>
class audio_tools::HammingFEC< bytecount, block_t >

Hamming forware error correction. Inspired by https://github.com/nasserkessas/hamming-codes.

Hamming<1024,uint16_t> hamming; // block_ts of 1k with block_tsize 16bits = 31.25% redundency

Block size (bits) Redundant bits Redundancy percentage 4 3 75% 8 4 50% 16 5 31.25% 32 6 18.75% 64 7 10.94%

Constructor & Destructor Documentation

◆ HammingFEC() [1/2]

template<int bytecount, class block_t >
HammingFEC ( Stream stream)
inline

◆ HammingFEC() [2/2]

template<int bytecount, class block_t >
HammingFEC ( Print print)
inline

Member Function Documentation

◆ available()

template<int bytecount, class block_t >
int available ( )
inlineoverridevirtual

Reimplemented from BaseStream.

◆ availableForWrite()

template<int bytecount, class block_t >
int availableForWrite ( )
inlineoverridevirtual

Reimplemented from BaseStream.

◆ begin()

virtual bool begin ( )
inlinevirtualinherited

◆ decode()

template<int bytecount, class block_t >
bool decode ( block_t  input[],
int  len 
)
inlineprotected

◆ encode()

template<int bytecount, class block_t >
int encode ( uint8_t input,
int  len 
)
inlineprotected

◆ encodedSize()

template<int bytecount, class block_t >
int encodedSize ( )
inlineprotected

◆ end()

virtual void end ( )
inlinevirtualinherited

◆ flush()

virtual void flush ( )
inlineoverridevirtualinherited

◆ getBit()

template<int bytecount, class block_t >
bool getBit ( block_t  b,
int  i 
)
inlineprotected

◆ getBlocks()

template<int bytecount, class block_t >
int getBlocks ( )
inlineprotected

◆ getCharBit()

template<int bytecount, class block_t >
bool getCharBit ( uint8_t  b,
int  i 
)
inlineprotected

◆ inList()

template<int bytecount, class block_t >
int inList ( uint8_t **  list,
uint8_t testString,
int  listLen 
)
inlineprotected

◆ modifyBit()

template<int bytecount, class block_t >
block_t modifyBit ( block_t  n,
int  p,
bool  b 
)
inlineprotected

◆ modifyCharBit()

template<int bytecount, class block_t >
uint8_t modifyCharBit ( uint8_t  n,
int  p,
bool  b 
)
inlineprotected

◆ multipleXor()

template<int bytecount, class block_t >
int multipleXor ( int indicies,
int  len 
)
inlineprotected

◆ operator bool()

operator bool ( )
inlineinherited

◆ readBytes()

template<int bytecount, class block_t >
size_t readBytes ( uint8_t data,
size_t  len 
)
inlineoverridevirtual

Implements BaseStream.

◆ refillReadBuffer()

void refillReadBuffer ( )
inlineprotectedinherited

◆ setWriteBufferSize()

void setWriteBufferSize ( int  size)
inlineinherited

◆ toggleBit()

template<int bytecount, class block_t >
block_t toggleBit ( block_t  b,
int  i 
)
inlineprotected

◆ write() [1/2]

template<int bytecount, class block_t >
size_t write ( const uint8_t data,
size_t  len 
)
inlineoverridevirtual

Implements BaseStream.

◆ write() [2/2]

virtual size_t write ( uint8_t  ch)
inlineoverridevirtualinherited

Member Data Documentation

◆ _timeout

int _timeout = 10
protectedinherited

◆ encoded

template<int bytecount, class block_t >
SingleBuffer<uint8_t> encoded {encodedSize()}
protected

◆ p_print

template<int bytecount, class block_t >
Print* p_print = nullptr
protected

◆ p_stream

template<int bytecount, class block_t >
Stream* p_stream = nullptr
protected

◆ raw

template<int bytecount, class block_t >
SingleBuffer<uint8_t> raw {bytecount}
protected

◆ tmp_in

RingBuffer<uint8_t> tmp_in {0}
protectedinherited

◆ tmp_out

RingBuffer<uint8_t> tmp_out {0}
protectedinherited

◆ write_buffer_size

int write_buffer_size = MAX_SINGLE_CHARS
protectedinherited

The documentation for this class was generated from the following file: