Arduino PulseWire Transceiver Library
Loading...
Searching...
No Matches
Public Member Functions | Static Protected Member Functions | Protected Attributes
pulsewire::RxDriverESP32 Class Referenceabstract

High-performance ESP32 IR RX driver using the RMT peripheral and Manchester decoding. More...

#include <RxDriverESP32.h>

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

Public Member Functions

 RxDriverESP32 (ManchesterCodec &codec, uint8_t pin, uint32_t freqHz=DEFAULT_BIT_FREQ_HZ, bool useChecksum=false, uint32_t timeoutUs=5000)
 
void setFrameSize (uint8_t size) override
 
void setRxBufferSize (size_t size) override
 Set the size of the internal RX buffer.
 
bool begin (uint8_t frameSize) override
 
bool begin () override
 
void end () override
 Stop the receiver.
 
size_t readBytes (uint8_t *buffer, size_t length) override
 
int available () override
 Get the number of bytes available in the internal buffer.
 
virtual void setFrameSize (uint16_t size)=0
 Set the expected frame size for dynamic data reception.
 
virtual bool begin (uint16_t bitFrequencyHz)=0
 Start the receiver.
 

Static Protected Member Functions

static void rxTask (void *arg)
 FreeRTOS task for receiving and decoding IR frames using ESP32 RMT.
 

Protected Attributes

size_t _rxBufferSize = 256
 
uint8_t _rxPin
 
uint16_t _frameSize = DEFAULT_FRAME_SIZE
 
uint32_t _freqHz
 
rmt_channel_handle_t _rxChannel = nullptr
 
TaskHandle_t _taskHandle = nullptr
 
volatile bool _stopTask = false
 
uint16_t _preambleBits = 0
 
bool _inFrame = false
 
QueueHandle_t _frameQueue = nullptr
 
RingBuffer< uint8_trxOverflow
 
ManchesterCodec_codec
 
Vector< uint8_tmanchesterBits
 
bool _useChecksum = false
 
uint32_t _timeoutUs = 5000
 
uint32_t _lastSymbolTime = 0
 

Detailed Description

High-performance ESP32 IR RX driver using the RMT peripheral and Manchester decoding.

Note
Supports sending and receiving on the same microcontroller without conflicts.

Definition at line 43 of file RxDriverESP32.h.

Constructor & Destructor Documentation

◆ RxDriverESP32()

pulsewire::RxDriverESP32::RxDriverESP32 ( ManchesterCodec codec,
uint8_t  pin,
uint32_t  freqHz = DEFAULT_BIT_FREQ_HZ,
bool  useChecksum = false,
uint32_t  timeoutUs = 5000 
)
inline
Parameters
codecIR codec
pinRX pin
freqHzBit frequency
useChecksumIf true, validate checksum (default: false)
timeoutUsTimeout in microseconds to flush frame if no symbol received (default: 5000)

Definition at line 52 of file RxDriverESP32.h.

Member Function Documentation

◆ available()

int pulsewire::RxDriverESP32::available ( )
inlineoverridevirtual

Get the number of bytes available in the internal buffer.

Implements pulsewire::RxDriver.

Definition at line 159 of file RxDriverESP32.h.

◆ begin() [1/3]

bool pulsewire::RxDriverESP32::begin ( )
inlineoverride

Definition at line 67 of file RxDriverESP32.h.

◆ begin() [2/3]

virtual bool pulsewire::RxDriver::begin ( uint16_t  bitFrequencyHz)
pure virtualinherited

Start the receiver.

Implemented in pulsewire::RxDriverArduino.

◆ begin() [3/3]

bool pulsewire::RxDriverESP32::begin ( uint8_t  frameSize)
inlineoverride

Definition at line 62 of file RxDriverESP32.h.

◆ end()

void pulsewire::RxDriverESP32::end ( )
inlineoverridevirtual

Stop the receiver.

Implements pulsewire::RxDriver.

Definition at line 115 of file RxDriverESP32.h.

◆ readBytes()

size_t pulsewire::RxDriverESP32::readBytes ( uint8_t data,
size_t  size 
)
inlineoverridevirtual

