main.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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) 2020 STMicroelectronics.
  11. * All rights reserved.</center></h2>
  12. *
  13. * This software component is licensed by ST under BSD 3-Clause license,
  14. * the "License"; You may not use this file except in compliance with the
  15. * License. You may obtain a copy of the License at:
  16. * opensource.org/licenses/BSD-3-Clause
  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. #include "Bluecell_operate.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. /* USER CODE END EM */
  42. /* Exported functions prototypes ---------------------------------------------*/
  43. void Error_Handler(void);
  44. /* USER CODE BEGIN EFP */
  45. extern volatile uint16_t ADC1value[4];
  46. extern volatile uint16_t ADC3value[5];
  47. extern uint32_t adc1cnt;
  48. extern uint32_t adc3cnt;
  49. extern ADC_HandleTypeDef hadc1;
  50. extern ADC_HandleTypeDef hadc3;
  51. extern I2C_HandleTypeDef hi2c2;
  52. /* USER CODE END EFP */
  53. /* Private defines -----------------------------------------------------------*/
  54. #define LED_FAIL2_Pin GPIO_PIN_3
  55. #define LED_FAIL2_GPIO_Port GPIOE
  56. #define FAIL_MBIC_Pin GPIO_PIN_4
  57. #define FAIL_MBIC_GPIO_Port GPIOE
  58. #define BOOT_LED_Pin GPIO_PIN_15
  59. #define BOOT_LED_GPIO_Port GPIOC
  60. #define DET_UL4_OUT_Pin GPIO_PIN_6
  61. #define DET_UL4_OUT_GPIO_Port GPIOF
  62. #define DET_DL1_IN_Pin GPIO_PIN_7
  63. #define DET_DL1_IN_GPIO_Port GPIOF
  64. #define DET_DL2_IN_Pin GPIO_PIN_8
  65. #define DET_DL2_IN_GPIO_Port GPIOF
  66. #define DET_DL3_IN_Pin GPIO_PIN_9
  67. #define DET_DL3_IN_GPIO_Port GPIOF
  68. #define DET_DL4_IN_Pin GPIO_PIN_10
  69. #define DET_DL4_IN_GPIO_Port GPIOF
  70. #define RFU_TEMP_Pin GPIO_PIN_2
  71. #define RFU_TEMP_GPIO_Port GPIOC
  72. #define RFU_TX_Pin GPIO_PIN_2
  73. #define RFU_TX_GPIO_Port GPIOA
  74. #define RFU_RX_Pin GPIO_PIN_3
  75. #define RFU_RX_GPIO_Port GPIOA
  76. #define DET_UL1_OUT_Pin GPIO_PIN_4
  77. #define DET_UL1_OUT_GPIO_Port GPIOA
  78. #define DET_UL2_OUT_Pin GPIO_PIN_5
  79. #define DET_UL2_OUT_GPIO_Port GPIOA
  80. #define DET_UL3_OUT_Pin GPIO_PIN_6
  81. #define DET_UL3_OUT_GPIO_Port GPIOA
  82. #define ATT_CLOCK3_Pin GPIO_PIN_0
  83. #define ATT_CLOCK3_GPIO_Port GPIOG
  84. #define ATT_DATA3_Pin GPIO_PIN_1
  85. #define ATT_DATA3_GPIO_Port GPIOG
  86. #define ATT_CLOCK4_Pin GPIO_PIN_10
  87. #define ATT_CLOCK4_GPIO_Port GPIOE
  88. #define ATT_DATA4_Pin GPIO_PIN_11
  89. #define ATT_DATA4_GPIO_Port GPIOE
  90. #define ATT_EN_DL4_Pin GPIO_PIN_12
  91. #define ATT_EN_DL4_GPIO_Port GPIOE
  92. #define ATT_EN_UL4_Pin GPIO_PIN_13
  93. #define ATT_EN_UL4_GPIO_Port GPIOE
  94. #define PATH_EN_DL4_Pin GPIO_PIN_14
  95. #define PATH_EN_DL4_GPIO_Port GPIOE
  96. #define PATH_EN_UL4_Pin GPIO_PIN_15
  97. #define PATH_EN_UL4_GPIO_Port GPIOE
  98. #define EEPROM_SCL_Pin GPIO_PIN_10
  99. #define EEPROM_SCL_GPIO_Port GPIOB
  100. #define EEPROM_SDA_Pin GPIO_PIN_11
  101. #define EEPROM_SDA_GPIO_Port GPIOB
  102. #define ATT_EN_UL1_Pin GPIO_PIN_14
  103. #define ATT_EN_UL1_GPIO_Port GPIOB
  104. #define PATH_EN_DL1_Pin GPIO_PIN_15
  105. #define PATH_EN_DL1_GPIO_Port GPIOB
  106. #define PATH_EN_DL2_Pin GPIO_PIN_10
  107. #define PATH_EN_DL2_GPIO_Port GPIOD
  108. #define PATH_EN_UL2_Pin GPIO_PIN_11
  109. #define PATH_EN_UL2_GPIO_Port GPIOD
  110. #define LED_ACT_Pin GPIO_PIN_14
  111. #define LED_ACT_GPIO_Port GPIOD
  112. #define LED_FAIL_Pin GPIO_PIN_15
  113. #define LED_FAIL_GPIO_Port GPIOD
  114. #define ATT_EN_DL3_Pin GPIO_PIN_2
  115. #define ATT_EN_DL3_GPIO_Port GPIOG
  116. #define ATT_EN_UL3_Pin GPIO_PIN_3
  117. #define ATT_EN_UL3_GPIO_Port GPIOG
  118. #define PATH_EN_DL3_Pin GPIO_PIN_4
  119. #define PATH_EN_DL3_GPIO_Port GPIOG
  120. #define PATH_EN_UL3_Pin GPIO_PIN_5
  121. #define PATH_EN_UL3_GPIO_Port GPIOG
  122. #define _PATH_SW1_Pin GPIO_PIN_8
  123. #define _PATH_SW1_GPIO_Port GPIOG
  124. #define PATH_EN_UL1_Pin GPIO_PIN_6
  125. #define PATH_EN_UL1_GPIO_Port GPIOC
  126. #define MBIC_UP_Pin GPIO_PIN_9
  127. #define MBIC_UP_GPIO_Port GPIOA
  128. #define MBIC_DOWN_Pin GPIO_PIN_10
  129. #define MBIC_DOWN_GPIO_Port GPIOA
  130. #define UNIT_ID0_Pin GPIO_PIN_10
  131. #define UNIT_ID0_GPIO_Port GPIOC
  132. #define UNIT_ID1_Pin GPIO_PIN_11
  133. #define UNIT_ID1_GPIO_Port GPIOC
  134. #define UNIT_ID2_Pin GPIO_PIN_12
  135. #define UNIT_ID2_GPIO_Port GPIOC
  136. #define UNIT_ID3_Pin GPIO_PIN_0
  137. #define UNIT_ID3_GPIO_Port GPIOD
  138. #define ATT_CLOCK2_Pin GPIO_PIN_2
  139. #define ATT_CLOCK2_GPIO_Port GPIOD
  140. #define ATT_DATA2_Pin GPIO_PIN_3
  141. #define ATT_DATA2_GPIO_Port GPIOD
  142. #define ATT_EN_DL2_Pin GPIO_PIN_4
  143. #define ATT_EN_DL2_GPIO_Port GPIOD
  144. #define ATT_EN_UL2_Pin GPIO_PIN_7
  145. #define ATT_EN_UL2_GPIO_Port GPIOD
  146. #define PATH_SW1_Pin GPIO_PIN_9
  147. #define PATH_SW1_GPIO_Port GPIOG
  148. #define _PATH_SW2_Pin GPIO_PIN_10
  149. #define _PATH_SW2_GPIO_Port GPIOG
  150. #define PATH_SW2_Pin GPIO_PIN_11
  151. #define PATH_SW2_GPIO_Port GPIOG
  152. #define _PATH_SW3_Pin GPIO_PIN_12
  153. #define _PATH_SW3_GPIO_Port GPIOG
  154. #define PATH_SW3_Pin GPIO_PIN_13
  155. #define PATH_SW3_GPIO_Port GPIOG
  156. #define _PATH_SW4_Pin GPIO_PIN_14
  157. #define _PATH_SW4_GPIO_Port GPIOG
  158. #define PATH_SW4_Pin GPIO_PIN_15
  159. #define PATH_SW4_GPIO_Port GPIOG
  160. #define ATT_CLOCK1_Pin GPIO_PIN_6
  161. #define ATT_CLOCK1_GPIO_Port GPIOB
  162. #define ATT_DATA1_Pin GPIO_PIN_7
  163. #define ATT_DATA1_GPIO_Port GPIOB
  164. #define ATT_EN_DL1_Pin GPIO_PIN_9
  165. #define ATT_EN_DL1_GPIO_Port GPIOB
  166. /* USER CODE BEGIN Private defines */
  167. #define MBIC_ON_MAINTAIN_SEC 3000
  168. #define MBIC_ON_SHUTDOWN_MAINTAIN_SEC 5000//5
  169. #define MBIC_RECOVERY_SHUTDOWN_MAINTAIN_SEC 20000//30
  170. #define MBIC_RECOVERY_LAST_SHUTDOWN_MAINTAIN_SEC 52000 * 5 //5min
  171. #define MBIC_RECOVERY_SELFTEST_TIMER_SEC 1800000 //30min
  172. #define MBIC_OFF_MAINTAIN_SEC 10000
  173. #define ADC_AVERAGECNT 100
  174. #define ADC1_CNT 4
  175. #define ADC3_CNT 5
  176. /* USER CODE END Private defines */
  177. #ifdef __cplusplus
  178. }
  179. #endif
  180. #endif /* __MAIN_H */
  181. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/