📄 uiuart.h
字号:
#ifndef _GUI_UART_H
#define _GUI_UART_H
#include <pr2k.h>
#include <typedefine.h>
#define DEBUG_UART
#define COM_NUM 4
#define REC_BUF_SIZE 4096 // 接收Buffer大小
/* Defined PARITY bit*/
#define NOPARITY 0
#define ODDPARITY 1
#define EVENPARITY 2
//define stop bit
#define ONESTOPBIT 0
#define ONE5STOPBITS 1
#define TWOSTOPBITS 2
#define ACK_OK 0x01
#define COM1 0
#define COM2 1
#define ACK_ERRPACKETNO 0xfb
#define ACK_ERRWRITE 0xfC
#define ACK_ERRLEN 0xfd
#define ACK_ERRBLOCK 0xfe
#define ACK_ERRCHECKSUM 0xff
typedef struct
{
unsigned long BaudRate; // 速率
unsigned char DataBits; // 数据位
unsigned char Parity; // 校验
unsigned char StopBits; // 停止位
long TimeOuts; // 超时时间
} TDeviceState;
DLL_EXP(int) com_Open(char *DeviceName,TDeviceState *DS); // 打开COM口
DLL_EXP(int) IrDA_Open(char *DeviceName,TDeviceState *DS);
DLL_EXP(STATUS) com_Close(int port); // 关闭COM口
DLL_EXP(int) com_CheckReceiverBuffer(int port); // 检查接收缓冲区中接收到的字符数
//DLL_EXP(int) com_CheckTransmitterBuffer(char* DeviceName); // 检查发送缓冲区中待发送的字符数
DLL_EXP(int) com_Receive(int port, unsigned char *buffer,int len);// 接收数据
DLL_EXP(int) com_Send(int port, unsigned char *buffer,int len); // 发送数据
DLL_EXP(STATUS) com_ReceiveByte(int port, unsigned char *data); // 接收一字节数据
DLL_EXP(STATUS) com_SendByte(int port, unsigned char data); // 发送一字节数据
DLL_EXP(STATUS) hs_ReceiveByte(int port, unsigned char *data);
STATUS com_EnableCTS(int port);
STATUS com_DisableCTS(int port);
#ifdef DEBUG_UART
DLL_EXP(int) com_CheckError(void);
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -