?? uart.h
字號:
*******************************************************************************/
void UART_FifoReset(UART_TypeDef *UARTx, UARTFIFO_TypeDef FIFO);
/*******************************************************************************
* Function Name : UART_LoopBackConfig
* Description : This function enables or disables the loop back mode of
* the selected UART.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Input 2 : ENABLE or DISABLE
* Output : None
* Return : None
*******************************************************************************/
void UART_LoopBackConfig(UART_TypeDef *UARTx, FunctionalState NewState);
/*******************************************************************************
* Function Name : UART_TimeOutPeriodConfig
* Description : This function configures the UART Time Out Period.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Input 2 : The time-out period value
* Output : None
* Return : None
*******************************************************************************/
inline void UART_TimeOutPeriodConfig(UART_TypeDef *UARTx, u16 TimeOutPeriod)
{
UARTx->TOR = TimeOutPeriod;
}
/*******************************************************************************
* Function Name : UART_GuardTimeConfig
* Description : This function configures the UART Guard Time.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Input 2 : The guard time value
* Output : None
* Return : None
*******************************************************************************/
inline void UART_GuardTimeConfig(UART_TypeDef *UARTx, u16 GuardTime)
{
UARTx->GTR = GuardTime;
}
/*******************************************************************************
* Function Name : UART_RxConfig
* Description : This function enable and disable the UART data reception.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Input 2 : ENABLE or DISABLE
* Output : None
* Return : None
*******************************************************************************/
void UART_RxConfig(UART_TypeDef *UARTx, FunctionalState NewState);
/*******************************************************************************
* Function Name : UART_OnOffConfig
* Description : This function sets On/Off the selected UART.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Input 2 : ENABLE or DISABLE
* Output : None
* Return : None
*******************************************************************************/
void UART_OnOffConfig(UART_TypeDef *UARTx, FunctionalState NewState);
/*******************************************************************************
* Function Name : UART_ByteSend
* Description : This function sends a byte to the selected UART.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Input 2 : A pointer on the data byte to send
* Output : None
* Return : None
*******************************************************************************/
void UART_ByteSend(UART_TypeDef *UARTx, u8 *Data);
/*******************************************************************************
* Function Name : UART_9BitByteSend
* Description : This function sends a 9-bit data to the selected UART.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Input 2 : A pointer on the data to send
* Output : None
* Return : None
*******************************************************************************/
void UART_9BitByteSend(UART_TypeDef *UARTx, u16 *Data);
/*******************************************************************************
* Function Name : UART_DataSend
* Description : This function sends several data bytes to the selected UART.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Input 2 : A pointer on the data to send
* Input 3 : The data length in bytes
* Output : None
* Return : None
*******************************************************************************/
void UART_DataSend(UART_TypeDef *UARTx, u8 *Data, u8 DataLength);
/*******************************************************************************
* Function Name : UART_9BitDataSend
* Description : This function sends several 9-bits data to the selected UART.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Input 2 : A pointer on the data to send
* Input 3 : The data length
* Output : None
* Return : None
*******************************************************************************/
void UART_9BitDataSend(UART_TypeDef *UARTx, u16 *Data, u8 DataLength);
/*******************************************************************************
* Function Name : UART_StringSend
* Description : This function sends a string to the selected UART.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Input 2 : A pointer on the string to send
* Output : None
* Return : None
*******************************************************************************/
void UART_StringSend(UART_TypeDef *UARTx, u8 *String);
/*******************************************************************************
* Function Name : UART_ByteReceive
* Description : This function gets a data byte from the selected UART.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Input 2 : A pointer on the buffer where the data will be stored
* Input 3 : The time-out period
* Output : The received 8-bit data
* Return : The UARTx.SR register content
*******************************************************************************/
u16 UART_ByteReceive(UART_TypeDef *UARTx, u8 *Data, u8 TimeOut);
/*******************************************************************************
* Function Name : UART_9BitByteReceive
* Description : This function gets a 9-bit data byte from the selected UART.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Input 2 : A pointer on the buffer where the data will be stored
* Input 3 : The time-out period value
* Output : The received 9-bit data
* Return : The UARTx.SR register content
*******************************************************************************/
u16 UART_9BitByteReceive(UART_TypeDef *UARTx, u16 *Data, u8 TimeOut);
/*******************************************************************************
* Function Name : UART_DataReceive
* Description : This function gets 8 bits data bytes from the selected UART.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Input 2 : A pointer to the buffer where the data will be stored
* Input 3 : The data length
* Input 4 : The time-out period value
* Output : The received 8-bit data buffer
* Return : The UARTx.SR register content
*******************************************************************************/
u16 UART_DataReceive(UART_TypeDef *UARTx, u8 *Data, u8 DataLength, u8 TimeOut);
/*******************************************************************************
* Function Name : UART_9BitDataReceive
* Description : This function gets 9 bits data bytes from the selected UART.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Input 2 : A pointer to the buffer where the data will be stored
* Input 3 : The data length
* Input 4 : The time-out value
* Output : The received 9-bit data buffer
* Return : The UARTx.SR register content
*******************************************************************************/
u16 UART_9BitDataReceive(UART_TypeDef *UARTx, u16 *Data, u8 DataLength, u8 TimeOut);
/*******************************************************************************
* Function Name : UART_StringReceive
* Description : This function gets 8-bit data bytes from the selected UART.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Input 2 : A pointer on the buffer where the string will be stored
* Output : None
* Return : None
*******************************************************************************/
u16 UART_StringReceive(UART_TypeDef *UARTx, u8 *Data);
/*******************************************************************************
* Function Name : UART_FlagStatus
* Description : This function gets the flags status of the selected UART.
* Input 1 : UARTx (x can be 0,1, 2 or 3) the selected UART
* Output : None
* Return : None
*******************************************************************************/
inline u16 UART_FlagStatus(UART_TypeDef *UARTx)
{
return UARTx->SR;
}
#ifdef USE_SERIAL_PORT
/*******************************************************************************
* Function Name : sendchar
* Description : This function sends a character to the selected UART.
* Input 1 : A pointer on the character to send.
* Output : None
* Return : None
*******************************************************************************/
void sendchar( char *ch );
#endif /* USE_SERIAL_PORT */
#endif /* _UART_H */
/******************* (C) COPYRIGHT 2003 STMicroelectronics *****END OF FILE****/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -