uart.h

来自「AVR2560 Sample C Code(Uart.c)」· C头文件 代码 · 共 53 行

H
53
字号

#ifndef UART_H
#define UART_H

#include "global.h"


//###
//### 脚痹肺 眠啊等 Macro.
//###
#define __UART0			0
#define __UART1			1
#define __UART2			2
#define __UART3			3

#define __UMSEL_MSK		0xC0
#define __ASYNC			0x00
#define __SYNC			0x40
#define __MSPI			0xC0

#define __BYTE_MSK		0x06
#define __9BYTE			9
#define __8BYTE			8
#define __7BYTE			7
#define __6BYTE			6
#define __5BYTE			5

#define __PARITY_MSK	0x30
#define __ODD			0x30
#define __EVEN			0x20
#define __NONE			0x00

#define __STOP_MSK		0x08
#define __1STOP			0x00
#define __2STOP			0x08
#define __15STOP		0x08


// functions
void uartOpen(u16 uUartNo,u32 Baudrate,u08 ucDataByte,u08 ucParity,u08 ucStopBit);
void uartSendByte(u16 uUartNo,u08 txData);
void uartSendString(u16 uUartNo,char* txString);
void uartSetRxHandler(u16 uUartNo,void (*rx_func)(unsigned char c));

void uart0SendByte(u08 txData);
void uart1SendByte(u08 txData);
void uart2SendByte(u08 txData);
void uart3SendByte(u08 txData);
#endif
//@}


⌨️ 快捷键说明

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