serial.h

来自「keil 下usb转串口」· C头文件 代码 · 共 44 行

H
44
字号
/*----------------------------------------------------------------------------
 *      Name:    serial.h
 *      Purpose: serial port handling
 *      Version: V1.00
 *----------------------------------------------------------------------------
 *      This file is part of the uVision/ARM development tools.
 *      This software may only be used under the terms of a valid, current,
 *      end user licence from KEIL for a compatible version of KEIL software
 *      development tools. Nothing else gives you the right to use it.
 *
 *      Copyright (c) 2005-2007 Keil Software.
 *---------------------------------------------------------------------------*/

#include "type.h"

#define SER_BUF_SIZE 64

/*----------------------------------------------------------------------------
 buffer handling related prototypes
 *---------------------------------------------------------------------------*/
typedef struct {
	int   in;
	int   out;
	char *buf;
} buf_t;


void buf_Init (buf_t *buf, char *buffer);
BOOL buf_Put  (buf_t *buf, char  c);
BOOL buf_Get  (buf_t *buf, char *c);
int	 buf_Free (buf_t *buf);

/*----------------------------------------------------------------------------
 Serial interface related prototypes
 *---------------------------------------------------------------------------*/
extern void ser_SetLineCoding (DWORD baudrate, BYTE databits, BYTE parity, BYTE stopbits);
extern void ser_Init          (void);
extern BYTE ser_GetMSR        (void);
extern BYTE ser_GetLSR        (void);
extern int  ser_GetChar       (void);
extern int  ser_PutChar       (int);
extern int  ser_PutString     (const char *);
extern BOOL ser_AvailChar     (void);

⌨️ 快捷键说明

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