main.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file : main.h
  5. * @brief : Header for main.c file.
  6. * This file contains the common defines of the application.
  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 __MAIN_H
  22. #define __MAIN_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /* Includes ------------------------------------------------------------------*/
  27. #include "stm32f1xx_hal.h"
  28. /* Private includes ----------------------------------------------------------*/
  29. /* USER CODE BEGIN Includes */
  30. #include "stdio.h"
  31. #include "string.h"
  32. /* USER CODE END Includes */
  33. /* Exported types ------------------------------------------------------------*/
  34. /* USER CODE BEGIN ET */
  35. /* USER CODE END ET */
  36. /* Exported constants --------------------------------------------------------*/
  37. /* USER CODE BEGIN EC */
  38. /* USER CODE END EC */
  39. /* Exported macro ------------------------------------------------------------*/
  40. /* USER CODE BEGIN EM */
  41. #define Rx_Max 1024
  42. #define Version_sys 0x23060500
  43. extern uint16_t Adc2_CalibrationValue ;
  44. extern uint16_t Adc3_CalibrationValue ;
  45. extern uint8_t gpioaStatus ;
  46. extern uint8_t gpiobStatus ;
  47. extern uint8_t Rx_Flag;
  48. extern uint16_t Rx_Len;
  49. extern uint8_t Rx_Buf[Rx_Max];
  50. /* USER CODE END EM */
  51. /* Exported functions prototypes ---------------------------------------------*/
  52. void Error_Handler(void);
  53. /* USER CODE BEGIN EFP */
  54. uint16_t read_flash_16(uint32_t addr);
  55. void read_new_address(uint32_t addr);
  56. void Write_Information(uint32_t addr, uint8_t* rx_buffer, uint8_t buffer_index);
  57. /* USER CODE END EFP */
  58. /* Private defines -----------------------------------------------------------*/
  59. /* USER CODE BEGIN Private defines */
  60. #define FILTER_LENGTH 10
  61. #define DEBOUNCE_COUNT 10
  62. #define Modbus 1
  63. #define ADDR_FLASH_PAGE_94 ((uint32_t)0x802F000) // Flash扇区94页的起始地址 address
  64. #define ADDR_FLASH_PAGE_104 ((uint32_t)0x8034000) // Flash扇区104页的起始地址 PbStatus
  65. #define ADDR_FLASH_PAGE_114 ((uint32_t)0x8039000) // Flash扇区114页的起始地址 Baudrate
  66. #define ADDR_FLASH_PAGE_124 ((uint32_t)0x803E000) // Flash扇区124页的起始地址 Adc2_Calibration 4-20mA
  67. #define ADDR_FLASH_PAGE_134 ((uint32_t)0x8043000) // Flash扇区134页的起始地址 Adc3_Calibration 4-20mA
  68. #define ADDR_FLASH_PAGE_144 ((uint32_t)0x8048000) // Flash扇区144页的起始地址
  69. /* USER CODE END Private defines */
  70. #ifdef __cplusplus
  71. }
  72. #endif
  73. #endif /* __MAIN_H */