Yate
Public Member Functions | List of all members
BitAccumulator Class Reference

A 1-byte length bit accumulator. More...

#include <yatemodem.h>

Public Member Functions

 BitAccumulator (unsigned char dataBits)
 
unsigned char dataBits () const
 
void dataBits (unsigned char value)
 
unsigned char reset (bool *oddParity=0)
 
unsigned int accumulate (bool bit, bool *oddParity=0)
 

Detailed Description

A 1-byte length bit accumulator.

This class encapsulates an 8 bits length buffer used to accumulate bits

Constructor & Destructor Documentation

◆ BitAccumulator()

BitAccumulator ( unsigned char  dataBits)
inline

Constructor

Parameters
dataBitsThe buffer size. Values interval 1..8

Member Function Documentation

◆ accumulate()

unsigned int accumulate ( bool  bit,
bool *  oddParity = 0 
)
inline

Accumulate a bit. Reset accumulator when full

Parameters
bitThe bit value to accumulate
oddParityOptional pointer to get the data parity when full
Returns
The accumulated byte or a value greater then 255 if incomplete

◆ dataBits() [1/2]

unsigned char dataBits ( ) const
inline

Get the buffer size

Returns
The buffer size

◆ dataBits() [2/2]

void dataBits ( unsigned char  value)
inline

Set the buffer size. Reset the accumulator

Parameters
valueThe new buffer size. Values interval 1..8

◆ reset()

unsigned char reset ( bool *  oddParity = 0)
inline

Reset the accumulator. Returns the old data

Parameters
oddParityOptional pointer to get the parity of old data
Returns
The old data

The documentation for this class was generated from the following file: