COSA
An Object-Oriented Platform for Arduino Programming
Block4B5BCodec.hh
Go to the documentation of this file.
1 
21 #ifndef COSA_BLOCK4B5BCODEC_HH
22 #define COSA_BLOCK4B5BCODEC_HH
23 
24 #include <VWI.h>
25 
30 class Block4B5BCodec : public VWI::Codec {
31 public:
37  VWI::Codec(5, 0x238, 8)
38  {
39  }
40 
46  virtual const uint8_t* preamble()
47  {
48  return (s_preamble);
49  }
50 
57  virtual uint8_t encode4(uint8_t nibble)
58  {
59  return (pgm_read_byte(&s_symbols[nibble & 0xf]));
60  };
61 
68  virtual uint8_t decode4(uint8_t symbol)
69  {
70  return (pgm_read_byte(&s_codes[symbol & SYMBOL_MASK]));
71  }
72 
73 private:
75  static const uint8_t s_symbols[] PROGMEM;
76 
78  static const uint8_t s_codes[] PROGMEM;
79 
81  static const uint8_t s_preamble[] PROGMEM;
82 };
83 
84 #endif
Definition: VWI.hh:64
virtual const uint8_t * preamble()
virtual uint8_t encode4(uint8_t nibble)
virtual uint8_t decode4(uint8_t symbol)
Codec(uint8_t bits_per_symbol, uint16_t start_symbol, uint8_t preamble_max=VWI::Transmitter::PREAMBLE_MAX)
Definition: VWI.cpp:59
const uint8_t SYMBOL_MASK
Definition: VWI.hh:88