usart.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file usart.h
  5. * @brief This file contains all the function prototypes for
  6. * the usart.c file
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * Copyright (c) 2023 STMicroelectronics.
  11. * All rights reserved.
  12. *
  13. * This software is licensed under terms that can be found in the LICENSE file
  14. * in the root directory of this software component.
  15. * If no LICENSE file comes with this software, it is provided AS-IS.
  16. *
  17. ******************************************************************************
  18. */
  19. /* USER CODE END Header */
  20. /* Define to prevent recursive inclusion -------------------------------------*/
  21. #ifndef __USART_H__
  22. #define __USART_H__
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /* Includes ------------------------------------------------------------------*/
  27. #include "main.h"
  28. /* USER CODE BEGIN Includes */
  29. /* USER CODE END Includes */
  30. extern UART_HandleTypeDef huart1;
  31. extern UART_HandleTypeDef huart3;
  32. /* USER CODE BEGIN Private defines */
  33. #define BUF_SIZE 500
  34. #define Uart1_BUF_SIZE 256
  35. #define Uart2_BUF_SIZE 1024 /*为UART2、3专门开一个DMA接收存储区 2021-4-12 by Daiyf*/
  36. #define Uart3_BUF_SIZE 256
  37. extern uint8_t usart1_rx_flag;
  38. extern uint8_t usart3_rx_flag;
  39. extern uint16_t rx1_len;
  40. extern uint16_t rx3_len;
  41. extern uint8_t USART_RX_BUF[Uart1_BUF_SIZE];
  42. extern uint16_t LIB_CRC_MODBUS(uint8_t* Buf, uint16_t srLen);
  43. extern uint8_t USART2_RX_BUF[Uart2_BUF_SIZE];
  44. extern uint8_t USART2_RX_BUF002[Uart2_BUF_SIZE];
  45. /* USER CODE END Private defines */
  46. void MX_USART1_UART_Init(void);
  47. void MX_USART3_UART_Init(void);
  48. /* USER CODE BEGIN Prototypes */
  49. void update_baudrate(uint16_t temp);
  50. /* USER CODE END Prototypes */
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif /* __USART_H__ */