main.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. //0----关闭看门狗SP706 1----打开看门狗SP706--------------必须配置的参数1/3
  32. //#define WatchDogOn 1 //是否打开看门狗
  33. #define WatchDogOn 1 //是否打开看门狗
  34. /* USER CODE END Includes */
  35. /* Exported types ------------------------------------------------------------*/
  36. /* USER CODE BEGIN ET */
  37. //李伟修改 20210610 远程标定命令结构体
  38. /*
  39. 总长度为64字节;后期自己研发终端可以扩大,预计1k字节可以实现。
  40. 帧头2字节0x 3901
  41. 地址码 4字节,比如0x95510001
  42. 功能码2字节 只能是0x0003、0x0006或者0x0010
  43. 寄存器起始地址2字节:合法范围为0x0000~0xffff
  44. 数据个数2字节:最多读取0xffff字节;实际取决于终端限制,目前为256字节
  45. 保留字4字节
  46. 有效载荷44字节
  47. 保留字2字节
  48. 校验2字节
  49. */
  50. typedef struct _T2C_RemoteCaliData
  51. {
  52. uint16_t FrameHead; //帧头 0-1
  53. uint32_t AddrExtModule; //4字节扩展地址 2--5
  54. uint16_t FunctionCode; //功能码2字节 只能是0x0003、0x0006或者0x0010 6--7
  55. uint16_t AddrRegStart; //寄存器起始地址2字节:合法范围为0x0000~0xffff 8--9
  56. uint16_t NumberOfRegs; //数据个数2字节:最多读取0xffff字节;实际取决于终端限制,目前为256字节 10--11
  57. uint32_t ReserveData001; //保留字4字节 12--15
  58. uint8_t PayLoadData[44+32+32]; //有效载荷具体有三种:44,或者76字节,或者108字节;字节 16--59
  59. uint16_t ReserveData002; //保留字2字节 60--61
  60. uint16_t CheckSum; //校验2字节 62--63
  61. }sT2C_RemoteCaliDat;
  62. /* USER CODE END ET */
  63. /* Exported constants --------------------------------------------------------*/
  64. /* USER CODE BEGIN EC */
  65. /* USER CODE END EC */
  66. /* Exported macro ------------------------------------------------------------*/
  67. /* USER CODE BEGIN EM */
  68. /* USER CODE END EM */
  69. /* Exported functions prototypes ---------------------------------------------*/
  70. void Error_Handler(void);
  71. /* USER CODE BEGIN EFP */
  72. void delay_sys_us(uint32_t Delay);
  73. /* USER CODE END EFP */
  74. /* Private defines -----------------------------------------------------------*/
  75. #define LED1_Pin GPIO_PIN_0
  76. #define LED1_GPIO_Port GPIOA
  77. #define LED2_Pin GPIO_PIN_1
  78. #define LED2_GPIO_Port GPIOA
  79. #define con03_uart2_kongzhiqi_Pin GPIO_PIN_4
  80. #define con03_uart2_kongzhiqi_GPIO_Port GPIOA
  81. #define con02_uart3_xieyoufa_Pin GPIO_PIN_12
  82. #define con02_uart3_xieyoufa_GPIO_Port GPIOB
  83. #define Con01_uart1_rankonggai_Pin GPIO_PIN_13
  84. #define Con01_uart1_rankonggai_GPIO_Port GPIOB
  85. #define IN01_Pin GPIO_PIN_14
  86. #define IN01_GPIO_Port GPIOB
  87. #define WDI_sp706_kanmemgou_Pin GPIO_PIN_10
  88. #define WDI_sp706_kanmemgou_GPIO_Port GPIOC
  89. /* USER CODE BEGIN Private defines */
  90. typedef union{
  91. float flo;
  92. char array_u8[4];
  93. uint32_t u32Dat;
  94. } uni_float;//uni_temper001;//4字节浮点数表示
  95. /* USER CODE END Private defines */
  96. #ifdef __cplusplus
  97. }
  98. #endif
  99. #endif /* __MAIN_H */
  100. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/