|
Arduino PulseWire Transceiver Library
|
Generic implementation that is supported by all Arduino cores. More...
#include <TxProtocol.h>


Public Member Functions | |
| TxProtocolGeneric (SignalBase *p_signal) | |
Constructs a TxProtocolGeneric instance with the specified signal implementation. | |
| bool | begin (uint16_t bitFrequencyHz, Codec *p_codec, uint8_t pin) |
| Initializes the protocol with the specified codec and transmission pin. | |
| void | setFrameSize (uint16_t size) |
| Configures the size of the data to be transmitted. | |
| void | sendPreamble () |
| Sends the preamble for the transmission. | |
| void | sendData (const uint8_t *data, uint8_t len) |
| Encodes and transmits the data. | |
| void | sendEnd (bool &_useChecksum, bool isDelayAfterFrame) |
| Sends the end signal for the transmission. | |
| bool | isFrameClosed () const |
| Checks whether the transmission frame is closed. | |
Protected Member Functions | |
| void | delayUs (uint32_t us) |
Protected Attributes | |
| uint8_t | check_sum = 0 |
| Checksum for data integrity. | |
| bool | is_frame_closed = true |
| Indicates whether the frame is closed. | |
| SignalBase * | p_signal = nullptr |
| Pointer to the signal implementation. | |
| Vector< OutputEdge > | _output_buffer |
| Buffer for storing encoded signal edges. | |
| Codec * | _codec = nullptr |
| Pointer to the codec used for encoding data. | |
| uint16_t | _bitFrequencyHz = 0 |
| uint16_t | _bitPeriod = 0 |
Generic implementation that is supported by all Arduino cores.
The TxProtocolGeneric class provides a concrete implementation of the TxProtocol interface, enabling the transmission of data using a specified SignalBase implementation. It handles the encoding of data, preamble, and checksum, and manages the state of the transmission frame.
Responsibilities of the TxProtocolGeneric class include:
This class is designed to work with a SignalBase implementation for physical signal transmission and a Codec for encoding data into signal edges and timings.
Definition at line 154 of file TxProtocol.h.
|
inline |
Constructs a TxProtocolGeneric instance with the specified signal implementation.
| p_signal | Pointer to the SignalBase implementation for signal transmission. |
Definition at line 162 of file TxProtocol.h.
|
inlinevirtual |
Initializes the protocol with the specified codec and transmission pin.
| p_codec | Pointer to the Codec used for encoding data. |
| pin | Transmission pin for the signal. |
Implements pulsewire::TxProtocol.
Definition at line 170 of file TxProtocol.h.
Definition at line 304 of file TxProtocol.h.
|
inlinevirtual |
Checks whether the transmission frame is closed.
true if the frame is closed, false otherwise. Implements pulsewire::TxProtocol.
Definition at line 292 of file TxProtocol.h.
Encodes and transmits the data.
| data | Pointer to the data to be transmitted. |
| len | Length of the data in bytes. |
| bitPeriod | Duration of each bit in microseconds. |
Implements pulsewire::TxProtocol.
Definition at line 224 of file TxProtocol.h.
|
inlinevirtual |
Sends the end signal for the transmission.
Optionally includes a checksum and adds a delay to signify the end of the frame.
| _useChecksum | Whether to include the checksum in the transmission. |
| isDelayAfterFrame | Whether to add a delay after the frame. |
| bitPeriod | Duration of each bit in microseconds. |
Implements pulsewire::TxProtocol.
Definition at line 254 of file TxProtocol.h.
|
inlinevirtual |
Sends the preamble for the transmission.
The preamble is encoded using the codec and transmitted using the signal implementation. The checksum is reset at the start of a new frame.
Implements pulsewire::TxProtocol.
Definition at line 195 of file TxProtocol.h.
Configures the size of the data to be transmitted.
| size | The size of the data in bytes. |
Implements pulsewire::TxProtocol.
Definition at line 183 of file TxProtocol.h.
|
protected |
Definition at line 301 of file TxProtocol.h.
|
protected |
Definition at line 302 of file TxProtocol.h.
Pointer to the codec used for encoding data.
Definition at line 300 of file TxProtocol.h.
|
protected |
Buffer for storing encoded signal edges.
Definition at line 299 of file TxProtocol.h.
|
protected |
Checksum for data integrity.
Definition at line 295 of file TxProtocol.h.
Indicates whether the frame is closed.
Definition at line 296 of file TxProtocol.h.
|
protected |
Pointer to the signal implementation.
Definition at line 297 of file TxProtocol.h.