Read up to 'size' bytes from the internal buffer into 'data'. Returns number of bytes read.

Implements pulsewire::RxDriver.

Definition at line 130 of file RxDriverESP32.h.

◆ rxTask()

static void pulsewire::RxDriverESP32::rxTask ( void arg)
inlinestaticprotected

FreeRTOS task for receiving and decoding IR frames using ESP32 RMT.

This method is protocol-agnostic: it processes each RMT symbol by summing durations and inferring the logic level, then passes these to the codec's decodeEdge method. As long as the codec implements decodeEdge for its protocol, this works for Manchester, PulseWidth, PulseDistance, etc.

Parameters
argPointer to RxDriverESP32 instance.

Definition at line 192 of file RxDriverESP32.h.

◆ setFrameSize() [1/2]

virtual void pulsewire::RxDriver::setFrameSize ( uint16_t  size)
pure virtualinherited

Set the expected frame size for dynamic data reception.

Implemented in pulsewire::RxDriverArduino.

◆ setFrameSize() [2/2]

void pulsewire::RxDriverESP32::setFrameSize ( uint8_t  size)
inlineoverride

Definition at line 58 of file RxDriverESP32.h.

◆ setRxBufferSize()

void pulsewire::RxDriverESP32::setRxBufferSize ( size_t  size)
inlineoverridevirtual

Set the size of the internal RX buffer.

Implements pulsewire::RxDriver.

Definition at line 60 of file RxDriverESP32.h.

Field Documentation

◆ _codec

ManchesterCodec& pulsewire::RxDriverESP32::_codec
protected

Definition at line 176 of file RxDriverESP32.h.

◆ _frameQueue

QueueHandle_t pulsewire::RxDriverESP32::_frameQueue = nullptr
protected

Definition at line 174 of file RxDriverESP32.h.

◆ _frameSize

uint16_t pulsewire::RxDriverESP32::_frameSize = DEFAULT_FRAME_SIZE
protected

Definition at line 167 of file RxDriverESP32.h.

◆ _freqHz

uint32_t pulsewire::RxDriverESP32::_freqHz
protected

Definition at line 168 of file RxDriverESP32.h.

◆ _inFrame

bool pulsewire::RxDriverESP32::_inFrame = false
protected

Definition at line 173 of file RxDriverESP32.h.

◆ _lastSymbolTime

uint32_t pulsewire::RxDriverESP32::_lastSymbolTime = 0
protected

Definition at line 180 of file RxDriverESP32.h.

◆ _preambleBits

uint16_t pulsewire::RxDriverESP32::_preambleBits = 0
protected

Definition at line 172 of file RxDriverESP32.h.

◆ _rxBufferSize

size_t pulsewire::RxDriverESP32::_rxBufferSize = 256
protected

Definition at line 165 of file RxDriverESP32.h.

◆ _rxChannel

rmt_channel_handle_t pulsewire::RxDriverESP32::_rxChannel = nullptr
protected

Definition at line 169 of file RxDriverESP32.h.

◆ _rxPin

uint8_t pulsewire::RxDriverESP32::_rxPin
protected

Definition at line 166 of file RxDriverESP32.h.

◆ _stopTask

volatile bool pulsewire::RxDriverESP32::_stopTask = false
protected

Definition at line 171 of file RxDriverESP32.h.

◆ _taskHandle

TaskHandle_t pulsewire::RxDriverESP32::_taskHandle = nullptr
protected

Definition at line 170 of file RxDriverESP32.h.

◆ _timeoutUs

uint32_t pulsewire::RxDriverESP32::_timeoutUs = 5000
protected

Definition at line 179 of file RxDriverESP32.h.

◆ _useChecksum

bool pulsewire::RxDriverESP32::_useChecksum = false
protected

Definition at line 178 of file RxDriverESP32.h.

◆ manchesterBits

Vector<uint8_t> pulsewire::RxDriverESP32::manchesterBits
protected

Definition at line 177 of file RxDriverESP32.h.

◆ rxOverflow

RingBuffer<uint8_t> pulsewire::RxDriverESP32::rxOverflow
protected

Definition at line 175 of file RxDriverESP32.h.


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