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.
40 lines
664 B
40 lines
664 B
#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;
|
|
int m_rate = B115200;
|
|
struct termios m_tty;
|
|
|
|
public:
|
|
Uart();
|
|
~Uart();
|
|
|
|
int open(string path);
|
|
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
|