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

📄 uart.h

📁 freemodbus-v1-1-1-0.zip v1.1.1版本的代码 支持多个平台
💻 H
📖 第 1 页 / 共 2 页
字号:
* Return         : None*******************************************************************************/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 desired 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 configure the Time Out Period.* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired 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 configure the Guard Time.* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired 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 desired 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 desired 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 data byte to the selected UART.* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART* Input 2        : A pointer to 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 bits data byte to the selected UART.* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART* Input 2        : A pointer to 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 desired UART* Input 2        : A pointer to 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 bytes to the selected UART.* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART* Input 2        : A pointer to 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 desired UART* Input 2        : A pointer to 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 desired UART* Input 2        : A pointer to the buffer where the data will be stored* Input 3        : The time-out period* Output         : The received data* Return         : The UARTx.SR register contents*******************************************************************************/u16 UART_ByteReceive(UART_TypeDef *UARTx, u8 *Data, u8 TimeOut);/******************************************************************************** Function Name  : UART_9BitByteReceive* Description    : This function gets a 9 bits data byte from the selected UART.* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART* Input 2        : A pointer to the buffer where the data will be stored* Input 3        : The time-out period value* Output         : The received data* Return         : The UARTx.SR register contents*******************************************************************************/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 desired 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 data* Return         : The UARTx.SR register contents*******************************************************************************/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 desired 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 data* Return         : The UARTx.SR register contents*******************************************************************************/u16 UART_9BitDataReceive(UART_TypeDef *UARTx, u16 *Data, u8 DataLength, u8 TimeOut);/******************************************************************************** Function Name  : UART_StringReceive* Description    : This function gets 8 bits data bytes from the selected UART.* Input 1        : UARTx (x can be 0,1, 2 or 3) the desired UART* Input 2        : A pointer to 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 desired 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 to 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 + -