该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#ifdef __cplusplus
extern "C" {
#endif
这里大括号“{”为啥在#endif前面,而不放在#endif的后面 大括号的另一边在倒数第三个#endif那 求高手解释?
还有 extern "C" 是什么意思? C还加双引号 很费解?
源头文件如下:
/****************************************Copyright (c)**************************************************
** Guangzhou ZHIYUAN electronics Co.,LTD.
**
**
**--------------File Info-------------------------------------------------------------------------------
** File Name: UART.h
** Last modified Date: 2005-12-31
** Last Version: v1.0
** Description: S3C2410的串口软件包 (头文件)
#ifndef __UART_H
#define __UART_H
#ifndef IN_UART
#ifdef __cplusplus
extern "C" {
#endif
/********************************************************************************************************
** Function name: UART_Select
** Descriptions: 选择要操作的串口。(UART0--0,UART1--1)
** 选择串口后,必需调用一次UART_Init()进行初始化(只需要一次)。
** Input: no 要使用的串口
** Output: 返回上一次选用的串口
********************************************************************************************************/
extern int UART_Select(uint8 no);
/********************************************************************************************************
** Function name: UART_Init
** Descriptions: 初始化串口。设置为8位数据位,1位停止位,无奇偶校验,波特率为UART_BPS
** Input: 无
** Output: 无
********************************************************************************************************/
extern void UART_Init(void);
/********************************************************************************************************
** Function name: UART_SendByte
** Descriptions: 向串口发送字节数据,并等待发送完毕。
** Input: data 要发送的数据
** Output: 无
********************************************************************************************************/
extern void UART_SendByte(uint8 data);
/********************************************************************************************************
** Function name: UART_SendStr
** Descriptions: 向串口发送一字符串。
** 对于'\n'字符,发送时会加入'\r'字符。
** Input: str 要发送的字符串的指针
** Output: 无
********************************************************************************************************/
extern void UART_SendStr(char const *str);
/********************************************************************************************************
** Function name: UART_GetKey
** Descriptions: 从UART口读取一字节按键数据。
** 会一直等待,直到接收到1字节数据。
** Input: 无
** Output: 返回值即是读出值
********************************************************************************************************/
extern int UART_GetKey(void);
/********************************************************************************************************/
#ifdef __cplusplus
}
#endif
#endif // IN_UART
#endif // __UART_H
/*********************************************************************************************************
** End Of File
********************************************************************************************************/