libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::ESP32UART Class Reference

ESP32 UART backend with FIFO and optional GDMA fast paths. More...

#include <esp_uart.hpp>

Inheritance diagram for LibXR::ESP32UART:
[legend]
Collaboration diagram for LibXR::ESP32UART:
[legend]

Public Member Functions

 ESP32UART (uart_port_t uart_num, int tx_pin, int rx_pin, int rts_pin=PIN_NO_CHANGE, int cts_pin=PIN_NO_CHANGE, size_t rx_buffer_size=1024, size_t tx_buffer_size=512, uint32_t tx_queue_size=5, UART::Configuration config={115200, UART::Parity::NO_PARITY, 8, 1}, bool enable_dma=true)
 Create and initialize one ESP32 UART instance.
 
ErrorCode SetConfig (UART::Configuration config) override
 Apply a new UART framing and baud configuration.
 
ErrorCode SetLoopback (bool enable)
 Toggle UART peripheral internal loopback mode.
 
- Public Member Functions inherited from LibXR::UART
template<typename ReadPortType = ReadPort, typename WritePortType = WritePort>
 UART (ReadPortType *read_port, WritePortType *write_port)
 UART 构造函数 / UART constructor.
 
template<typename OperationType , typename = std::enable_if_t<std::is_base_of_v< WriteOperation, std::decay_t<OperationType>>>>
ErrorCode Write (ConstRawData data, OperationType &&op, bool in_isr=false)
 
template<typename OperationType , typename = std::enable_if_t<std::is_base_of_v< ReadOperation, std::decay_t<OperationType>>>>
ErrorCode Read (RawData data, OperationType &&op, bool in_isr=false)
 

Static Public Member Functions

static ErrorCode WriteFun (WritePort &port, bool in_isr)
 Queue-driven TX entry used by WritePort.
 
static ErrorCode ReadFun (ReadPort &port, bool in_isr)
 Queue-driven RX entry used by ReadPort.
 

Static Public Attributes

static constexpr int PIN_NO_CHANGE = -1
 Sentinel for an unmapped GPIO.
 

Private Member Functions

void OnConfigRequested ()
 
bool ApplyPendingConfig (bool in_isr)
 
bool OnConfigApplied (bool in_isr)
 
ErrorCode InitUartHardware ()
 Initialize UART hardware and base HAL state.
 
ErrorCode ConfigurePins ()
 Configure the selected GPIO pins.
 
ErrorCode InstallUartIsr ()
 Install the UART interrupt handler.
 
void ConfigureRxInterruptPath ()
 Program RX interrupt thresholds and masks.
 
bool StartDmaTx (uint8_t *data, size_t size, int block)
 
ErrorCode TryStartTx (bool in_isr)
 Try to start queued transmit work.
 
bool LoadActiveTxFromQueue (bool in_isr)
 Load one active TX request from the queue.
 
bool DequeueFifoTx (size_t &size, WriteInfoBlock &info)
 Claim one queued request for the FIFO TX backend.
 
bool StartActiveTransfer (bool in_isr)
 Start the active request on the selected TX backend.
 
bool StartAndReportActive (bool in_isr)
 Start the active request and report queue completion ownership.
 
void ClearActiveTx ()
 Clear active TX state.
 
void FillTxFifo (bool in_isr)
 Drain active TX bytes into the UART FIFO backend.
 
void PushRxBytes (const uint8_t *data, size_t size, bool in_isr)
 Push RX bytes into the software queue.
 
void DrainRxFifo (bool in_isr)
 Drain pending bytes from the hardware RX FIFO.
 
void HandleRxInterrupt (uint32_t uart_intr_status)
 Handle RX-side UART interrupt reasons.
 
void HandleTxInterrupt (uint32_t uart_intr_status)
 Handle TX-side UART interrupt reasons.
 
void HandleUartInterrupt ()
 Dispatch pending UART interrupt reasons.
 
void OnTxTransferDone (bool in_isr, ErrorCode result)
 Finalize one TX transfer result.
 

Static Private Member Functions

static uint8_t * AllocateTxStorage (size_t size)
 Allocate DMA-capable backing storage for TX buffers.
 
static ErrorCode ResolveUartPeriph (uart_port_t uart_num, periph_module_t &out)
 Map one UART index to its peripheral module.
 
static bool ResolveWordLength (uint8_t data_bits, uart_word_length_t &out)
 Convert configured data bits into the HAL enum.
 
static bool ResolveStopBits (uint8_t stop_bits, uart_stop_bits_t &out)
 Convert configured stop bits into the HAL enum.
 
static uart_parity_t ResolveParity (UART::Parity parity)
 Convert configured parity into the HAL enum.
 
static void UartIsrEntry (void *arg)
 UART ISR trampoline.
 

Private Attributes

uart_port_t uart_num_
 Selected UART peripheral index.
 
int tx_pin_
 TX GPIO pin or PIN_NO_CHANGE.
 
int rx_pin_
 RX GPIO pin or PIN_NO_CHANGE.
 
int rts_pin_
 RTS GPIO pin or PIN_NO_CHANGE.
 
int cts_pin_
 CTS GPIO pin or PIN_NO_CHANGE.
 
UART::Configuration config_
 Current UART framing configuration.
 
LatestSnapshot< UART::Configurationrequested_config_
 
UartRxConfigGate rx_config_gate_
 
uint8_t * rx_isr_buffer_ = nullptr
 Scratch buffer used by the RX ISR path.
 
size_t rx_isr_buffer_size_ = 0
 Size of rx_isr_buffer_.
 
uint8_t * tx_storage_ = nullptr
 Backing storage for the TX half-buffers.
 
WriteInfoBlock tx_active_info_ = {}
 Metadata for the active TX request.
 
size_t tx_active_length_ = 0U
 Active TX payload length in bytes.
 
size_t tx_active_offset_ = 0U
 Bytes already emitted for the active request.
 
bool tx_active_valid_ = false
 Whether the active TX metadata is valid.
 
Flag::Plain tx_busy_
 Hardware TX engine currently owns the request.
 
Flag::Plain in_tx_isr_
 Reentry guard while processing TX ISR work.
 
bool uart_hw_enabled_ = false
 UART hardware block was initialized.
 
uart_hal_context_t uart_hal_ = {}
 ESP-IDF UART HAL context.
 
intr_handle_t uart_intr_handle_ = nullptr
 Registered UART interrupt handle.
 
bool uart_isr_installed_ = false
 UART ISR installation state.
 
bool dma_requested_ = true
 Constructor preference for DMA mode.
 
ESP32UARTReadPort _read_port
 Read-side queue bridge exposed to UART.
 
WritePort _write_port
 Write-side queue bridge exposed to UART.
 
UartDmaTxModel< ESP32UARTtx_dma_model_
 One-shot DMA TX execution model.
 

Friends

class ESP32UARTReadPort
 
class UartDmaTxModel< ESP32UART >
 

Additional Inherited Members

- Public Types inherited from LibXR::UART
enum class  Parity : uint8_t { NO_PARITY = 0 , EVEN = 1 , ODD = 2 }
 奇偶校验模式 / Parity mode More...
 
- Data Fields inherited from LibXR::UART
ReadPortread_port_
 读取端口 / Read port
 
WritePortwrite_port_
 写入端口 / Write port
 

Detailed Description

ESP32 UART backend with FIFO and optional GDMA fast paths.

ESP32 UART 后端,支持 FIFO 和可选 GDMA 快路径。

The object owns the UART hardware state, software queue plumbing, and the optional DMA resources used by the ESP-specific transmit and receive paths. 该对象持有 UART 硬件状态、软件队列连接,以及 ESP 专用收发路径使用的可选 DMA 资源。

Definition at line 78 of file esp_uart.hpp.

Constructor & Destructor Documentation

◆ ESP32UART()

LibXR::ESP32UART::ESP32UART ( uart_port_t uart_num,
int tx_pin,
int rx_pin,
int rts_pin = PIN_NO_CHANGE,
int cts_pin = PIN_NO_CHANGE,
size_t rx_buffer_size = 1024,
size_t tx_buffer_size = 512,
uint32_t tx_queue_size = 5,
UART::Configuration config = {115200, UART::Parity::NO_PARITY, 8, 1},
bool enable_dma = true )

Create and initialize one ESP32 UART instance.

创建并初始化一个 ESP32 UART 实例。

Definition at line 104 of file esp_uart.cpp.

108 uart_num_(uart_num),
109 tx_pin_(tx_pin),
110 rx_pin_(rx_pin),
111 rts_pin_(rts_pin),
112 cts_pin_(cts_pin),
113 config_(config),
114 requested_config_(config),
115 rx_isr_buffer_(new uint8_t[rx_buffer_size]),
116 rx_isr_buffer_size_(rx_buffer_size),
117 tx_storage_(AllocateTxStorage(tx_buffer_size * 2)),
118 dma_requested_(enable_dma),
119 _read_port(rx_buffer_size, *this),
120 _write_port(tx_queue_size, tx_buffer_size),
121 tx_dma_model_(*this, _write_port, RawData(tx_storage_, tx_buffer_size * 2U))
122{
123 ASSERT(!IsConsoleUartInUse(uart_num_));
124 ASSERT(uart_num_ < UART_NUM_MAX);
125 ASSERT(uart_num_ < SOC_UART_HP_NUM);
126 ASSERT(rx_isr_buffer_size_ > 0);
127 ASSERT(tx_buffer_size > 0);
128
131
133 {
134 ASSERT(false);
135 return;
136 }
137
138#if SOC_GDMA_SUPPORTED && SOC_UHCI_SUPPORTED
139 if (dma_requested_)
140 {
141 if (InitDmaBackend() != ErrorCode::OK)
142 {
143 ASSERT(false);
144 return;
145 }
146 }
147
148 if (!dma_backend_enabled_)
149 {
151 {
152 ASSERT(false);
153 return;
154 }
156 }
157#else
159 {
160 ASSERT(false);
161 return;
162 }
164#endif
165}
UART::Configuration config_
Current UART framing configuration.
Definition esp_uart.hpp:340
int rx_pin_
RX GPIO pin or PIN_NO_CHANGE.
Definition esp_uart.hpp:336
int tx_pin_
TX GPIO pin or PIN_NO_CHANGE.
Definition esp_uart.hpp:335
void ConfigureRxInterruptPath()
Program RX interrupt thresholds and masks.
Definition esp_uart.cpp:170
bool dma_requested_
Constructor preference for DMA mode.
Definition esp_uart.hpp:359
uint8_t * rx_isr_buffer_
Scratch buffer used by the RX ISR path.
Definition esp_uart.hpp:344
uint8_t * tx_storage_
Backing storage for the TX half-buffers.
Definition esp_uart.hpp:347
ErrorCode InitUartHardware()
Initialize UART hardware and base HAL state.
Definition esp_uart.cpp:411
size_t rx_isr_buffer_size_
Size of rx_isr_buffer_.
Definition esp_uart.hpp:345
WritePort _write_port
Write-side queue bridge exposed to UART.
Definition esp_uart.hpp:362
int cts_pin_
CTS GPIO pin or PIN_NO_CHANGE.
Definition esp_uart.hpp:338
int rts_pin_
RTS GPIO pin or PIN_NO_CHANGE.
Definition esp_uart.hpp:337
ESP32UARTReadPort _read_port
Read-side queue bridge exposed to UART.
Definition esp_uart.hpp:361
UartDmaTxModel< ESP32UART > tx_dma_model_
One-shot DMA TX execution model.
Definition esp_uart.hpp:363
static uint8_t * AllocateTxStorage(size_t size)
Allocate DMA-capable backing storage for TX buffers.
Definition esp_uart.cpp:66
uart_port_t uart_num_
Selected UART peripheral index.
Definition esp_uart.hpp:334
ErrorCode InstallUartIsr()
Install the UART interrupt handler.
UART(ReadPortType *read_port, WritePortType *write_port)
UART 构造函数 / UART constructor.
Definition uart.hpp:66
@ OK
操作成功 | Operation successful
ErrorCode(* ReadFun)(ReadPort &port, bool in_isr)
Function pointer type for read notifications.
ErrorCode(* WriteFun)(WritePort &port, bool in_isr)
Function pointer type for write operations.

Member Function Documentation

◆ AllocateTxStorage()

uint8_t * LibXR::ESP32UART::AllocateTxStorage ( size_t size)
staticprivate

Allocate DMA-capable backing storage for TX buffers.

为 TX buffer 分配可 DMA 访问的 backing storage。

Definition at line 66 of file esp_uart.cpp.

67{
68 void* aligned = heap_caps_aligned_alloc(
69 4, size, MALLOC_CAP_INTERNAL | MALLOC_CAP_DMA | MALLOC_CAP_8BIT);
70 if (aligned != nullptr)
71 {
72 return static_cast<uint8_t*>(aligned);
73 }
74
75 return static_cast<uint8_t*>(
76 heap_caps_malloc(size, MALLOC_CAP_INTERNAL | MALLOC_CAP_DMA | MALLOC_CAP_8BIT));
77}

◆ ApplyPendingConfig()

bool LibXR::ESP32UART::ApplyPendingConfig ( bool in_isr)
private

Definition at line 212 of file esp_uart.cpp.

213{
214 if (!rx_config_gate_.TryEnterConfig())
215 {
216 return false;
217 }
218
219 UART::Configuration config{};
220 (void)requested_config_.LoadLatest(config);
221
222 uart_word_length_t word_length = UART_DATA_8_BITS;
223 uart_stop_bits_t stop_bits = UART_STOP_BITS_1;
224 if (!ResolveWordLength(config.data_bits, word_length) ||
225 !ResolveStopBits(config.stop_bits, stop_bits))
226 {
227 DEV_ASSERT_FROM_CALLBACK(false, in_isr);
228 return true;
229 }
230
231#if SOC_GDMA_SUPPORTED && SOC_UHCI_SUPPORTED
232 if (dma_backend_enabled_ && (tx_dma_channel_ != nullptr))
233 {
234 gdma_stop(tx_dma_channel_);
235 gdma_reset(tx_dma_channel_);
236 }
237#endif
238
239 bool dma_backend_enabled = false;
240#if SOC_GDMA_SUPPORTED && SOC_UHCI_SUPPORTED
241 dma_backend_enabled = dma_backend_enabled_;
242#endif
243 if (!dma_backend_enabled)
244 {
245 uart_hal_disable_intr_mask(&uart_hal_, UART_TX_INTR_MASK);
246 tx_busy_.Clear();
248 }
249
250 const uart_sclk_t sclk = UART_SCLK_DEFAULT;
251 uart_hal_set_sclk(&uart_hal_, static_cast<soc_module_clk_t>(sclk));
252
253 uint32_t sclk_hz = 0;
254 if ((esp_clk_tree_src_get_freq_hz(static_cast<soc_module_clk_t>(sclk),
255 ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED,
256 &sclk_hz) != ESP_OK) ||
257 (sclk_hz == 0))
258 {
259 DEV_ASSERT_FROM_CALLBACK(false, in_isr);
260 return true;
261 }
262
263#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0)
264 if (!uart_hal_set_baudrate(&uart_hal_, config.baudrate, sclk_hz))
265 {
266 DEV_ASSERT_FROM_CALLBACK(false, in_isr);
267 return true;
268 }
269#else
270 uart_hal_set_baudrate(&uart_hal_, config.baudrate, sclk_hz);
271#endif
272
273 uart_hal_set_data_bit_num(&uart_hal_, word_length);
274 uart_hal_set_stop_bits(&uart_hal_, stop_bits);
275 uart_hal_set_parity(&uart_hal_, ResolveParity(config.parity));
276 uart_hal_set_hw_flow_ctrl(&uart_hal_, UART_HW_FLOWCTRL_DISABLE, 0);
277 uart_hal_set_mode(&uart_hal_, UART_MODE_UART);
278 uart_hal_set_txfifo_empty_thr(&uart_hal_, TX_EMPTY_THRESHOLD);
279 // Drop stale hardware RX FIFO bytes from the previous baud.
280 // Keep software read queue semantics aligned with ST/CH (no read_port reset).
281 uart_hal_rxfifo_rst(&uart_hal_);
282 uart_hal_clr_intsts_mask(&uart_hal_, UART_INTR_RXFIFO_FULL | UART_INTR_RXFIFO_TOUT);
283
284#if SOC_GDMA_SUPPORTED && SOC_UHCI_SUPPORTED
285 if (dma_backend_enabled_)
286 {
287 // Re-align the circular RX DMA window after reconfig to avoid
288 // carrying stale pre-switch bytes into the next frame.
289 HandleDmaRxError();
290 }
291#endif
292
293 config_ = config;
294 return true;
295}
Flag::Plain tx_busy_
Hardware TX engine currently owns the request.
Definition esp_uart.hpp:352
uart_hal_context_t uart_hal_
ESP-IDF UART HAL context.
Definition esp_uart.hpp:356
static uart_parity_t ResolveParity(UART::Parity parity)
Convert configured parity into the HAL enum.
Definition esp_uart.cpp:393
void ClearActiveTx()
Clear active TX state.
Definition esp_uart.cpp:511
static bool ResolveStopBits(uint8_t stop_bits, uart_stop_bits_t &out)
Convert configured stop bits into the HAL enum.
Definition esp_uart.cpp:376
static bool ResolveWordLength(uint8_t data_bits, uart_word_length_t &out)
Convert configured data bits into the HAL enum.
Definition esp_uart.cpp:353
void Clear() noexcept
清除标志 / Clear the flag
Definition flag.hpp:130

◆ ClearActiveTx()

void IRAM_ATTR LibXR::ESP32UART::ClearActiveTx ( )
private

Clear active TX state.

清除 active TX 状态。

Definition at line 511 of file esp_uart.cpp.

512{
515 tx_active_info_ = {};
516 tx_active_valid_ = false;
517}
bool tx_active_valid_
Whether the active TX metadata is valid.
Definition esp_uart.hpp:351
WriteInfoBlock tx_active_info_
Metadata for the active TX request.
Definition esp_uart.hpp:348
size_t tx_active_offset_
Bytes already emitted for the active request.
Definition esp_uart.hpp:350
size_t tx_active_length_
Active TX payload length in bytes.
Definition esp_uart.hpp:349

◆ ConfigurePins()

ErrorCode LibXR::ESP32UART::ConfigurePins ( )
private

Configure the selected GPIO pins.

配置选定的 GPIO 引脚。

Definition at line 459 of file esp_uart.cpp.

460{
461 if (tx_pin_ >= 0)
462 {
463 if (!GPIO_IS_VALID_OUTPUT_GPIO(tx_pin_))
464 {
465 return ErrorCode::ARG_ERR;
466 }
467 esp_rom_gpio_pad_select_gpio(static_cast<uint32_t>(tx_pin_));
468 esp_rom_gpio_connect_out_signal(
469 tx_pin_, UART_PERIPH_SIGNAL(uart_num_, SOC_UART_TX_PIN_IDX), false, false);
470 }
471
472 if (rx_pin_ >= 0)
473 {
474 if (!GPIO_IS_VALID_GPIO(rx_pin_))
475 {
476 return ErrorCode::ARG_ERR;
477 }
478 gpio_input_enable(static_cast<gpio_num_t>(rx_pin_));
479 esp_rom_gpio_connect_in_signal(
480 rx_pin_, UART_PERIPH_SIGNAL(uart_num_, SOC_UART_RX_PIN_IDX), false);
481 }
482
483 if (rts_pin_ >= 0)
484 {
485 if (!GPIO_IS_VALID_OUTPUT_GPIO(rts_pin_))
486 {
487 return ErrorCode::ARG_ERR;
488 }
489 esp_rom_gpio_pad_select_gpio(static_cast<uint32_t>(rts_pin_));
490 esp_rom_gpio_connect_out_signal(
491 rts_pin_, UART_PERIPH_SIGNAL(uart_num_, SOC_UART_RTS_PIN_IDX), false, false);
492 }
493
494 if (cts_pin_ >= 0)
495 {
496 if (!GPIO_IS_VALID_GPIO(cts_pin_))
497 {
498 return ErrorCode::ARG_ERR;
499 }
500 gpio_pullup_en(static_cast<gpio_num_t>(cts_pin_));
501 gpio_input_enable(static_cast<gpio_num_t>(cts_pin_));
502 esp_rom_gpio_connect_in_signal(
503 cts_pin_, UART_PERIPH_SIGNAL(uart_num_, SOC_UART_CTS_PIN_IDX), false);
504 }
505
506 return ErrorCode::OK;
507}
@ ARG_ERR
参数错误 | Argument error

◆ ConfigureRxInterruptPath()

void LibXR::ESP32UART::ConfigureRxInterruptPath ( )
private

Program RX interrupt thresholds and masks.

配置 RX 中断阈值和掩码。

Definition at line 170 of file esp_uart.cpp.

171{
172 const uint16_t full_thr = static_cast<uint16_t>(SOC_UART_FIFO_LEN / 2U);
173
174 uart_hal_set_rxfifo_full_thr(&uart_hal_, full_thr);
175 uart_hal_set_rx_timeout(&uart_hal_, RX_TOUT_THRESHOLD);
176 uart_hal_clr_intsts_mask(&uart_hal_, UART_RX_INTR_MASK);
177 uart_hal_ena_intr_mask(&uart_hal_, UART_RX_INTR_MASK);
178}

◆ DequeueFifoTx()

bool IRAM_ATTR LibXR::ESP32UART::DequeueFifoTx ( size_t & size,
WriteInfoBlock & info )
private

Claim one queued request for the FIFO TX backend.

为 FIFO TX 后端认领一个排队请求。

Definition at line 596 of file esp_uart.cpp.

597{
598 WriteInfoBlock peek_info = {};
599 if (write_port_->queue_info_->Peek(peek_info) != ErrorCode::OK)
600 {
601 return false;
602 }
603
604 size_t max_size = write_port_->queue_data_->MaxSize();
605 if (peek_info.data.size_ > max_size)
606 {
607 ASSERT(false);
608 return false;
609 }
610
611 if (write_port_->queue_info_->Pop(info) != ErrorCode::OK)
612 {
613 return false;
614 }
615
616 size = peek_info.data.size_;
617 return true;
618}
size_t MaxSize() const
获取队列最大容量 / Get the maximum queue capacity
WritePort * write_port_
写入端口 / Write port
Definition uart.hpp:54
SPSCQueue< WriteInfoBlock > * queue_info_
Metadata queue for pending write batches. 挂起写批次的元数据队列。
SPSCQueue< uint8_t > * queue_data_
Payload queue for pending write bytes. 挂起写入字节的数据队列。

◆ DrainRxFifo()

void IRAM_ATTR LibXR::ESP32UART::DrainRxFifo ( bool in_isr)
private

Drain pending bytes from the hardware RX FIFO.

从硬件 RX FIFO 中取出待处理字节。

Definition at line 118 of file esp_uart_fifo.cpp.

119{
120 if (!rx_config_gate_.TryEnterRx())
121 {
122 return;
123 }
124
125 bool pushed_any = false;
126 while (uart_hal_get_rxfifo_len(&uart_hal_) > 0U)
127 {
128 const size_t fifo_len = uart_hal_get_rxfifo_len(&uart_hal_);
129 const size_t write_len = std::min(fifo_len, read_port_->queue_data_->EmptySize());
130 if (write_len == 0U)
131 {
132 break;
133 }
134
136 write_len,
137 [this](uint8_t* buffer, size_t chunk_size) -> ErrorCode
138 {
139 int read_len = static_cast<int>(chunk_size);
140 uart_hal_read_rxfifo(&uart_hal_, buffer, &read_len);
141 return (read_len == static_cast<int>(chunk_size)) ? ErrorCode::OK
143 });
144
145 if ((push_ec == ErrorCode::FULL) || (push_ec == ErrorCode::EMPTY))
146 {
147 break;
148 }
149 if (push_ec != ErrorCode::OK)
150 {
151 ASSERT(false);
152 break;
153 }
154
155 pushed_any = true;
156 }
157
158 if (pushed_any)
159 {
161 }
162
163 if (rx_config_gate_.LeaveRx())
164 {
165 tx_dma_model_.RequestConfig(in_isr);
166 }
167}
SPSCQueue< uint8_t > * queue_data_
RX payload queue. 接收数据字节队列。
Definition read_port.hpp:55
void ProcessPendingReads(bool in_isr)
Processes pending reads.
size_t EmptySize() const
获取剩余空槽数 / Get the current free-slot count
ErrorCode PushWithWriter(Writer &&writer)
通过写入器回调推入一个 payload。
ReadPort * read_port_
读取端口 / Read port
Definition uart.hpp:53
ErrorCode
定义错误码枚举
@ EMPTY
为空 | Empty
@ FULL
已满 | Full

◆ FillTxFifo()

void IRAM_ATTR LibXR::ESP32UART::FillTxFifo ( bool in_isr)
private

Drain active TX bytes into the UART FIFO backend.

将 active TX 字节排入 UART FIFO 后端。

Definition at line 68 of file esp_uart_fifo.cpp.

69{
71 {
72 return;
73 }
74
76 {
77 const uint32_t fifo_space = uart_hal_get_txfifo_len(&uart_hal_);
78 if (fifo_space == 0U)
79 {
80 break;
81 }
82
83 const size_t remaining = tx_active_length_ - tx_active_offset_;
84 const size_t chunk_size = std::min<size_t>(remaining, fifo_space);
85
87 chunk_size,
88 [this](const uint8_t* src, size_t size) -> ErrorCode
89 {
90 uint32_t write_size = 0;
91 uart_hal_write_txfifo(&uart_hal_, src, static_cast<uint32_t>(size),
92 &write_size);
93 return (write_size == static_cast<uint32_t>(size)) ? ErrorCode::OK
95 });
96 if (pop_ec != ErrorCode::OK)
97 {
98 ASSERT(false);
99 break;
100 }
101
102 tx_active_offset_ += chunk_size;
103 }
104
105 if ((tx_active_offset_ < tx_active_length_) || !in_isr)
106 {
107 return;
108 }
109
110 uart_hal_disable_intr_mask(&uart_hal_, UART_INTR_TXFIFO_EMPTY);
112}
void OnTxTransferDone(bool in_isr, ErrorCode result)
Finalize one TX transfer result.
Definition esp_uart.cpp:686
ErrorCode PopWithReader(Reader &&reader)
通过读取器回调弹出一个 payload。

◆ HandleRxInterrupt()

void IRAM_ATTR LibXR::ESP32UART::HandleRxInterrupt ( uint32_t uart_intr_status)
private

Handle RX-side UART interrupt reasons.

处理 RX 侧 UART 中断原因。

Definition at line 173 of file esp_uart_fifo.cpp.

174{
175 const bool has_overflow = (uart_intr_status & UART_INTR_RXFIFO_OVF) != 0U;
176 const bool has_rx_data =
177 (uart_intr_status & (UART_INTR_RXFIFO_FULL | UART_INTR_RXFIFO_TOUT)) != 0U;
178
179 if (!has_overflow && !has_rx_data)
180 {
181 return;
182 }
183
184 if (has_overflow)
185 {
186 // Overrun means at least one incoming byte was dropped. Keep remaining FIFO
187 // bytes to minimize extra loss instead of resetting the whole RX FIFO.
188 uart_hal_clr_intsts_mask(&uart_hal_, UART_INTR_RXFIFO_OVF);
189 }
190
191 DrainRxFifo(true);
192 uart_hal_clr_intsts_mask(&uart_hal_, UART_INTR_RXFIFO_FULL | UART_INTR_RXFIFO_TOUT);
193}
void DrainRxFifo(bool in_isr)
Drain pending bytes from the hardware RX FIFO.

◆ HandleTxInterrupt()

void IRAM_ATTR LibXR::ESP32UART::HandleTxInterrupt ( uint32_t uart_intr_status)
private

Handle TX-side UART interrupt reasons.

处理 TX 侧 UART 中断原因。

Definition at line 198 of file esp_uart_fifo.cpp.

199{
200 if ((uart_intr_status & UART_INTR_TXFIFO_EMPTY) == 0U)
201 {
202 return;
203 }
204
205 Flag::ScopedRestore tx_flag(in_tx_isr_);
206 FillTxFifo(true);
207 uart_hal_clr_intsts_mask(&uart_hal_, UART_INTR_TXFIFO_EMPTY);
208}
void FillTxFifo(bool in_isr)
Drain active TX bytes into the UART FIFO backend.
Flag::Plain in_tx_isr_
Reentry guard while processing TX ISR work.
Definition esp_uart.hpp:353

◆ HandleUartInterrupt()

void IRAM_ATTR LibXR::ESP32UART::HandleUartInterrupt ( )
private

Dispatch pending UART interrupt reasons.

分发待处理的 UART 中断原因。

Definition at line 214 of file esp_uart_fifo.cpp.

215{
216 uint32_t uart_intr_status = uart_hal_get_intsts_mask(&uart_hal_);
217
218 while (uart_intr_status != 0)
219 {
220 if (uart_intr_status & UART_RX_INTR_MASK)
221 {
222 HandleRxInterrupt(uart_intr_status);
223 }
224
225 if (uart_intr_status & UART_TX_INTR_MASK)
226 {
227 HandleTxInterrupt(uart_intr_status);
228 }
229
230 uart_intr_status = uart_hal_get_intsts_mask(&uart_hal_);
231 }
232}
void HandleTxInterrupt(uint32_t uart_intr_status)
Handle TX-side UART interrupt reasons.
void HandleRxInterrupt(uint32_t uart_intr_status)
Handle RX-side UART interrupt reasons.

◆ InitUartHardware()

ErrorCode LibXR::ESP32UART::InitUartHardware ( )
private

Initialize UART hardware and base HAL state.

初始化 UART 硬件和基础 HAL 状态。

Definition at line 411 of file esp_uart.cpp.

412{
413 if (uart_num_ >= UART_NUM_MAX)
414 {
416 }
417
418 periph_module_t uart_module = PERIPH_MODULE_MAX;
419 if (ResolveUartPeriph(uart_num_, uart_module) != ErrorCode::OK)
420 {
422 }
423
424 uart_hal_.dev = UART_LL_GET_HW(uart_num_);
425 if (uart_hal_.dev == nullptr)
426 {
428 }
429
430 periph_module_enable(uart_module);
431 periph_module_reset(uart_module);
432
433 uart_ll_sclk_enable(uart_hal_.dev);
434 uart_hal_init(&uart_hal_, uart_num_);
435
436 uart_hw_enabled_ = true;
438 {
439 uart_hw_enabled_ = false;
440 return ErrorCode::INIT_ERR;
441 }
442
444 {
445 uart_hw_enabled_ = false;
446 return ErrorCode::INIT_ERR;
447 }
448
449 uart_hal_txfifo_rst(&uart_hal_);
450 uart_hal_rxfifo_rst(&uart_hal_);
451 uart_hal_clr_intsts_mask(&uart_hal_, UINT32_MAX);
452 uart_hal_disable_intr_mask(&uart_hal_, UINT32_MAX);
453
454 return ErrorCode::OK;
455}
static ErrorCode ResolveUartPeriph(uart_port_t uart_num, periph_module_t &out)
Map one UART index to its peripheral module.
Definition esp_uart.cpp:81
ErrorCode SetConfig(UART::Configuration config) override
Apply a new UART framing and baud configuration.
Definition esp_uart.cpp:185
bool uart_hw_enabled_
UART hardware block was initialized.
Definition esp_uart.hpp:355
ErrorCode ConfigurePins()
Configure the selected GPIO pins.
Definition esp_uart.cpp:459
@ INIT_ERR
初始化错误 | Initialization error
@ NOT_SUPPORT
不支持 | Not supported

