/*********************************************************************************
* Variables
**********************************************************************************/
// The receive data buffer
static uint8_t rev_buff[USART_RXD_BUF_SIZE] = {0};
static uint8_t datBuff[USART_RXD_BUF_SIZE] = {0};
static uint8_t revUart2[USART_RXD_BUF_SIZE] = {0};
static uint8_t datUart2Buff[USART_RXD_BUF_SIZE] = {0};
static uint8_t sendBuff[DEBUG_PRINT_BUF_LEN] = {0};
static uint8_t send2Buff[USART2_TX_BUF_SIZE] = {0};
// TRUE - been received data FALSE - no data received
static uint8_t revFlag = FALSE;
static uint8_t revUart2Flag = FALSE;
/*********************************************************************************
* Name : Uart1_Gpio_Init
*
* Brief : Initialized the uart1 port.
*
* Input : None
*
* Output : None
*
* Remark : PA9-TX,PA10-RX,banudrate=9600
***********************************************************************************/
void Uart1_Gpio_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
// 开启串口时钟及端口时钟
RCC_APB2PeriphClockCmd(USART1_RCC, ENABLE);
RCC_AHBPeriphClockCmd(USART1_PORT_RCC, ENABLE);
GPIO_PinAFConfig(USART1_MAP_PORT, UART1_TXD_PINSOURCE, UART1_AF_TXD);
GPIO_PinAFConfig(USART1_MAP_PORT, UART1_RXD_PINSOURCE, UART1_AF_RXD);
// 配置 TX 端口
GPIO_InitStructure.GPIO_Pin = (UART1_TXD_PIN | UART1_RXD_PIN);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;