COSA
An Object-Oriented Platform for Arduino Programming
HammingCodec_7_4 Class Reference

#include <HammingCodec_7_4.hh>

Inheritance diagram for HammingCodec_7_4:
Inheritance graph
Collaboration diagram for HammingCodec_7_4:
Collaboration graph

Public Member Functions

 HammingCodec_7_4 ()
 
virtual const uint8_t * preamble ()
 
virtual uint8_t encode4 (uint8_t nibble)
 
virtual uint8_t decode4 (uint8_t symbol)
 
virtual uint8_t decode8 (uint16_t symbol)
 

Public Attributes

const uint8_t BITS_PER_SYMBOL
 
const uint16_t START_SYMBOL
 
const uint8_t PREAMBLE_MAX
 
const uint8_t SYMBOL_MASK
 
const uint16_t BITS_MSB
 

Detailed Description

Hamming(7,4) Codec for the Cosa VWI (Virtual Wire Interface). This is a linear error-correcting code that encodes 4 bits of data into 7 bits by adding 3 parity bits. Hamming's (7,4) algorithm can correct any single-bit error, or detect all single-bit and two-bit errors. This implementation uses inverted parity bits to improve DC balance in transmission (e.g. avoid coding long sequences of zero or one).

References

  1. http://en.wikipedia.org/wiki/Hamming%287,4%29

Definition at line 38 of file HammingCodec_7_4.hh.

Constructor & Destructor Documentation

HammingCodec_7_4::HammingCodec_7_4 ( )
inline

Construct Hamming(7,4) codec with given bits per symbol, start symbol, and preamble size.

Definition at line 44 of file HammingCodec_7_4.hh.

Member Function Documentation

virtual uint8_t HammingCodec_7_4::decode4 ( uint8_t  symbol)
inlinevirtual

Returns 4-bit data for given symbol.

Parameters
[in]symbolcode.
Returns
4-bit data.

Implements VWI::Codec.

Definition at line 76 of file HammingCodec_7_4.hh.

virtual uint8_t VWI::Codec::decode8 ( uint16_t  symbol)
inlinevirtualinherited

Decode two packed symbols (max 16-bit) back to 8 bits (byte) of data.

Parameters
[in]symbolto decode.
Returns
data.

Definition at line 136 of file VWI.hh.

virtual uint8_t HammingCodec_7_4::encode4 ( uint8_t  nibble)
inlinevirtual

Returns symbol for given 4-bit data.

Parameters
[in]nibbledata.
Returns
7-bit symbol code.

Implements VWI::Codec.

Definition at line 65 of file HammingCodec_7_4.hh.

virtual const uint8_t* HammingCodec_7_4::preamble ( )
inlinevirtual

Returns pointer to Hamming frame preamble in program memory.

Returns
pointer.

Implements VWI::Codec.

Definition at line 54 of file HammingCodec_7_4.hh.

Member Data Documentation

const uint16_t VWI::Codec::BITS_MSB
inherited

Symbol MSB.

Definition at line 91 of file VWI.hh.

const uint8_t VWI::Codec::BITS_PER_SYMBOL
inherited

Bits per symbol.

Definition at line 76 of file VWI.hh.

const uint8_t VWI::Codec::PREAMBLE_MAX
inherited

Size of preamble with start symbol. Should be less or equal to Transmitter::PREAMBLE_MAX.

Definition at line 85 of file VWI.hh.

const uint16_t VWI::Codec::START_SYMBOL
inherited

Start symbol.

Definition at line 79 of file VWI.hh.

const uint8_t VWI::Codec::SYMBOL_MASK
inherited

Symbol mask.

Definition at line 88 of file VWI.hh.


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