uart.h
来自「《嵌入式系统设计与开发实例详解—基于ARM的应用》的源代码」· C头文件 代码 · 共 57 行
H
57 行
/*----------------------------------------------------------------------------
* 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 + =
减小字号Ctrl + -
显示快捷键?