◆ InstallUartIsr()

ErrorCode LibXR::ESP32UART::InstallUartIsr ( )
private

Install the UART interrupt handler.

安装 UART 中断处理函数。

Definition at line 38 of file esp_uart_fifo.cpp.

39{
41 {
42 return ErrorCode::OK;
43 }
44
45#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S3
46 // Classic ESP32/S3 can enter cache-disabled flash windows while UART IRQ is active.
47 // The current WritePort path is not fully IRAM-safe, so keep this IRQ non-IRAM.
48 constexpr int UART_INTR_FLAGS = 0;
49#else
50 constexpr int UART_INTR_FLAGS = ESP_INTR_FLAG_IRAM;
51#endif
52
53 const esp_err_t err = esp_intr_alloc(uart_periph_signal[uart_num_].irq, UART_INTR_FLAGS,
55 if (err != ESP_OK)
56 {
58 }
59
61 return ErrorCode::OK;
62}
intr_handle_t uart_intr_handle_
Registered UART interrupt handle.
Definition esp_uart.hpp:357
bool uart_isr_installed_
UART ISR installation state.
Definition esp_uart.hpp:358
static void UartIsrEntry(void *arg)
UART ISR trampoline.

◆ LoadActiveTxFromQueue()

bool IRAM_ATTR LibXR::ESP32UART::LoadActiveTxFromQueue ( bool in_isr)
private

Load one active TX request from the queue.

从队列装载一个 active TX 请求。

Definition at line 574 of file esp_uart.cpp.

575{
576 (void)in_isr;
577
578 size_t active_length = 0U;
579 WriteInfoBlock active_info = {};
580 if (!DequeueFifoTx(active_length, active_info))
581 {
582 return false;
583 }
584
585 tx_active_length_ = active_length;
587 tx_active_info_ = active_info;
588 tx_active_valid_ = true;
589 return true;
590}
bool DequeueFifoTx(size_t &size, WriteInfoBlock &info)
Claim one queued request for the FIFO TX backend.
Definition esp_uart.cpp:596

◆ OnConfigApplied()

bool LibXR::ESP32UART::OnConfigApplied ( bool in_isr)
private

Definition at line 297 of file esp_uart.cpp.

298{
299 rx_config_gate_.LeaveConfig();
300#if SOC_GDMA_SUPPORTED && SOC_UHCI_SUPPORTED
301 if (dma_backend_enabled_)
302 {
303 return true;
304 }
305#endif
306 (void)TryStartTx(in_isr);
307 return false;
308}
ErrorCode TryStartTx(bool in_isr)
Try to start queued transmit work.
Definition esp_uart.cpp:544

◆ OnConfigRequested()

void LibXR::ESP32UART::OnConfigRequested ( )
private

Definition at line 210 of file esp_uart.cpp.

210{ rx_config_gate_.RequestConfig(); }

◆ OnTxTransferDone()

void IRAM_ATTR LibXR::ESP32UART::OnTxTransferDone ( bool in_isr,
ErrorCode result )
private

Finalize one TX transfer result.

收尾一次 TX 传输结果。

Definition at line 686 of file esp_uart.cpp.

687{
688 Flag::ScopedRestore tx_flag(in_tx_isr_);
689 tx_busy_.Clear();
690
692
693 if (result != ErrorCode::OK)
694 {
695 return;
696 }
697
698 if (LoadActiveTxFromQueue(in_isr))
699 {
700 (void)StartAndReportActive(in_isr);
701 }
702}
bool LoadActiveTxFromQueue(bool in_isr)
Load one active TX request from the queue.
Definition esp_uart.cpp:574
bool StartAndReportActive(bool in_isr)
Start the active request and report queue completion ownership.
Definition esp_uart.cpp:523

◆ PushRxBytes()

void IRAM_ATTR LibXR::ESP32UART::PushRxBytes ( const uint8_t * data,
size_t size,
bool in_isr )
private

Push RX bytes into the software queue.

将 RX 字节推入软件队列。

Definition at line 650 of file esp_uart.cpp.

651{
652 size_t offset = 0;
653 bool pushed_any = false;
654 while (offset < size)
655 {
656 const size_t free_space = read_port_->queue_data_->EmptySize();
657 if (free_space == 0)
658 {
659 break;
660 }
661
662 const size_t chunk = std::min(free_space, size - offset);
663 if (read_port_->queue_data_->PushBatch(data + offset, chunk) != ErrorCode::OK)
664 {
665 break;
666 }
667
668 offset += chunk;
669 pushed_any = true;
670 }
671
672 if (pushed_any)
673 {
675 }
676}
ErrorCode PushBatch(const Data *data, size_t size)
批量推入多个 payload。

◆ ReadFun()

ErrorCode LibXR::ESP32UART::ReadFun ( ReadPort & port,
bool in_isr )
static

Queue-driven RX entry used by ReadPort.

ReadPort 使用的队列驱动 RX 入口。

Definition at line 349 of file esp_uart.cpp.

349{ return ErrorCode::PENDING; }
@ PENDING
等待中 | Pending

◆ ResolveParity()

uart_parity_t LibXR::ESP32UART::ResolveParity ( UART::Parity parity)
staticprivate

Convert configured parity into the HAL enum.

将配置的校验位转换为 HAL 枚举。

Definition at line 393 of file esp_uart.cpp.

394{
395 switch (parity)
396 {
398 return UART_PARITY_DISABLE;
400 return UART_PARITY_EVEN;
402 return UART_PARITY_ODD;
403 default:
404 return UART_PARITY_DISABLE;
405 }
406}
@ NO_PARITY
无校验 / No parity
@ ODD
奇校验 / Odd parity
@ EVEN
偶校验 / Even parity

◆ ResolveStopBits()

bool LibXR::ESP32UART::ResolveStopBits ( uint8_t stop_bits,
uart_stop_bits_t & out )
staticprivate

Convert configured stop bits into the HAL enum.

将配置的停止位转换为 HAL 枚举。

Definition at line 376 of file esp_uart.cpp.

377{
378 switch (stop_bits)
379 {
380 case 1:
381 out = UART_STOP_BITS_1;
382 return true;
383 case 2:
384 out = UART_STOP_BITS_2;
385 return true;
386 default:
387 return false;
388 }
389}

◆ ResolveUartPeriph()

ErrorCode LibXR::ESP32UART::ResolveUartPeriph ( uart_port_t uart_num,
periph_module_t & out )
staticprivate

Map one UART index to its peripheral module.

将一个 UART 序号映射到对应的外设模块。

Definition at line 81 of file esp_uart.cpp.

82{
83 switch (uart_num)
84 {
85 case UART_NUM_0:
86 out = PERIPH_UART0_MODULE;
87 return ErrorCode::OK;
88 case UART_NUM_1:
89 out = PERIPH_UART1_MODULE;
90 return ErrorCode::OK;
91#if SOC_UART_HP_NUM > 2
92 case UART_NUM_2:
93 out = PERIPH_UART2_MODULE;
94 return ErrorCode::OK;
95#endif
96 default:
98 }
99}

◆ ResolveWordLength()

bool LibXR::ESP32UART::ResolveWordLength ( uint8_t data_bits,
uart_word_length_t & out )
staticprivate

Convert configured data bits into the HAL enum.

将配置的数据位转换为 HAL 枚举。

Definition at line 353 of file esp_uart.cpp.

354{
355 switch (data_bits)
356 {
357 case 5:
358 out = UART_DATA_5_BITS;
359 return true;
360 case 6:
361 out = UART_DATA_6_BITS;
362 return true;
363 case 7:
364 out = UART_DATA_7_BITS;
365 return true;
366 case 8:
367 out = UART_DATA_8_BITS;
368 return true;
369 default:
370 return false;
371 }
372}

◆ SetConfig()

ErrorCode LibXR::ESP32UART::SetConfig ( UART::Configuration config)
overridevirtual

Apply a new UART framing and baud configuration.

应用新的 UART 帧格式和波特率配置。

Implements LibXR::UART.

Definition at line 185 of file esp_uart.cpp.

186{
187 if (!uart_hw_enabled_)
188 {
190 }
191
192 uart_word_length_t word_length = UART_DATA_8_BITS;
193 uart_stop_bits_t stop_bits = UART_STOP_BITS_1;
194
195 if (!ResolveWordLength(config.data_bits, word_length))
196 {
197 return ErrorCode::ARG_ERR;
198 }
199
200 if (!ResolveStopBits(config.stop_bits, stop_bits))
201 {
202 return ErrorCode::ARG_ERR;
203 }
204
205 requested_config_.Store(config);
206 tx_dma_model_.RequestConfig(false);
207 return ErrorCode::OK;
208}
@ STATE_ERR
状态错误 | State error

◆ SetLoopback()

ErrorCode LibXR::ESP32UART::SetLoopback ( bool enable)

Toggle UART peripheral internal loopback mode.

切换 UART 外设内部环回模式。

Definition at line 317 of file esp_uart.cpp.

318{
319 if (!uart_hw_enabled_)
320 {
322 }
323
324 uart_ll_set_loop_back(uart_hal_.dev, enable);
325 return ErrorCode::OK;
326}

◆ StartActiveTransfer()

bool IRAM_ATTR LibXR::ESP32UART::StartActiveTransfer ( bool in_isr)
private

Start the active request on the selected TX backend.

在选定 TX 后端上启动 active 请求。

Definition at line 626 of file esp_uart.cpp.

627{
628 if (!tx_active_valid_)
629 {
630 return false;
631 }
632
633 if (tx_busy_.TestAndSet())
634 {
635 return true;
636 }
637
639
640 uart_hal_clr_intsts_mask(&uart_hal_, UART_TX_INTR_MASK);
641 uart_hal_ena_intr_mask(&uart_hal_, UART_TX_INTR_MASK);
642 FillTxFifo(false);
643
644 return true;
645}
bool TestAndSet() noexcept
测试并置位:置位并返回旧状态 / Test-and-set: set and return previous state
Definition flag.hpp:146

◆ StartAndReportActive()

bool IRAM_ATTR LibXR::ESP32UART::StartAndReportActive ( bool in_isr)
private

Start the active request and report queue completion ownership.

启动 active 请求并上报队列完成所有权交接。

Definition at line 523 of file esp_uart.cpp.

524{
525 if (!StartActiveTransfer(in_isr))
526 {
529 return false;
530 }
531
532 // Align with STM/CH semantics: once the active write is kicked to HW,
533 // WritePort owns the completion notification and the ISR only advances queues.
535 return true;
536}
bool StartActiveTransfer(bool in_isr)
Start the active request on the selected TX backend.
Definition esp_uart.cpp:626
void Finish(bool in_isr, ErrorCode ans, WriteInfoBlock &info)
更新写入操作的状态。 Updates the status of the write operation.
@ FAILED
操作失败 | Operation failed

◆ StartDmaTx()

bool LibXR::ESP32UART::StartDmaTx ( uint8_t * data,
size_t size,
int block )
private

Definition at line 311 of file esp_uart.cpp.

311{ return false; }

◆ TryStartTx()

ErrorCode IRAM_ATTR LibXR::ESP32UART::TryStartTx ( bool in_isr)
private

Try to start queued transmit work.

尝试启动排队的发送工作。

Definition at line 544 of file esp_uart.cpp.

545{
546 if (in_tx_isr_.IsSet())
547 {
548 return ErrorCode::PENDING;
549 }
550
551 if (!tx_active_valid_)
552 {
553 (void)LoadActiveTxFromQueue(in_isr);
554 }
555
557 {
558 if (!StartActiveTransfer(in_isr))
559 {
561 return ErrorCode::FAILED;
562 }
563
564 return ErrorCode::OK;
565 }
566
567 return ErrorCode::PENDING;
568}
bool IsSet() const noexcept
判断是否已置位 / Check whether the flag is set
Definition flag.hpp:138

◆ UartIsrEntry()

void IRAM_ATTR LibXR::ESP32UART::UartIsrEntry ( void * arg)
staticprivate

UART ISR trampoline.

UART 中断跳板函数。

Definition at line 24 of file esp_uart_fifo.cpp.

25{
26 auto* self = static_cast<ESP32UART*>(arg);
27 if (self != nullptr)
28 {
29 self->HandleUartInterrupt();
30 }
31}
ESP32UART(uart_port_t uart_num, int tx_pin, int rx_pin, int rts_pin=PIN_NO_CHANGE, int cts_pin=PIN_NO_CHANGE, size_t rx_buffer_size=1024, size_t tx_buffer_size=512, uint32_t tx_queue_size=5, UART::Configuration config={115200, UART::Parity::NO_PARITY, 8, 1}, bool enable_dma=true)
Create and initialize one ESP32 UART instance.
Definition esp_uart.cpp:104

◆ WriteFun()

ErrorCode IRAM_ATTR LibXR::ESP32UART::WriteFun ( WritePort & port,
bool in_isr )
static

Queue-driven TX entry used by WritePort.

WritePort 使用的队列驱动 TX 入口。

Definition at line 330 of file esp_uart.cpp.

331{
332 auto* uart = LibXR::ContainerOf(&port, &ESP32UART::_write_port);
333#if SOC_GDMA_SUPPORTED && SOC_UHCI_SUPPORTED
334 if (uart->dma_backend_enabled_)
335 {
336 return uart->tx_dma_model_.Submit(in_isr);
337 }
338#endif
339 if (uart->rx_config_gate_.ConfigRequested())
340 {
341 return ErrorCode::PENDING;
342 }
343 return uart->TryStartTx(in_isr);
344}
OwnerType * ContainerOf(MemberType *ptr, MemberType OwnerType::*member) noexcept
通过成员指针恢复其所属对象指针

Friends And Related Symbol Documentation

◆ ESP32UARTReadPort

friend class ESP32UARTReadPort
friend

Definition at line 80 of file esp_uart.hpp.

◆ UartDmaTxModel< ESP32UART >

friend class UartDmaTxModel< ESP32UART >
friend

Definition at line 80 of file esp_uart.hpp.

Field Documentation

◆ _read_port

ESP32UARTReadPort LibXR::ESP32UART::_read_port
private

Read-side queue bridge exposed to UART.

Definition at line 361 of file esp_uart.hpp.

◆ _write_port

WritePort LibXR::ESP32UART::_write_port
private

Write-side queue bridge exposed to UART.

Definition at line 362 of file esp_uart.hpp.

◆ config_

UART::Configuration LibXR::ESP32UART::config_
private

Current UART framing configuration.

Definition at line 340 of file esp_uart.hpp.

◆ cts_pin_

int LibXR::ESP32UART::cts_pin_
private

CTS GPIO pin or PIN_NO_CHANGE.

Definition at line 338 of file esp_uart.hpp.

◆ dma_requested_

bool LibXR::ESP32UART::dma_requested_ = true
private

Constructor preference for DMA mode.

Definition at line 359 of file esp_uart.hpp.

◆ in_tx_isr_

Flag::Plain LibXR::ESP32UART::in_tx_isr_
private

Reentry guard while processing TX ISR work.

Definition at line 353 of file esp_uart.hpp.

◆ PIN_NO_CHANGE

int LibXR::ESP32UART::PIN_NO_CHANGE = -1
staticconstexpr

Sentinel for an unmapped GPIO.

Definition at line 84 of file esp_uart.hpp.

◆ requested_config_

LatestSnapshot<UART::Configuration> LibXR::ESP32UART::requested_config_
private

Definition at line 341 of file esp_uart.hpp.

◆ rts_pin_

int LibXR::ESP32UART::rts_pin_
private

RTS GPIO pin or PIN_NO_CHANGE.

Definition at line 337 of file esp_uart.hpp.

◆ rx_config_gate_

UartRxConfigGate LibXR::ESP32UART::rx_config_gate_
private

Definition at line 342 of file esp_uart.hpp.

◆ rx_isr_buffer_

uint8_t* LibXR::ESP32UART::rx_isr_buffer_ = nullptr
private

Scratch buffer used by the RX ISR path.

Definition at line 344 of file esp_uart.hpp.

◆ rx_isr_buffer_size_

size_t LibXR::ESP32UART::rx_isr_buffer_size_ = 0
private

Size of rx_isr_buffer_.

Definition at line 345 of file esp_uart.hpp.

◆ rx_pin_

int LibXR::ESP32UART::rx_pin_
private

RX GPIO pin or PIN_NO_CHANGE.

Definition at line 336 of file esp_uart.hpp.

◆ tx_active_info_

WriteInfoBlock LibXR::ESP32UART::tx_active_info_ = {}
private

Metadata for the active TX request.

Definition at line 348 of file esp_uart.hpp.

348{};

◆ tx_active_length_

size_t LibXR::ESP32UART::tx_active_length_ = 0U
private

Active TX payload length in bytes.

Definition at line 349 of file esp_uart.hpp.

◆ tx_active_offset_

size_t LibXR::ESP32UART::tx_active_offset_ = 0U
private

Bytes already emitted for the active request.

Definition at line 350 of file esp_uart.hpp.

◆ tx_active_valid_

bool LibXR::ESP32UART::tx_active_valid_ = false
private

Whether the active TX metadata is valid.

Definition at line 351 of file esp_uart.hpp.

◆ tx_busy_

Flag::Plain LibXR::ESP32UART::tx_busy_
private

Hardware TX engine currently owns the request.

Definition at line 352 of file esp_uart.hpp.

◆ tx_dma_model_

UartDmaTxModel<ESP32UART> LibXR::ESP32UART::tx_dma_model_
private

One-shot DMA TX execution model.

Definition at line 363 of file esp_uart.hpp.

◆ tx_pin_

int LibXR::ESP32UART::tx_pin_
private

TX GPIO pin or PIN_NO_CHANGE.

Definition at line 335 of file esp_uart.hpp.

◆ tx_storage_

uint8_t* LibXR::ESP32UART::tx_storage_ = nullptr
private

Backing storage for the TX half-buffers.

Definition at line 347 of file esp_uart.hpp.

◆ uart_hal_

uart_hal_context_t LibXR::ESP32UART::uart_hal_ = {}
private

ESP-IDF UART HAL context.

Definition at line 356 of file esp_uart.hpp.

356{};

◆ uart_hw_enabled_

bool LibXR::ESP32UART::uart_hw_enabled_ = false
private

UART hardware block was initialized.

Definition at line 355 of file esp_uart.hpp.

◆ uart_intr_handle_

intr_handle_t LibXR::ESP32UART::uart_intr_handle_ = nullptr
private

Registered UART interrupt handle.

Definition at line 357 of file esp_uart.hpp.

◆ uart_isr_installed_

bool LibXR::ESP32UART::uart_isr_installed_ = false
private

UART ISR installation state.

Definition at line 358 of file esp_uart.hpp.

◆ uart_num_

uart_port_t LibXR::ESP32UART::uart_num_
private

Selected UART peripheral index.

Definition at line 334 of file esp_uart.hpp.


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