⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scomm.h

📁 linux下的串口测试程序
💻 H
字号:
#ifndef _SCOMM_H_#define _SCOMM_H_#include <assert.h>#include <termios.h>#include <unistd.h>class scomm{public:	scomm();	virtual ~scomm();	int  open(const char *dev);	void set_baud(int baud);	bool set_parity(int parity='N', int databits=8,int stopbits=1);	int  close();	int  read(void *buf, int size, int timeout=-1);	int  write(const void *buf, int size);	void attach(int fd) { _fd = fd; }	int  fd() { return _fd; }protected:	char _device[33];	int _fd;	struct termios _term;};inline int scomm::write(const void *buf, int size){//	assert(_fd >= 0);	return _fd >= 0 ? ::write(_fd, buf, size) : -1;}#endif // _SCOMM_H_// vim: ai

⌨️ 快捷键说明

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