main.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
  11. * All rights reserved.</center></h2>
  12. *
  13. * This software component is licensed by ST under Ultimate Liberty license
  14. * SLA0044, the "License"; You may not use this file except in compliance with
  15. * the License. You may obtain a copy of the License at:
  16. * www.st.com/SLA0044
  17. *
  18. ******************************************************************************
  19. */
  20. /* USER CODE END Header */
  21. /* Define to prevent recursive inclusion -------------------------------------*/
  22. #ifndef __MAIN_H
  23. #define __MAIN_H
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. /* Includes ------------------------------------------------------------------*/
  28. #include "stm32f1xx_hal.h"
  29. /* Private includes ----------------------------------------------------------*/
  30. /* USER CODE BEGIN Includes */
  31. //#define DEBUG
  32. #ifdef DEBUG
  33. #define WatchDogOn 0 //关闭看门狗
  34. #else
  35. #define WatchDogOn 1 //打开看门狗
  36. #endif
  37. //0----关闭看门狗SP706 1----打开看门狗SP706--------------必须配置的参数1/3
  38. //#define WatchDogOn 1 //是否打开看门狗
  39. //#define WatchDogOn 0 //是否打开看门狗
  40. /* USER CODE END Includes */
  41. /* Exported types ------------------------------------------------------------*/
  42. /* USER CODE BEGIN ET */
  43. //李伟修改 20210610 远程标定命令结构体
  44. /*
  45. 总长度为64字节;后期自己研发终端可以扩大,预计1k字节可以实现。
  46. 帧头2字节0x 3901
  47. 地址码 4字节,比如0x95510001
  48. 功能码2字节 只能是0x0003、0x0006或者0x0010
  49. 寄存器起始地址2字节:合法范围为0x0000~0xffff
  50. 数据个数2字节:最多读取0xffff字节;实际取决于终端限制,目前为256字节
  51. 保留字4字节
  52. 有效载荷44字节
  53. 保留字2字节
  54. 校验2字节
  55. */
  56. typedef struct _T2C_RemoteCaliData
  57. {
  58. uint16_t FrameHead; //帧头 0-1
  59. uint32_t AddrExtModule; //4字节扩展地址 2--5
  60. uint16_t FunctionCode; //功能码2字节 只能是0x0003、0x0006或者0x0010 6--7
  61. uint16_t AddrRegStart; //寄存器起始地址2字节:合法范围为0x0000~0xffff 8--9
  62. uint16_t NumberOfRegs; //数据个数2字节:最多读取0xffff字节;实际取决于终端限制,目前为256字节 10--11
  63. uint32_t ReserveData001; //保留字4字节 12--15
  64. uint8_t PayLoadData[44+32+32]; //有效载荷具体有三种:44,或者76字节,或者108字节;字节 16--59
  65. uint16_t ReserveData002; //保留字2字节 60--61
  66. uint16_t CheckSum; //校验2字节 62--63
  67. }sT2C_RemoteCaliDat;
  68. /* USER CODE END ET */
  69. /* Exported constants --------------------------------------------------------*/
  70. /* USER CODE BEGIN EC */
  71. /* USER CODE END EC */
  72. /* Exported macro ------------------------------------------------------------*/
  73. /* USER CODE BEGIN EM */
  74. /* USER CODE END EM */
  75. /* Exported functions prototypes ---------------------------------------------*/
  76. void Error_Handler(void);
  77. /* USER CODE BEGIN EFP */
  78. void delay_sys_us(uint32_t Delay);
  79. /* USER CODE END EFP */
  80. /* Private defines -----------------------------------------------------------*/
  81. #define LED1_Pin GPIO_PIN_0
  82. #define LED1_GPIO_Port GPIOA
  83. #define LED2_Pin GPIO_PIN_1
  84. #define LED2_GPIO_Port GPIOA
  85. #define con03_uart2_kongzhiqi_Pin GPIO_PIN_4
  86. #define con03_uart2_kongzhiqi_GPIO_Port GPIOA
  87. #define con02_uart3_xieyoufa_Pin GPIO_PIN_12
  88. #define con02_uart3_xieyoufa_GPIO_Port GPIOB
  89. #define Con01_uart1_rankonggai_Pin GPIO_PIN_13
  90. #define Con01_uart1_rankonggai_GPIO_Port GPIOB
  91. #define IN01_Pin GPIO_PIN_14
  92. #define IN01_GPIO_Port GPIOB
  93. #define WDI_sp706_kanmemgou_Pin GPIO_PIN_10
  94. #define WDI_sp706_kanmemgou_GPIO_Port GPIOC
  95. /* USER CODE BEGIN Private defines */
  96. typedef union{
  97. float flo;
  98. char array_u8[4];
  99. uint32_t u32Dat;
  100. } uni_float;//uni_temper001;//4字节浮点数表示
  101. /* USER CODE END Private defines */
  102. #ifdef __cplusplus
  103. }
  104. #endif
  105. extern uint32_t Version_Soft[8];
  106. #endif /* __MAIN_H */
  107. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/