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

📄 serial.h

📁 嵌入式Linux应用系统开发实例精讲源代码
💻 H
字号:
/*serial.h by bitzilla@gmail.com*/#ifndef SERIAL_H#define SERIAL_H#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/stat.h>#include <sys/types.h>#include <fcntl.h>#include <termios.h>#include <errno.h>#include <time.h>/*定义波特率的合法取值*/static int  speed_arr[]={ B115200, B38400, B19200, B9600, B4800, B2400, B1200, B300, B38400, B19200, B9600, B4800, B2400, B1200, B300, };/*定义对应的波特率数值*/static int  name_arr[]={ 115200, 38400, 19200, 9600, 4800, 2400, 1200, 300, 38400, 19200, 9600, 4800, 2400, 1200, 300,};void set_speed(int fd,int speed);	/*设置串口波特率的速度*/int set_parity(int fd,int databits,int stopbits,int parity);	/*设置串口数据位,停止位,奇偶校验位*/int init_serial(char* dev);	/*打开串口设备*/#endif

⌨️ 快捷键说明

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