79 static void bitWrite(T &data, uint8_t bit,
bool value)
94 static void bitWrite(T &data, uint8_t bit,
bool value)
104 template <
typename T>
113 template <
typename T>
117 static bool parityCheck(T data,
bool parity)
123 template <
typename T>
131 static bool parityCheck(T data,
bool parity)
144 template <
typename T,
typename BitDecoder>
156 if (static_cast<BitDecoder *>(
this)->isComplete())
159 return static_cast<BitDecoder *
>(
this)->internalAddBit(value);
224 template <
typename T,
225 template <
typename>
class TParity,
226 template <
typename>
class TBitNumbering>
230 friend class BitDecoderBase<T, BitDecoder<T, TParity, TBitNumbering>>;
235 if (this->m_bitLength <
sizeof(T) * CHAR_BIT) {
241 if (!TParity<T>::parityCheck(this->m_data, value)) {
253 return this->m_bitLength ==
sizeof(T) * CHAR_BIT + 1;
257 template <
typename T,
258 template <
typename>
class TBitNumbering>
260 :
public BitDecoderBase<T, BitDecoder<T, NoParity, TBitNumbering>>
262 friend class BitDecoderBase<T, BitDecoder<T, NoParity, TBitNumbering>>;
274 return this->m_bitLength ==
sizeof(T) * CHAR_BIT;
281 template <
template <
typename>
class TParity,
282 template <
typename>
class TBitNumbering>
void bitWrite(T &value, uint8_t bit, bool bitValue)
Writes the bit in the given value.
Definition: utils.h:106
BitDecoderStatus addBit(bool value)
Adds the bit value to the BitDecoder state.
Definition: bitdecoder.h:154
BitDecoderStatus
BitDecoder status returned from BitDecoder::addBit().
Definition: bitdecoder.h:51
Applies bit numbering and a parity method to transform continuous bit streams (for example from RF de...
Definition: bitdecoder.h:227
bool parity(int x)
Returns the even parity for the byte x.
Definition: utils.h:175
Bit manipulation utilities.
Configuration parameter for BitDecoder that enables even parity checking.
Definition: bitdecoder.h:114
Namespace containing all symbols of the Sensors library.
Definition: bitdecoder.h:40
void reset()
Resets the decoder state.
Definition: bitdecoder.h:178
Configuration parameter for BitDecoder that enables odd parity checking.
Definition: bitdecoder.h:128
Configuration parameter for BitDecoder that leads to new bits being added with LSB bit numbering (lea...
Definition: bitdecoder.h:91
BitDecoder base implementation.
Definition: bitdecoder.h:145
Configuration parameter for BitDecoder that disables parity checking.
Definition: bitdecoder.h:105
T getData() const
Returns the converted data.
Definition: bitdecoder.h:167
Configuration parameter for BitDecoder that leads to new bits being added with MSB bit numbering (mos...
Definition: bitdecoder.h:76