serial.h

来自「最基本介绍C的很不错的程序代码」· C头文件 代码 · 共 59 行

H
59
字号
/********************************************************************** * * Filename:    serial.h *  * Description: Header file for the serial port class. * * Notes:        * *  * Copyright (c) 1998 by Michael Barr.  This software is placed into * the public domain and may be used for any purpose.  However, this * notice must not be changed or removed and no warranty is either * expressed or implied by its publication or distribution. **********************************************************************/#ifndef _SERIAL_H#define _SERIAL_H#define PORTA    0#define PORTB    1#include "circbuf.h"#ifdef putchar#undef putchar#endif#ifdef getchar#undef getchar#endifclass SerialPort{    public:        SerialPort(int            port,                   unsigned long  baudRate = 19200L,                   unsigned int   txQueueSize = 64,                   unsigned int   rxQueueSize = 64);        ~SerialPort();        int        putchar(int c);        int        puts(const char * s);        int        getchar();        char *     gets(char *s);    private:         int        channel;        CircBuf *  pTxQueue;        CircBuf *  pRxQueue;};#endif /* _SERIAL_H */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?