ESP8266_wifi配置
1.打开串口
int openSerialWifi(char *cSerialName)
{
int iFd;
struct termios opt;
//打开串口
iFd = open(cSerialName, O_RDWR | O_NOCTTY | O_NDELAY);
if(iFd < 0) {
perror(cSerialName);
return -1;
}
//获取终端参数
tcgetattr(iFd, &opt);
//设置波特率
cfsetispeed(&opt, B115200);
cfsetospeed(&opt, B115200);
printf("uart4 init seccessful \n");
#if 1
/*
* raw mode
*/
opt.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);
opt.c_iflag &= ~(IXON | IXOFF | IXANY);
opt.c_oflag &= ~(OPOST); //不执行输出*******************************************
opt.c_cflag &= ~PARENB; //无奇偶校验
opt.c_cflag &= ~CSTOPB; //1位停止位
opt.c_cflag &= ~CSIZE; //先把数据位清零
opt.c_cflag |= CS8; //把数据位设置为8位