libxr
1.0
Want to be the best embedded framework
|
Public Member Functions | |
LinuxUART (const char *dev_path, unsigned int baudrate=115200, Parity parity=Parity::NO_PARITY, uint8_t data_bits=8, uint8_t stop_bits=1, uint32_t tx_queue_size=5, size_t buffer_size=512) | |
LinuxUART (const std::string &vid, const std::string &pid, unsigned int baudrate=115200, Parity parity=Parity::NO_PARITY, uint8_t data_bits=8, uint8_t stop_bits=1, uint32_t tx_queue_size=5, size_t buffer_size=512) | |
std::string | GetByPathForTTY (const std::string &tty_name) |
void | SetLowLatency (int fd) |
ErrorCode | SetConfig (UART::Configuration config) override |
设置 UART 配置 / Sets the UART configuration | |
![]() | |
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) |
template<typename OperationType , typename = std::enable_if_t<std::is_base_of_v< ReadOperation, std::decay_t<OperationType>>>> | |
ErrorCode | Read (RawData data, OperationType &&op) |
Static Public Member Functions | |
static bool | FindUSBTTYByVidPid (const std::string &target_vid, const std::string &target_pid, std::string &tty_path) |
static ErrorCode | ReadFun (ReadPort &port) |
static ErrorCode | WriteFun (WritePort &port) |
Private Member Functions | |
void | RxLoop () |
void | TxLoop () |
Private Attributes | |
int | fd_ = -1 |
bool | connected_ = true |
Configuration | config_ |
std::string | device_path_ |
Thread | rx_thread_ |
Thread | tx_thread_ |
uint8_t * | rx_buff_ = nullptr |
uint8_t * | tx_buff_ = nullptr |
size_t | buff_size_ = 0 |
Semaphore | write_sem_ |
Mutex | read_mutex_ |
ReadPort | _read_port |
WritePort | _write_port |
Additional Inherited Members | |
![]() | |
enum class | Parity : uint8_t { NO_PARITY = 0 , EVEN = 1 , ODD = 2 } |
奇偶校验模式 / Parity mode More... | |
![]() | |
ReadPort * | read_port_ |
读取端口 / Read port | |
WritePort * | write_port_ |
写入端口 / Write port | |
Definition at line 26 of file linux_uart.hpp.
|
inline |
Definition at line 29 of file linux_uart.hpp.
|
inline |
Definition at line 80 of file linux_uart.hpp.
|
inlinestatic |
Definition at line 158 of file linux_uart.hpp.
|
inline |
Definition at line 139 of file linux_uart.hpp.
|
inlinestatic |
Definition at line 330 of file linux_uart.hpp.
|
inlineprivate |
Definition at line 340 of file linux_uart.hpp.
|
inlineoverridevirtual |
设置 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 219 of file linux_uart.hpp.
|
inline |
Definition at line 211 of file linux_uart.hpp.
|
inlineprivate |
Definition at line 375 of file linux_uart.hpp.
|
inlinestatic |
Definition at line 332 of file linux_uart.hpp.
|
private |
Definition at line 429 of file linux_uart.hpp.
|
private |
Definition at line 430 of file linux_uart.hpp.
|
private |
Definition at line 425 of file linux_uart.hpp.
|
private |
Definition at line 419 of file linux_uart.hpp.
|
private |
Definition at line 418 of file linux_uart.hpp.
|
private |
Definition at line 420 of file linux_uart.hpp.
|
private |
Definition at line 417 of file linux_uart.hpp.
|
private |
Definition at line 427 of file linux_uart.hpp.
|
private |
Definition at line 423 of file linux_uart.hpp.
|
private |
Definition at line 421 of file linux_uart.hpp.
|
private |
Definition at line 424 of file linux_uart.hpp.
|
private |
Definition at line 422 of file linux_uart.hpp.
|
private |
Definition at line 426 of file linux_uart.hpp.