协议栈UART实验
打开串口功能
HAL_UART=TRUE
HAL_UART_USB=FALSE
串口操作定义在hal_uart.h 头文件中
/*
* Initialize UART at the startup
* 初始化UART
*/
extern void HalUARTInit ( void );
/*
* Open a port based on the configuration
* 打开串口
*/
extern uint8 HalUARTOpen ( uint8 port, halUARTCfg_t *config );
/*
* Close a port
* 关闭串口
*/
extern void HalUARTClose ( uint8 port );
/*
* Read a buffer from the UART
* 从串口读取数据
*/
extern uint16 HalUARTRead ( uint8 port, uint8 *pBuffer, uint16 length );
/*
* Write a buff to the uart
* 向串口写入数据
*/
extern uint16 HalUARTWrite ( uint8 port, uint8 *pBuffer, uint16 length );
/*
* Write a buffer to the UART
*/
extern uint8 HalUARTIoctl ( uint8 port, uint8 cmd, halUARTIoctl_t *pIoctl );
/*
* This to support polling
*/
extern void HalUARTPoll( void );
/*
* Return the number of bytes in the Rx buffer
*/
extern uint16 Hal_UART_RxBufLen ( uint8 port );
/*
* Return the number of bytes in the Tx buffer
*/
extern uint16 Hal_UART_TxBufLen ( uint8 port );
/*
* This enable/disable flow control
*/
extern void Hal_UART_FlowControlSet ( uint8 port, bool status );
/*
* Initialize hardware for UART
*/
extern uint8 HalUART_HW_Init(uint8 port);
/*
* Abort UART when entering sleep mode
*/
extern void HalUARTSuspend(void);
/*
* Resume UART after wakeup from sleep
* 从睡眠状态恢复uart
*/
extern void HalUARTResume(void);