📄 uart.h
字号:
/*----------------------------------------------------------------------------
* Copyright (c) 2001 by National Semiconductor Corporation
* National Semiconductor Corporation
* 2900 Semiconductor Drive
* Santa Clara, California 95051
*
* All rights reserved
*
*<<<-------------------------------------------------------------------------
* File Contents:
* Uart.cpp - Overlapped serial IO communication class.
*
* Project: USB Demo Application
* Author : Yan Nosovitsky
* Date : Dec 2001
*----------------------------------------------------------------------->>>*/
#ifndef _UART_H_
#define _UART_H_
#include <windows.h>
class Uart
{
private:
HANDLE uartHandle; // Device handle
public:
Uart();
~Uart() { CloseUART(); }
// For more definitions see <winbase.h>
BOOL OpenUART(LPCSTR lpszPortNum = "com1",
DWORD dwBaudRate = CBR_19200,
BYTE byParity = ODDPARITY,
BYTE byStopBits = ONESTOPBIT,
BYTE byByteSize = 8);
void CloseUART(VOID);
bool WriteData(BYTE* pdata, DWORD len);
DWORD ReadData(BYTE* pdest, DWORD len, DWORD dwMaxWait = 10000);
private:
BOOL IsNT(VOID);
};
#endif // _UART_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -