|
libxr
1.0
Want to be the best embedded framework
|
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) | |
| ErrorCode | SetConfig (UART::Configuration config) override |
| 设置 UART 配置 / Sets the UART configuration | |
| ErrorCode | SetLoopback (bool enable) |
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) |
| static ErrorCode | ReadFun (ReadPort &port, bool in_isr) |
Static Public Attributes | |
| static constexpr int | PIN_NO_CHANGE = -1 |
Private Member Functions | |
| ErrorCode | InitUartHardware () |
| ErrorCode | ConfigurePins () |
| ErrorCode | InstallUartIsr () |
| void | ConfigureRxInterruptPath () |
| ErrorCode | TryStartTx (bool in_isr) |
| bool | LoadActiveTxFromQueue (bool in_isr) |
| bool | LoadPendingTxFromQueue (bool in_isr) |
| bool | DequeueTxToBuffer (uint8_t *buffer, size_t &size, WriteInfoBlock &info, bool in_isr) |
| bool | StartActiveTransfer (bool in_isr) |
| bool | StartAndReportActive (bool in_isr) |
| void | ClearActiveTx () |
| void | ClearPendingTx () |
| void | FillTxFifo (bool in_isr) |
| void | PushRxBytes (const uint8_t *data, size_t size, bool in_isr) |
| void | DrainRxFifoFromIsr () |
| void | HandleRxInterrupt (uint32_t uart_intr_status) |
| void | HandleTxInterrupt (uint32_t uart_intr_status) |
| void | HandleUartInterrupt () |
| void | OnTxTransferDone (bool in_isr, ErrorCode result) |
Static Private Member Functions | |
| static uint8_t * | AllocateTxStorage (size_t size) |
| static ErrorCode | ResolveUartPeriph (uart_port_t uart_num, periph_module_t &out) |
| static bool | ResolveWordLength (uint8_t data_bits, uart_word_length_t &out) |
| static bool | ResolveStopBits (uint8_t stop_bits, uart_stop_bits_t &out) |
| static uart_parity_t | ResolveParity (UART::Parity parity) |
| static void | UartIsrEntry (void *arg) |
Private Attributes | |
| uart_port_t | uart_num_ |
| int | tx_pin_ |
| int | rx_pin_ |
| int | rts_pin_ |
| int | cts_pin_ |
| UART::Configuration | config_ |
| uint8_t * | rx_isr_buffer_ = nullptr |
| size_t | rx_isr_buffer_size_ = 0 |
| uint8_t * | tx_storage_ = nullptr |
| size_t | tx_storage_size_ = 0 |
| size_t | tx_buffer_size_ = 0 |
| uint8_t * | tx_active_buffer_ = nullptr |
| uint8_t * | tx_pending_buffer_ = nullptr |
| size_t | tx_active_length_ = 0 |
| size_t | tx_pending_length_ = 0 |
| size_t | tx_active_offset_ = 0 |
| WriteInfoBlock | tx_active_info_ = {} |
| WriteInfoBlock | tx_pending_info_ = {} |
| Flag::Plain | tx_busy_ |
| Flag::Plain | in_tx_isr_ |
| bool | tx_active_valid_ = false |
| bool | tx_pending_valid_ = false |
| bool | uart_hw_enabled_ = false |
| uart_hal_context_t | uart_hal_ = {} |
| intr_handle_t | uart_intr_handle_ = nullptr |
| bool | uart_isr_installed_ = false |
| bool | dma_requested_ = true |
| ReadPort | _read_port |
| WritePort | _write_port |
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 | |
| ReadPort * | read_port_ |
| 读取端口 / Read port | |
| WritePort * | write_port_ |
| 写入端口 / Write port | |
Definition at line 27 of file esp_uart.hpp.
| 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 ) |
Definition at line 73 of file esp_uart.cpp.
|
staticprivate |
Definition at line 40 of file esp_uart.cpp.
|
private |
Definition at line 402 of file esp_uart.cpp.
|
private |
Definition at line 410 of file esp_uart.cpp.
|
private |
Definition at line 352 of file esp_uart.cpp.
|
private |
Definition at line 144 of file esp_uart.cpp.
|
private |
Definition at line 502 of file esp_uart.cpp.
|
private |
Definition at line 126 of file esp_uart_fifo.cpp.
|
private |
Definition at line 52 of file esp_uart_fifo.cpp.
|
private |
Definition at line 167 of file esp_uart_fifo.cpp.
|
private |
Definition at line 189 of file esp_uart_fifo.cpp.
|
private |
Definition at line 201 of file esp_uart_fifo.cpp.
|
private |
Definition at line 306 of file esp_uart.cpp.
|
private |
Definition at line 26 of file esp_uart_fifo.cpp.
|
private |
Definition at line 467 of file esp_uart.cpp.
|
private |
Definition at line 482 of file esp_uart.cpp.
|
private |
Definition at line 600 of file esp_uart.cpp.
|
private |
Definition at line 573 of file esp_uart.cpp.
Definition at line 253 of file esp_uart.cpp.
|
staticprivate |
Definition at line 291 of file esp_uart.cpp.
|
staticprivate |
Definition at line 276 of file esp_uart.cpp.
|
staticprivate |
Definition at line 53 of file esp_uart.cpp.
|
staticprivate |
Definition at line 255 of file esp_uart.cpp.
|
overridevirtual |
设置 UART 配置 / Sets the UART configuration
ErrorCode::OK,否则返回相应错误码 / Returns the operation status, ErrorCode::OK if successful, otherwise an error code该方法为纯虚函数,子类必须实现具体的 UART 配置逻辑。 This is a pure virtual function. Subclasses must implement the specific UART configuration logic.
Implements LibXR::UART.
Definition at line 157 of file esp_uart.cpp.
| ErrorCode LibXR::ESP32UART::SetLoopback | ( | bool | enable | ) |
Definition at line 236 of file esp_uart.cpp.
|
private |
Definition at line 539 of file esp_uart.cpp.
|
private |
Definition at line 417 of file esp_uart.cpp.
|
private |
Definition at line 432 of file esp_uart.cpp.
|
staticprivate |
Definition at line 17 of file esp_uart_fifo.cpp.
Definition at line 247 of file esp_uart.cpp.
|
private |
Definition at line 166 of file esp_uart.hpp.
|
private |
Definition at line 167 of file esp_uart.hpp.
|
private |
Definition at line 139 of file esp_uart.hpp.
|
private |
Definition at line 137 of file esp_uart.hpp.
|
private |
Definition at line 164 of file esp_uart.hpp.
|
private |
Definition at line 156 of file esp_uart.hpp.
|
staticconstexpr |
Definition at line 30 of file esp_uart.hpp.
|
private |
Definition at line 136 of file esp_uart.hpp.
|
private |
Definition at line 141 of file esp_uart.hpp.
|
private |
Definition at line 142 of file esp_uart.hpp.
|
private |
Definition at line 135 of file esp_uart.hpp.
|
private |
Definition at line 147 of file esp_uart.hpp.
|
private |
Definition at line 153 of file esp_uart.hpp.
|
private |
Definition at line 149 of file esp_uart.hpp.
|
private |
Definition at line 151 of file esp_uart.hpp.
|
private |
Definition at line 157 of file esp_uart.hpp.
|
private |
Definition at line 146 of file esp_uart.hpp.
|
private |
Definition at line 155 of file esp_uart.hpp.
|
private |
Definition at line 148 of file esp_uart.hpp.
|
private |
Definition at line 154 of file esp_uart.hpp.
|
private |
Definition at line 150 of file esp_uart.hpp.
|
private |
Definition at line 158 of file esp_uart.hpp.
|
private |
Definition at line 134 of file esp_uart.hpp.
|
private |
Definition at line 144 of file esp_uart.hpp.
|
private |
Definition at line 145 of file esp_uart.hpp.
|
private |
Definition at line 161 of file esp_uart.hpp.
|
private |
Definition at line 160 of file esp_uart.hpp.
|
private |
Definition at line 162 of file esp_uart.hpp.
|
private |
Definition at line 163 of file esp_uart.hpp.
|
private |
Definition at line 133 of file esp_uart.hpp.