COSA
An Object-Oriented Platform for Arduino Programming
BitstuffingCodec.hh
Go to the documentation of this file.
1 
21 #ifndef COSA_BITSTUFFINGCODEC_HH
22 #define COSA_BITSTUFFINGCODEC_HH
23 
24 #include <VWI.h>
25 
30 class BitstuffingCodec : public VWI::Codec {
31 public:
37  VWI::Codec(5, 0x34a, 8)
38  {
39  }
40 
47  virtual const uint8_t* preamble()
48  {
49  return (s_preamble);
50  }
51 
58  virtual uint8_t encode4(uint8_t nibble)
59  {
60  return (((nibble & 0xf) << 1) + ((nibble & 0x1) == 0));
61  };
62 
69  virtual uint8_t decode4(uint8_t symbol)
70  {
71  return ((symbol >> 1) & 0xf);
72  }
73 
74 private:
76  static const uint8_t s_preamble[] PROGMEM;
77 };
78 
79 #endif
Definition: VWI.hh:64
virtual const uint8_t * preamble()
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
virtual uint8_t encode4(uint8_t nibble)