-
Notifications
You must be signed in to change notification settings - Fork 0
/
serialport.h
43 lines (36 loc) · 836 Bytes
/
serialport.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef SERIALPORT_H
#define SERIALPORT_H
#include <stdio.h> /*Standard Input&Output defintion*/
#include <iostream>
#include <time.h>
#include <cmath>
#include<stdlib.h> /*Standard function libray defintion*/
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<termios.h>
#include<errno.h>
#include<string.h>
#define FALSE -1
#define TRUE 0
using namespace std;
//SerialPort Class for DJI Maniflod
class SerialPort{
private:
int fd;//串口号
char *PortName;//串口名
int speed, flow_ctrl, databits, stopbits, parity;
int data_len;
int UART0_Init();
int UART0_Set();
public:
SerialPort();
SerialPort(char *pn);
~SerialPort();
void Open();
int Send(char *send_buf);
int Recv(char *rcv_buf);
void Close();
};
#endif // SERIALPORT_H