Arduino PulseWire Transceiver Library
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes
pulsewire::TxDriverCommon Class Reference

Provides common logic for transmitting signals using various framing modes. More...

#include <TxDriverCommon.h>

Inheritance diagram for pulsewire::TxDriverCommon:
Inheritance graph
[legend]
Collaboration diagram for pulsewire::TxDriverCommon:
Collaboration graph
[legend]

Public Member Functions

 TxDriverCommon (TxProtocol &protocol, Codec &codec, uint8_t pin, bool useChecksum=false)
 
virtual void init (TxProtocol &protocol, Codec &codec, uint8_t pin, bool useChecksum=false)
 
bool begin (uint16_t bitFrequencyHz) override
 
void setFrameSize (uint16_t size)
 Set the expected frame size for dynamic data transmission.
 
void setFramingMode (FramingMode mode) override
 
int write (uint8_t byte) override
 
size_t write (const uint8_t *data, size_t len)
 Build frames in the buffer and send when full.
 
void flush () override
 
virtual void end ()
 

Protected Member Functions

void sendPreamble ()
 
void sendData (const uint8_t *data, uint8_t len)
 
void sendEnd ()
 

Protected Attributes

Codec_codec = nullptr
 
TxProtocol_protocol = nullptr
 
RingBuffer< uint8_t_byteBuffer
 
uint16_t _frameSize = DEFAULT_FRAME_SIZE
 
FramingMode _framingMode = FramingMode::WriteBytes
 
uint16_t _bitFrequencyHz = DEFAULT_BIT_FREQ_HZ
 
bool _useChecksum = false
 
uint8_t check_sum = 0
 
uint8_t _pin = -1
 

Detailed Description

Provides common logic for transmitting signals using various framing modes.

The TxDriverCommon class is a foundational component for managing the transmission of signals. It integrates a specified TxProtocol and Codec implementation to handle the framing and buffering of data. The class is responsible for:

This class supports dynamic configuration of frame sizes, framing modes, and optional checksum appending for data integrity. It is designed to work with a specified transmission pin and bit frequency.

Note
The Codec handles the encoding of bytes into signal edges and timings, while the TxProtocol manages the protocol-specific details of the transmission.

Definition at line 36 of file TxDriverCommon.h.

Constructor & Destructor Documentation

◆ TxDriverCommon()

pulsewire::TxDriverCommon::TxDriverCommon ( TxProtocol protocol,
Codec codec,
uint8_t  pin,
bool  useChecksum = false 
)
inline
Parameters
codecIR codec
pinTX pin
signalSignal implementation
freqHzBit frequency
useChecksumIf true, append checksum to frame (default: false)

Definition at line 46 of file TxDriverCommon.h.

Member Function Documentation

◆ begin()

bool pulsewire::TxDriverCommon::begin ( uint16_t  bitFrequencyHz)
inlineoverridevirtual

Implements pulsewire::TxDriver.

Definition at line 62 of file TxDriverCommon.h.

◆ end()

virtual void pulsewire::TxDriver::end ( )
inlinevirtualinherited

Definition at line 26 of file TxDriver.h.

◆ flush()

void pulsewire::TxDriverCommon::flush ( )
inlineoverridevirtual

Reimplemented from pulsewire::TxDriver.

Definition at line 133 of file TxDriverCommon.h.

◆ init()

virtual void pulsewire::TxDriverCommon::init ( TxProtocol protocol,
Codec codec,
uint8_t  pin,
bool  useChecksum = false 
)
inlinevirtual

Definition at line 52 of file TxDriverCommon.h.

◆ sendData()

void pulsewire::TxDriverCommon::sendData ( const uint8_t data,
uint8_t  len 
)
inlineprotected

Definition at line 158 of file TxDriverCommon.h.

◆ sendEnd()

void pulsewire::TxDriverCommon::sendEnd ( )
inlineprotected

Definition at line 163 of file TxDriverCommon.h.

◆ sendPreamble()

void pulsewire::TxDriverCommon::sendPreamble ( )
inlineprotected

Definition at line 153 of file TxDriverCommon.h.

◆ setFrameSize()

void pulsewire::TxDriverCommon::setFrameSize ( uint16_t  size)
inlinevirtual

Set the expected frame size for dynamic data transmission.

Implements pulsewire::TxDriver.

Definition at line 72 of file TxDriverCommon.h.

◆ setFramingMode()

void pulsewire::TxDriverCommon::setFramingMode ( FramingMode  mode)
inlineoverridevirtual

Set the framing mode for how data is sent (e.g., fixed-size frames, immediate write, or flush)

Implements pulsewire::TxDriver.

Definition at line 82 of file TxDriverCommon.h.

◆ write() [1/2]

size_t pulsewire::TxDriverCommon::write ( const uint8_t data,
size_t  len 
)
inlinevirtual

Build frames in the buffer and send when full.

Implements pulsewire::TxDriver.

Definition at line 102 of file TxDriverCommon.h.

◆ write() [2/2]

int pulsewire::TxDriverCommon::write ( uint8_t  byte)
inlineoverridevirtual

Implements pulsewire::TxDriver.

Definition at line 84 of file TxDriverCommon.h.

Field Documentation

◆ _bitFrequencyHz

uint16_t pulsewire::TxDriverCommon::_bitFrequencyHz = DEFAULT_BIT_FREQ_HZ
protected

Definition at line 148 of file TxDriverCommon.h.

◆ _byteBuffer

RingBuffer<uint8_t> pulsewire::TxDriverCommon::_byteBuffer
protected

Definition at line 145 of file TxDriverCommon.h.

◆ _codec

Codec* pulsewire::TxDriverCommon::_codec = nullptr
protected

Definition at line 143 of file TxDriverCommon.h.

◆ _frameSize

uint16_t pulsewire::TxDriverCommon::_frameSize = DEFAULT_FRAME_SIZE
protected

Definition at line 146 of file TxDriverCommon.h.

◆ _framingMode

FramingMode pulsewire::TxDriverCommon::_framingMode = FramingMode::WriteBytes
protected

Definition at line 147 of file TxDriverCommon.h.

◆ _pin

uint8_t pulsewire::TxDriverCommon::_pin = -1
protected

Definition at line 151 of file TxDriverCommon.h.

◆ _protocol

TxProtocol* pulsewire::TxDriverCommon::_protocol = nullptr
protected

Definition at line 144 of file TxDriverCommon.h.

◆ _useChecksum

bool pulsewire::TxDriverCommon::_useChecksum = false
protected

Definition at line 149 of file TxDriverCommon.h.

◆ check_sum

uint8_t pulsewire::TxDriverCommon::check_sum = 0
protected

Definition at line 150 of file TxDriverCommon.h.


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