hlp:桂林国际齿轮泵代码
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#ifndef MYCOM_H
|
||||
#define MYCOM_H
|
||||
#include <stdio.h> //printf等用到
|
||||
#include <fcntl.h> //file control
|
||||
#include <string.h> //bzero等用到
|
||||
#include <stdlib.h> //exit(0)等用到
|
||||
#include <sys/times.h>//sleep等用到
|
||||
#include <termios.h>//串口应用程序必须添加的头文件
|
||||
#include <sys/types.h>//定义pid_t,size等
|
||||
#include <unistd.h>//read,write,getpid等等
|
||||
#include <sys/ioctl.h>//ioctl
|
||||
typedef struct //define the uart value struct
|
||||
{
|
||||
char prompt; //prompt after reciving data
|
||||
int baudrate; //baudrate
|
||||
char databit; //data bits, 5, 6, 7, 8
|
||||
char debug; //debug mode, 0: none, 1: debug
|
||||
char echo; //echo mode, 0: none, 1: echo
|
||||
char fctl; //flow control, 0: none, 1: hardware, 2: software
|
||||
char tty; //tty: 0, 1, 2, 3, 4, 5, 6, 7
|
||||
char parity; //parity 0: none, 1: odd, 2: even
|
||||
char stopbit; //stop bits, 1, 2
|
||||
//const int reserved; //reserved, must be zero
|
||||
int reserved; //reserved, must be zero
|
||||
}portinfo_t;
|
||||
typedef portinfo_t *pportinfo_t; //redefine the portinfo_t
|
||||
/**************** declaration the fuction to set the uart *******************/
|
||||
int PortOpen(pportinfo_t pportinfo); //open the uart
|
||||
int PortSet(int fdcom, const pportinfo_t pportinfo); //set the uart
|
||||
void PortClose(int fdcom); //close the uart
|
||||
int PortSend(int fdcom, char *data, int datalen); //send the datas
|
||||
int PortRecv(int fdcom, char *data, int datalen, int baudrate);//receive the datas
|
||||
#endif // MYCOM_H
|
||||
Reference in New Issue
Block a user