⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uart0.h

📁 自己编写的飞利浦LPC2200的串口驱动,可以支持在OS下和非OS下,主要通过在.h档下配置实现
💻 H
字号:
#ifndef _UART0_H_
#define _UART0_H_

#include "config.h"

#ifdef _UART0_C_
static uint8 UART0SendSem;
static uint8 UART0ReceiveSem;
static uint8 UART0SendQSem;
static uint8 UART0ReceiveQSem;
#endif

#ifndef NULL
#define NULL (void *)0
#endif

#define UART0_SENDQ_LENGTH					64
#define UART0_Receive_LENGTH				16

#define UART0_EnterCritical()				
#define UART0_ExitCritical()				
#define UART0_SemCreate(sem, val, pErr)		do{sem = val;*pErr = 0;}while(0)
#define UART0_SemPend(sem)					do{while(sem == 0);sem--;}while(0)
#define UART0_SemPost(sem)					do{sem++;}while(0)

enum
{
	NO_PARITY,
	ODD,
	EVEN,
	FORCE_0,
	FORCE_1
};


uint8 UART0_Init(uint32 baud, uint8 dataBits, uint8 parityCheck, uint8 stopBits);
void UART0_Setup(uint32 baud, uint8 dataBits, uint8 parityCheck, uint8 stopBits);
void UART0_Send(uint8 *buf, uint32 nBytes);
void UART0_Receive(uint8 *buf, uint32 nBytes);
void UART0_IntService(void);

#endif

⌨️ 快捷键说明

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