usart.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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) 2025 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 BaudRate_4800 (0x01)
  34. #define BaudRate_9600 (0x02)
  35. #define BaudRate_19200 (0x03)
  36. #define BaudRate_38400 (0x04)
  37. #define BaudRate_57600 (0x05)
  38. #define BaudRate_115200 (0x06)
  39. #define BaudRate_230400 (0x07)
  40. #define UART_BaudRate 9600
  41. #define UART_TRANSMIT_DATA_POOL_COUNT (128)
  42. #define UART_RECV_DATA_POOL_COUNT (320)
  43. typedef struct
  44. {
  45. uint16_t recv_len;
  46. uint16_t send_len;
  47. uint8_t* recv_buffer;
  48. uint8_t* send_buffer;
  49. uint8_t dmasend_count; //ms count
  50. uint8_t res;
  51. }UART_INFO;
  52. extern UART_INFO rs485_info;
  53. void rs485_TransmitData(uint8_t *pdata, uint16_t length);
  54. void rs485_ReceiveData(void);
  55. /* USER CODE END Private defines */
  56. void MX_USART1_UART_Init(void);
  57. void MX_USART3_UART_Init(void);
  58. /* USER CODE BEGIN Prototypes */
  59. /* USER CODE END Prototypes */
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. #endif /* __USART_H__ */