?? uart.h
字號:
//-------------------------------------------------------------------------*
// 文件名: uart.h *
// 說 明: uart構件頭文件 *
//-------------------------------------------------------------------------*
#ifndef __UART_H__
#define __UART_H__
//1 頭文件
#include "common.h"
//2 宏定義
//2.1 串口號宏定義
#define UART0 UART0_BASE_PTR
#define UART1 UART1_BASE_PTR
#define UART2 UART2_BASE_PTR
#define UART3 UART3_BASE_PTR
#define UART4 UART4_BASE_PTR
#define UART5 UART5_BASE_PTR
//2.2 接收引腳irq號宏定義
#define UART0irq 45
#define UART1irq 47
#define UART2irq 49
#define UART3irq 51
#define UART4irq 53
#define UART5irq 55
//3 函數聲明
//-------------------------------------------------------------------------*
//函數名: uart_init *
//功 能: 初始化uartx模塊。 *
//參 數: uartch:串口號 *
// sysclk:系統總線時鐘,以MHz為單位 *
// baud:波特率,如9600,38400等,一般來說,速度越慢,通信越穩 *
//返 回: 無 *
//說 明: *
//-------------------------------------------------------------------------*
void uart_init (UART_MemMapPtr uartch, uint32 sysclk, uint32 baud);
//-------------------------------------------------------------------------*
//函數名: uart_re1 *
//功 能: 串行接受1個字節 *
//參 數: uartch: 串口號 *
// ch: 接收到的字節 *
//返 回: 成功:1;失敗:0 *
//說 明: *
//-------------------------------------------------------------------------*
uint8 uart_re1 (UART_MemMapPtr uartch,uint8 *ch);
//-------------------------------------------------------------------------*
//函數名: uart_send1 *
//功 能: 串行發送1個字節 *
//參 數: uartch: 串口號 *
// ch: 要發送的字節 *
//返 回: 無 *
//說 明: *
//-------------------------------------------------------------------------*
void uart_send1 (UART_MemMapPtr uartch, uint8 ch);
//-------------------------------------------------------------------------*
//函數名: uart_reN *
//功 能: 串行 接收n個字節 *
//參 數: uartch: 串口號 *
// buff: 接收緩沖區 *
// len:接收長度 *
//返 回: 1:成功;0:失敗 *
//說 明: *
//-------------------------------------------------------------------------*
uint8 uart_reN (UART_MemMapPtr uartch ,uint8* buff,uint16 len);
//-------------------------------------------------------------------------*
//函數名: uart_sendN *
//功 能: 串行 接收n個字節 *
//參 數: uartch: 串口號 *
// buff: 發送緩沖區 *
// len:發送長度 *
//返 回: 無 *
//說 明: *
//-------------------------------------------------------------------------*
void uart_sendN (UART_MemMapPtr uartch ,uint8* buff,uint16 len);
//-------------------------------------------------------------------------*
//函數名: enableuartreint *
//功 能: 開串口接收中斷 *
//參 數: uartch: 串口號 *
// irqno: 對應irq號 *
//返 回: 無 *
//說 明: *
//-------------------------------------------------------------------------*
void enableuartreint(UART_MemMapPtr uartch,uint8 irqno);
//-------------------------------------------------------------------------*
//函數名: disableuartreint *
//功 能: 關串口接收中斷 *
//參 數: uartch: 串口號 *
// irqno: 對應irq號 *
//返 回: 無 *
//說 明: *
//-------------------------------------------------------------------------*
void disableuartreint(UART_MemMapPtr uartch,uint8 irqno);
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -