Windows下读写串口(异步),可同时读写,但读写各自阻塞线程
struct COMOPT
{
DWORD BaudRate; //Baudrate at which running
DWORD ByteSize; //Number of bits/byte, 4-8
DWORD Parity; //0-4=None,Odd,Even,Mark,Space
DWORD StopBits; //0,1,2 = 1, 1.5, 2
DWORD IntervalTimeout; //Maximum time between chars
};
- BOOL APIENTRY checkCom(unsigned int cNum);
- HANDLE APIENTRY openCom(unsigned int cNum);
- BOOL APIENTRY configCom(HANDLE hCom,COMOPT* opt);
- UINT APIENTRY recvData(HANDLE hCom,unsigned char* buf,unsigned int bufLen);
- UINT APIENTRY sendData(HANDLE hCom,unsigned char* dat,unsigned int datLen);
- BOOL APIENTRY closeCom(HANDLE hCom);
- BOOL APIENTRY clearCache(HANDLE hCom);