文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>串口通信comport.h

串口通信comport.h

时间:2010-06-07  来源:长江货郎

#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <fcntl.h>
#include <errno.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/signal.h>
#include <sys/types.h>

#define  BUF_32  32
#define  BUF_64  62

typedef struct __COM_PORT 
{
 unsigned char  databit, parity, stopbit, flowctrl, is_connted;
 long   baudrate;
 char   dev_name[BUF_64];
 int   fd_com;
 int   frag_size;
}COM_PORT;

//#define DEBUG
#ifdef DEBUG
   #define dbg_print(format,args...) printf(format, ##args)
#else
   #define dbg_print(format,args...) do{} while(0);
#endif

void init_comport(COM_PORT *comport);
void set_setting(char *set, COM_PORT *comport);
void disp_setting(COM_PORT *comport);
void nonblock ();
int kbhit ();
unsigned char comport_recv ( COM_PORT *comport, unsigned char *buf, int buf_size,
                               int *recv_bytes, unsigned long timeout);
unsigned char comport_send (COM_PORT *comport, unsigned char *buf, int send_bytes);
相关阅读 更多 +
排行榜 更多 +
疯狂兔子人乐园

疯狂兔子人乐园

休闲益智 下载
空中飞机飞行

空中飞机飞行

休闲益智 下载
小姐姐历险记2

小姐姐历险记2

休闲益智 下载