COSA
An Object-Oriented Platform for Arduino Programming
ManchesterCodec.cpp
Go to the documentation of this file.
1 
21 #include "ManchesterCodec.hh"
22 
23 // Manchester encoder table 4 to 8 bits. In binary to show how it works
24 const uint8_t ManchesterCodec::s_symbols[] __PROGMEM = {
25  0b10101010,
26  0b10101001,
27  0b10100110,
28  0b10100101,
29  0b10011010,
30  0b10011001,
31  0b10010110,
32  0b10010101,
33  0b01101010,
34  0b01101001,
35  0b01100110,
36  0b01100101,
37  0b01011010,
38  0b01011001,
39  0b01010110,
40  0b01010101
41 };
42 
43 uint8_t
44 ManchesterCodec::decode4(uint8_t symbol)
45 {
46  uint8_t res = 0;
47  if (symbol & 1) res |= 1;
48  if (symbol & 4) res |= 2;
49  if (symbol & 16) res |= 4;
50  if (symbol & 64) res |= 8;
51  return (res);
52 }
53 
54 // Ethernet frame preamble and delimiter/start symbol
55 const uint8_t ManchesterCodec::s_preamble[] __PROGMEM = {
56  0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x5d
57 };
58 
const uint8_t ManchesterCodec::s_symbols[] __PROGMEM
virtual uint8_t decode4(uint8_t symbol)