main(344).h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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) 2019 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 <stdio.h>
  32. #include <stdbool.h>
  33. #include "PE43711.h"
  34. #include "BDA4601.h"
  35. #include "zig_operate.h"
  36. #include "pll_4113.h"
  37. #include "adf4153.h"
  38. #include "uart.h"
  39. #include "includes.h"
  40. #include "ad5318.h"
  41. /* USER CODE END Includes */
  42. /* Exported types ------------------------------------------------------------*/
  43. /* USER CODE BEGIN ET */
  44. /* USER CODE END ET */
  45. /* Exported constants --------------------------------------------------------*/
  46. /* USER CODE BEGIN EC */
  47. typedef struct _ATTEN_Setting_st{
  48. GPIO_TypeDef * CLK_PORT;
  49. uint16_t CLK_PIN;
  50. GPIO_TypeDef * DATA_PORT;
  51. uint16_t DATA_PIN;
  52. GPIO_TypeDef * ENABLE_PORT;
  53. uint16_t ENABLE_PIN;
  54. GPIO_TypeDef * PATH_EN_PORT;
  55. uint16_t PATH_EN_PIN;
  56. } ATTEN_Setting_st;
  57. /* USER CODE END EC */
  58. /* Exported macro ------------------------------------------------------------*/
  59. /* USER CODE BEGIN EM */
  60. volatile uint32_t UartRxTimerCnt;
  61. volatile uint32_t AdcTimerCnt;
  62. /* USER CODE END EM */
  63. /* Exported functions prototypes ---------------------------------------------*/
  64. void Error_Handler(void);
  65. /* USER CODE BEGIN EFP */
  66. extern void Pol_Delay_us(volatile uint32_t microseconds);
  67. extern void ATTEN_PLL_PATH_Initialize(void);
  68. /* USER CODE END EFP */
  69. /* Private defines -----------------------------------------------------------*/
  70. #define ATT_EN_1_8G_DL1_Pin GPIO_PIN_2
  71. #define ATT_EN_1_8G_DL1_GPIO_Port GPIOE
  72. #define ATT_EN_1_8G_DL2_Pin GPIO_PIN_3
  73. #define ATT_EN_1_8G_DL2_GPIO_Port GPIOE
  74. #define ATT_EN_1_8G_UL1_Pin GPIO_PIN_4
  75. #define ATT_EN_1_8G_UL1_GPIO_Port GPIOE
  76. #define ATT_EN_1_8G_UL2_Pin GPIO_PIN_5
  77. #define ATT_EN_1_8G_UL2_GPIO_Port GPIOE
  78. #define ATT_EN_1_8G_UL3_Pin GPIO_PIN_6
  79. #define ATT_EN_1_8G_UL3_GPIO_Port GPIOE
  80. #define ATT_EN_1_8G_UL4_Pin GPIO_PIN_13
  81. #define ATT_EN_1_8G_UL4_GPIO_Port GPIOC
  82. #define PATH_EN_1_8G_DL_Pin GPIO_PIN_14
  83. #define PATH_EN_1_8G_DL_GPIO_Port GPIOC
  84. #define PATH_EN_1_8G_UL_Pin GPIO_PIN_15
  85. #define PATH_EN_1_8G_UL_GPIO_Port GPIOC
  86. #define PLL_EN_1_8G_DL_Pin GPIO_PIN_0
  87. #define PLL_EN_1_8G_DL_GPIO_Port GPIOF
  88. #define PLL_EN_1_8G_UL_Pin GPIO_PIN_1
  89. #define PLL_EN_1_8G_UL_GPIO_Port GPIOF
  90. #define PLL_LD_1_8G_DL_Pin GPIO_PIN_2
  91. #define PLL_LD_1_8G_DL_GPIO_Port GPIOF
  92. #define PLL_LD_1_8G_UL_Pin GPIO_PIN_3
  93. #define PLL_LD_1_8G_UL_GPIO_Port GPIOF
  94. #define ATT_EN_2_1G_DL1_Pin GPIO_PIN_4
  95. #define ATT_EN_2_1G_DL1_GPIO_Port GPIOF
  96. #define ATT_EN_2_1G_DL2_Pin GPIO_PIN_5
  97. #define ATT_EN_2_1G_DL2_GPIO_Port GPIOF
  98. #define ATT_EN_2_1G_UL1_Pin GPIO_PIN_6
  99. #define ATT_EN_2_1G_UL1_GPIO_Port GPIOF
  100. #define ATT_EN_2_1G_UL2_Pin GPIO_PIN_7
  101. #define ATT_EN_2_1G_UL2_GPIO_Port GPIOF
  102. #define ATT_EN_2_1G_UL3_Pin GPIO_PIN_8
  103. #define ATT_EN_2_1G_UL3_GPIO_Port GPIOF
  104. #define ATT_EN_2_1G_UL4_Pin GPIO_PIN_9
  105. #define ATT_EN_2_1G_UL4_GPIO_Port GPIOF
  106. #define DET_3_5G_UL_IN_Pin GPIO_PIN_0
  107. #define DET_3_5G_UL_IN_GPIO_Port GPIOC
  108. #define DET_3_5G_UL_OUT_Pin GPIO_PIN_1
  109. #define DET_3_5G_UL_OUT_GPIO_Port GPIOC
  110. #define RFU_TEMP_Pin GPIO_PIN_2
  111. #define RFU_TEMP_GPIO_Port GPIOC
  112. #define _28V_DET_Pin GPIO_PIN_3
  113. #define _28V_DET_GPIO_Port GPIOC
  114. #define DET_1_8G_DL_IN_Pin GPIO_PIN_0
  115. #define DET_1_8G_DL_IN_GPIO_Port GPIOA
  116. #define DET_1_8G_DL_OUT_Pin GPIO_PIN_1
  117. #define DET_1_8G_DL_OUT_GPIO_Port GPIOA
  118. #define DET_1_8G_UL_IN_Pin GPIO_PIN_2
  119. #define DET_1_8G_UL_IN_GPIO_Port GPIOA
  120. #define DET_1_8G_UL_OUT_Pin GPIO_PIN_3
  121. #define DET_1_8G_UL_OUT_GPIO_Port GPIOA
  122. #define DET_2_1G_DL_IN_Pin GPIO_PIN_4
  123. #define DET_2_1G_DL_IN_GPIO_Port GPIOA
  124. #define DET_2_1G_DL_OUT_Pin GPIO_PIN_5
  125. #define DET_2_1G_DL_OUT_GPIO_Port GPIOA
  126. #define DET_2_1G_UL_IN_Pin GPIO_PIN_6
  127. #define DET_2_1G_UL_IN_GPIO_Port GPIOA
  128. #define DET_2_1G_UL_OUT_Pin GPIO_PIN_7
  129. #define DET_2_1G_UL_OUT_GPIO_Port GPIOA
  130. #define DET_3_5G_DL_IN_Pin GPIO_PIN_0
  131. #define DET_3_5G_DL_IN_GPIO_Port GPIOB
  132. #define DET_3_5G_DL_OUT_Pin GPIO_PIN_1
  133. #define DET_3_5G_DL_OUT_GPIO_Port GPIOB
  134. #define PLL_DATA_Pin GPIO_PIN_8
  135. #define PLL_DATA_GPIO_Port GPIOD
  136. #define PLL_CLK_Pin GPIO_PIN_9
  137. #define PLL_CLK_GPIO_Port GPIOD
  138. #define ATT_DATA_Pin GPIO_PIN_10
  139. #define ATT_DATA_GPIO_Port GPIOD
  140. #define ATT_CLK_Pin GPIO_PIN_11
  141. #define ATT_CLK_GPIO_Port GPIOD
  142. #define ALARM_DC_Pin GPIO_PIN_12
  143. #define ALARM_DC_GPIO_Port GPIOD
  144. #define ALARM_AC_Pin GPIO_PIN_13
  145. #define ALARM_AC_GPIO_Port GPIOD
  146. #define DA_LDAC_Pin GPIO_PIN_15
  147. #define DA_LDAC_GPIO_Port GPIOD
  148. #define DA_SYNC_Pin GPIO_PIN_2
  149. #define DA_SYNC_GPIO_Port GPIOG
  150. #define DA_SCLK_Pin GPIO_PIN_3
  151. #define DA_SCLK_GPIO_Port GPIOG
  152. #define DA_DIN_Pin GPIO_PIN_4
  153. #define DA_DIN_GPIO_Port GPIOG
  154. #define _T_SYNC_UL_Pin GPIO_PIN_5
  155. #define _T_SYNC_UL_GPIO_Port GPIOG
  156. #define T_SYNC_UL_Pin GPIO_PIN_6
  157. #define T_SYNC_UL_GPIO_Port GPIOG
  158. #define _T_SYNC_DL_Pin GPIO_PIN_7
  159. #define _T_SYNC_DL_GPIO_Port GPIOG
  160. #define T_SYNC_DL_Pin GPIO_PIN_8
  161. #define T_SYNC_DL_GPIO_Port GPIOG
  162. #define PLL_EN_3_5G_L_Pin GPIO_PIN_6
  163. #define PLL_EN_3_5G_L_GPIO_Port GPIOC
  164. #define PLL_EN_3_5G_H_Pin GPIO_PIN_7
  165. #define PLL_EN_3_5G_H_GPIO_Port GPIOC
  166. #define PLL_LD_3_5G_L_Pin GPIO_PIN_8
  167. #define PLL_LD_3_5G_L_GPIO_Port GPIOC
  168. #define PLL_LD_3_5G_H_Pin GPIO_PIN_9
  169. #define PLL_LD_3_5G_H_GPIO_Port GPIOC
  170. #define PLL_CLK_3_5G_Pin GPIO_PIN_15
  171. #define PLL_CLK_3_5G_GPIO_Port GPIOA
  172. #define PLL_ON_OFF_3_5G_L_Pin GPIO_PIN_10
  173. #define PLL_ON_OFF_3_5G_L_GPIO_Port GPIOC
  174. #define PLL_DATA_3_5G_Pin GPIO_PIN_11
  175. #define PLL_DATA_3_5G_GPIO_Port GPIOC
  176. #define PLL_ON_OFF_3_5G_H_Pin GPIO_PIN_12
  177. #define PLL_ON_OFF_3_5G_H_GPIO_Port GPIOC
  178. #define ATT_CLK_3_5G_Pin GPIO_PIN_0
  179. #define ATT_CLK_3_5G_GPIO_Port GPIOD
  180. #define ATT_EN_3_5G_Pin GPIO_PIN_1
  181. #define ATT_EN_3_5G_GPIO_Port GPIOD
  182. #define ATT_DATA_3_5G_DL_Pin GPIO_PIN_2
  183. #define ATT_DATA_3_5G_DL_GPIO_Port GPIOD
  184. #define ATT_DATA_3_5G_UL_Pin GPIO_PIN_3
  185. #define ATT_DATA_3_5G_UL_GPIO_Port GPIOD
  186. #define ATT_DATA_3_5G_COM1_Pin GPIO_PIN_4
  187. #define ATT_DATA_3_5G_COM1_GPIO_Port GPIOD
  188. #define ATT_DATA_3_5G_COM2_Pin GPIO_PIN_5
  189. #define ATT_DATA_3_5G_COM2_GPIO_Port GPIOD
  190. #define ATT_DATA_3_5G_COM3_Pin GPIO_PIN_6
  191. #define ATT_DATA_3_5G_COM3_GPIO_Port GPIOD
  192. #define PATH_EN_3_5G_L_Pin GPIO_PIN_7
  193. #define PATH_EN_3_5G_L_GPIO_Port GPIOD
  194. #define PATH_EN_3_5G_H_Pin GPIO_PIN_9
  195. #define PATH_EN_3_5G_H_GPIO_Port GPIOG
  196. #define PATH_EN_3_5G_DL_Pin GPIO_PIN_10
  197. #define PATH_EN_3_5G_DL_GPIO_Port GPIOG
  198. #define PATH_EN_3_5G_UL_Pin GPIO_PIN_11
  199. #define PATH_EN_3_5G_UL_GPIO_Port GPIOG
  200. #define PLL_ON_OFF_3_5G_LG12_Pin GPIO_PIN_12
  201. #define PLL_ON_OFF_3_5G_LG12_GPIO_Port GPIOG
  202. #define PLL_ON_OFF_3_5G_HG13_Pin GPIO_PIN_13
  203. #define PLL_ON_OFF_3_5G_HG13_GPIO_Port GPIOG
  204. #define BOOT_LED_Pin GPIO_PIN_14
  205. #define BOOT_LED_GPIO_Port GPIOG
  206. #define PLL_EN_2_1G_DL_Pin GPIO_PIN_3
  207. #define PLL_EN_2_1G_DL_GPIO_Port GPIOB
  208. #define PLL_EN_2_1G_UL_Pin GPIO_PIN_4
  209. #define PLL_EN_2_1G_UL_GPIO_Port GPIOB
  210. #define PLL_LD_2_1G_DL_Pin GPIO_PIN_5
  211. #define PLL_LD_2_1G_DL_GPIO_Port GPIOB
  212. #define PLL_LD_2_1G_UL_Pin GPIO_PIN_6
  213. #define PLL_LD_2_1G_UL_GPIO_Port GPIOB
  214. #define PATH_EN_2_1G_DL_Pin GPIO_PIN_0
  215. #define PATH_EN_2_1G_DL_GPIO_Port GPIOE
  216. #define PATH_EN_2_1G_UL_Pin GPIO_PIN_1
  217. #define PATH_EN_2_1G_UL_GPIO_Port GPIOE
  218. /* USER CODE BEGIN Private defines */
  219. #define BLUECELL_HEADER 0xBE
  220. #define BLUECELL_TAILER 0xEB
  221. //#define DEBUG_PRINT
  222. #define ADC_EA 14
  223. uint32_t ADCvalue[ADC_EA];
  224. /* USER CODE END Private defines */
  225. #ifdef __cplusplus
  226. }
  227. #endif
  228. #endif /* __MAIN_H */
  229. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/