/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file usart.h * @brief This file contains all the function prototypes for * the usart.c file ****************************************************************************** * @attention * * Copyright (c) 2025 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */ /* USER CODE END Header */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __USART_H__ #define __USART_H__ #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "main.h" /* USER CODE BEGIN Includes */ #define BUFFER_SIZE 512 //大环形队列长度 #define RXBUFFLEN 0x1FF //大环形队列校验 /* USER CODE END Includes */ extern UART_HandleTypeDef huart1; extern UART_HandleTypeDef huart3; /* USER CODE BEGIN Private defines */ typedef struct{ volatile uint16_t rx_len; //接收到的数据长度 volatile uint8_t recv_end_flag;//接收完成标志 uint8_t RX_BUFFER[BUFFER_SIZE];//大缓存数组 }Rxbuff_t; enum { Usart_1, //0 福斯遥控器 SBUS Usart_2, //1 Usart_3, //2 // Usart_4, //3 // Usart_5, //4 // Usart_6, //5 RTK // Usart_7, //6 // TTL_1, //7 // TTL_2, //8 Usart_Num }; typedef struct { uint16_t Write ; uint16_t Read ; uint8_t RX_BUFFER[BUFFER_SIZE]; uint8_t aRxBuff; uint16_t Flag; uint16_t Time_out; uint16_t SendFlag; uint16_t CrcCheck; uint8_t CRC_L; uint8_t CRC_H; uint8_t XorCheck; uint8_t heart[2]; }LOOPRXTYPE; extern Rxbuff_t Rxbuffer[Usart_Num]; /* USER CODE END Private defines */ void MX_USART1_UART_Init(void); void MX_USART3_UART_Init(void); /* USER CODE BEGIN Prototypes */ void Uart_Send(UART_HandleTypeDef *huart,uint8_t *data,uint8_t len); /* USER CODE END Prototypes */ #ifdef __cplusplus } #endif #endif /* __USART_H__ */