COSA
An Object-Oriented Platform for Arduino Programming
VirtualWireCodec.hh
Go to the documentation of this file.
1 
22 #ifndef COSA_VIRTUALWIRECODEC_HH
23 #define COSA_VIRTUALWIRECODEC_HH
24 
25 #include <VWI.h>
26 
31 class VirtualWireCodec : public VWI::Codec {
32 public:
38  VWI::Codec(6, 0xb38, 8)
39  {
40  }
41 
47  virtual const uint8_t* preamble()
48  {
49  return (s_preamble);
50  }
51 
57  virtual uint8_t encode4(uint8_t nibble)
58  {
59  return (pgm_read_byte(&s_symbols[nibble & 0xf]));
60  };
61 
67  virtual uint8_t decode4(uint8_t symbol);
68 
69 private:
71  static const uint8_t s_symbols[] PROGMEM;
72 
74  static const uint8_t s_preamble[] PROGMEM;
75 };
76 
77 #endif
Definition: VWI.hh:64
virtual uint8_t decode4(uint8_t symbol)
virtual const uint8_t * preamble()
Codec(uint8_t bits_per_symbol, uint16_t start_symbol, uint8_t preamble_max=VWI::Transmitter::PREAMBLE_MAX)
Definition: VWI.cpp:59
virtual uint8_t encode4(uint8_t nibble)