You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#pragma once
#include <termios.h>
#include <unistd.h>
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <string>
#include <vector>
namespace iflytop { using namespace std; class Uart { private: int m_fd = 0; string m_name; string m_rate; struct termios m_tty;
public: Uart(); ~Uart(); /**
* @brief 打开串口 * * @param path * @param rate * "0" "50" "75" "110" * "134" "150" "200" "300" * "600" "1200" "1800" "2400" * "4800" "9600" "19200" "38400" * "57600" "115200" "230400" "460800" * "500000" "576000" "921600" "1000000" * "1152000" "1500000" "2000000" "2500000" * "3000000" "3500000" "4000000" * * @return int */ int open(string path, string ratestr); int send(char *data, int size); int receive(char *data, int size_max); int close();
bool flush_rx(); bool flush_tx();
int get_m_fd(void) { return m_fd; }; };
} // namespace iflytop
|