📄 uart.h
字号:
#ifndef __uart_h__
#define __uart_h__
#include <stdio.h> // printf
#include <fcntl.h> // open
#include <string.h> // bzero
#include <stdlib.h> // exit
#include <sys/times.h> // times
#include <sys/types.h> // pid_t
#include <termios.h> //termios, tcgetattr(), tcsetattr()
#include <unistd.h>
#include <sys/ioctl.h> // ioctl
typedef 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
}portinfo_t;
char *get_ptty(pportinfo_t pportinfo);
int convbaud(unsigned long int baudrate);
int PortSet(int fdcom, const pportinfo_t pportinfo);
int PortOpen(pportinfo_t pportinfo);
void PortClose(int fdcom);
int PortSend(int fdcom, char *data, int datalen);
int PortRecv(int fdcom, char *data, int datalen, int baudrate)
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -