COSA
An Object-Oriented Platform for Arduino Programming
HammingCodec_7_4.cpp
Go to the documentation of this file.
1 
21 #include "HammingCodec_7_4.hh"
22 
23 // Encoding table; 4-bit code to 7-bit symbol
24 const uint8_t HammingCodec_7_4::s_symbols[16] __PROGMEM = {
25  0x70, 0x01, 0x12, 0x63, 0x24, 0x55, 0x46, 0x37,
26  0x48, 0x39, 0x2a, 0x5b, 0x1c, 0x6d, 0x7e, 0x0f
27 };
28 
29 // Decoding table; 7-bit symbol to 4-bit code (packed table).
30 const uint8_t HammingCodec_7_4::s_codes[64] __PROGMEM = {
31  0x11, 0x21, 0x41, 0x6f, 0x81, 0xaf, 0xcf, 0xff,
32  0x21, 0x22, 0xc5, 0x27, 0xc9, 0x2b, 0xcc, 0xcf,
33  0x41, 0xa3, 0x44, 0x47, 0xa9, 0xaa, 0x4d, 0xaf,
34  0x09, 0x27, 0x47, 0x77, 0x99, 0xa9, 0xc9, 0xe7,
35  0x81, 0x63, 0x65, 0x66, 0x88, 0x8b, 0x8d, 0x6f,
36  0x05, 0x2b, 0x55, 0x65, 0x8b, 0xbb, 0xc5, 0xeb,
37  0x03, 0x33, 0x4d, 0x63, 0x8d, 0xa3, 0xdd, 0xed,
38  0x00, 0x03, 0x05, 0xe7, 0x09, 0xeb, 0xed, 0xee,
39 };
40 
41 /*
42  * Calculating the start symbol (7-bits per symbol):
43  * 0x55, 0x2a => 101.0101, 010.1010 (preamble 7-bit).
44  * 0x55, 0x25 => 101.0101, 010.0101 => 010.0101, 101.0101
45  * => 1.0010, 1101.0101 => 0x12d5
46  */
47 const uint8_t HammingCodec_7_4::s_preamble[8] __PROGMEM = {
48  0x55, 0x2a, 0x55, 0x2a, 0x55, 0x2a, 0x55, 0x25
49 };
const uint8_t HammingCodec_7_4::s_symbols[16] __PROGMEM