/** ****************************************************************************** * File Name : USART.h * Description : This file provides code for the configuration * of the USART instances. ****************************************************************************** ** This notice applies to any and all portions of this file * that are not between comment pairs USER CODE BEGIN and * USER CODE END. Other portions of this file, whether * inserted by the user or by software development tools * are owned by their respective copyright owners. * * COPYRIGHT(c) 2019 STMicroelectronics * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __usart_H #define __usart_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "stm32f1xx_hal.h" #include "main.h" /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ extern UART_HandleTypeDef huart3; /* USER CODE BEGIN Private defines */ typedef struct //缓冲区各变量,用于相关函数的参数 { uint8_t ucBufSize; //缓冲区数组:缓冲区大小 uint8_t ucBufWrInde; //缓冲区数组:写指针 uint8_t ucBufRdInde; //缓冲区数组:读指针 uint8_t ucBufCnt; //缓冲区数组:数据计数 uint8_t ucBufOvf; //缓冲区数组:溢出标志,注意清零 uint8_t * pcBufAddr; //缓冲区数组:首地址指针变量 UART_HandleTypeDef *ptUartHandel; } USART_Buf_TypeDef; /* USER CODE END Private defines */ extern void _Error_Handler(char *, int); void MX_USART3_UART_Init(void); /* USER CODE BEGIN Prototypes */ extern uint8_t UART_RxBuff3[255]; extern USART_Buf_TypeDef UART_RxBuff_Struct3; extern uint8_t UART_TxBuff3[255]; extern USART_Buf_TypeDef UART_TxBuff_Struct3; uint8_t UART_ReadChar(USART_Buf_TypeDef * ptRx, uint8_t ucNum); void UART_DelChar(USART_Buf_TypeDef * ptRx, uint8_t ucNum); void UART_PutChar(USART_Buf_TypeDef * ptTx, uint8_t ucData); void UART_SendData(USART_Buf_TypeDef * ptTx, uint8_t* Data, uint8_t Length); void USARTx_Rx_IRQ(USART_Buf_TypeDef *USARTx_RxBuf_Struct); void USARTx_Tx_IRQ(USART_Buf_TypeDef *USARTx_TxBuf_Struct); /* USER CODE END Prototypes */ #ifdef __cplusplus } #endif #endif /*__ usart_H */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/