xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 10KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-08
  • 語言: 其他
  • 標簽: gps??定位??串口??

資源簡介

調試過了,可以用的,針對不同的模塊自己修改下就好了。不懂可以咨詢我

資源截圖

代碼片段和文件信息

#include?“pf_gps.h“
#include??????
#include??????
#include?????
#include???
#include??
#include????
#include??????
#include?????
#include???
#include?
#include?
#include?
#include?
#include?

typedef?struct
{
char?*dev_path;
pthread_t?gps_thread;
int?gps_fd;
int?gps_client_fd;
int?gps_server_fd;
void?*user_param;
int?user_param_len;
gps_call_back_fun?call_back_fun;
//gps_data_t*?back_gps_data;
}gps_classe;

#define?FALSE?0
#define?TRUE?1

#define?MAX_GPS_CMD_BYTES?255

gps_classe?tty_gps;
gps_data_t*?back_gps_data;

/***@brief??設置串口通信速率
*@param??fd?????類型?int??打開串口的文件句柄
*@param??speed??類型?int??串口速度
*@return??void*/

static?int?speed_arr[]?=?{B500000?B460800?B230400?B115200?B57600?B38400?B19200?B9600?B4800?B2400?B1200?B300
????B57600?B38400?B19200?B9600?B4800?B2400?B1200?B300?};
static?int?name_arr[]?=?{500000?460800?230400?115200?57600?38400??19200??9600??4800??2400??1200??300
????57600?38400??19200??9600?4800?2400?1200??300?};

static?void?uart_set_speed(int?fd?int?speed)//設置波特率
{
int???i;
int???status;
struct?termios???Opt;
tcgetattr(fd?&Opt);
for(?i=?0;??i? {
??? if(speed?==?name_arr[i])
{
??? ????tcflush(fd?TCIOFLUSH);
???? cfsetispeed(&Opt?speed_arr[i]);//輸入波特率函數
???? cfsetospeed(&Opt?speed_arr[i]);//輸出波特率函數
???? status?=?tcsetattr(fd?TCSANOW?&Opt);//TCSANOW??不等數據傳輸完畢就立即改變屬性。激活波特率的配置
???? if(status?!=?0)
????????????perror(“tcsetattr?fd1“);
????? return;
}
tcflush(fdTCIOFLUSH);
}
}


/**
*@breif?打開串口
*/
static?int?uart_open(char?*Dev?int?open_flags)
{
struct?termios?opt;
printf(“open?successful123\n“);
int fd?=?open(Dev?open_flags);?????????//
if?(-1?==?fd)
{
perror(“Can‘t?Open?Serial?Port“);
return?-1;
}

printf(“open?successful\n“);
fflush(stdout);

tcgetattr?(fd?&opt);//tcgetattr函數用于獲取與終端相關的參數?
// opt.c_lflag?&=?~(ICANON?|?ECHO?|?ISIG);?
opt.c_lflag?&=?~(ECHO?|?ICANON?|?IEXTEN?|?ISIG);

????/*
?????*?No?SIGINT?on?BREAK?CR-to-NL?off?input?parity
?????*?check?off?don‘t?strip?8th?bit?on?input?output
?????*?flow?control?off.
?????*/
//????opt.c_iflag?&=?~(BRKINT?|?ICRNL?|?INPCK?|?ISTRIP?|?IXON);
opt.c_iflag?&=?~(BRKINT?|?ICRNL);
opt.c_oflag?&=?~(OPOST);


tcsetattr?(fd?TCSANOW?&opt);?

tcflush(fd?TCIOFLUSH);
return?fd;
}


/**
*@brief???設置串口數據位,停止位和效驗位
*@param??fd?????類型??int??打開的串口文件句柄*
*@param??databits?類型??int?數據位???取值?為?7?或者8*
*@param??stopbits?類型??int?停止位???取值為?1?或者2*
*@param??parity??類型??int??效驗類型?取值為NEOS
*/
static?int?uart_set_param(int?fdint?databitsint?stopbitsint?parity?int?flow?int?read_len)
{
struct?termios?options;

if(?tcgetattr(?fd&options)??!=??0)
{
?? perror(“SetupSerial?1“);
?? return

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????27743??2012-05-21?14:51??gps.c
?????文件????????1368??2012-05-18?19:29??pf_gps.h
?????文件????????5003??2012-05-15?14:40??pf_hi.h

評論

共有 條評論