main(1970).c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file : main.c
  5. * @brief : Main program body
  6. ******************************************************************************
  7. ** This notice applies to any and all portions of this file
  8. * that are not between comment pairs USER CODE BEGIN and
  9. * USER CODE END. Other portions of this file, whether
  10. * inserted by the user or by software development tools
  11. * are owned by their respective copyright owners.
  12. *
  13. * COPYRIGHT(c) 2019 STMicroelectronics
  14. *
  15. * Redistribution and use in source and binary forms, with or without modification,
  16. * are permitted provided that the following conditions are met:
  17. * 1. Redistributions of source code must retain the above copyright notice,
  18. * this list of conditions and the following disclaimer.
  19. * 2. Redistributions in binary form must reproduce the above copyright notice,
  20. * this list of conditions and the following disclaimer in the documentation
  21. * and/or other materials provided with the distribution.
  22. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  23. * may be used to endorse or promote products derived from this software
  24. * without specific prior written permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  27. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  29. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  30. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  32. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  33. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  34. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  35. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  36. *
  37. ******************************************************************************
  38. */
  39. /* USER CODE END Header */
  40. /* Includes ------------------------------------------------------------------*/
  41. #include "main.h"
  42. /* Private includes ----------------------------------------------------------*/
  43. /* USER CODE BEGIN Includes */
  44. /* USER CODE END Includes */
  45. /* Private typedef -----------------------------------------------------------*/
  46. /* USER CODE BEGIN PTD */
  47. /* USER CODE END PTD */
  48. /* Private define ------------------------------------------------------------*/
  49. /* USER CODE BEGIN PD */
  50. /* USER CODE END PD */
  51. /* Private macro -------------------------------------------------------------*/
  52. /* USER CODE BEGIN PM */
  53. /* USER CODE END PM */
  54. /* Private variables ---------------------------------------------------------*/
  55. I2C_HandleTypeDef hi2c3;
  56. TIM_HandleTypeDef htim6;
  57. UART_HandleTypeDef huart1;
  58. UART_HandleTypeDef huart3;
  59. /* USER CODE BEGIN PV */
  60. /* USER CODE END PV */
  61. /* Private function prototypes -----------------------------------------------*/
  62. void SystemClock_Config(void);
  63. static void MX_GPIO_Init(void);
  64. static void MX_USART1_UART_Init(void);
  65. static void MX_TIM6_Init(void);
  66. static void MX_I2C3_Init(void);
  67. static void MX_USART3_UART_Init(void);
  68. static void MX_NVIC_Init(void);
  69. /* USER CODE BEGIN PFP */
  70. /* USER CODE END PFP */
  71. /* Private user code ---------------------------------------------------------*/
  72. /* USER CODE BEGIN 0 */
  73. #define buf_size 64
  74. uint8_t rx2_data[2];
  75. uint8_t ring_buf[buf_size];
  76. uint8_t count_in, count_out;
  77. uint8_t data_complete = 0;
  78. uint32_t Timer10ms;
  79. uint8_t buf[buf_size] = {0,};
  80. volatile uint32_t UartTimerCnt = 0;
  81. volatile uint32_t LedTimerCnt = 0;
  82. int _write (int file, uint8_t *ptr, uint16_t len)
  83. {
  84. HAL_UART_Transmit (&huart3, ptr, len, 10);
  85. return len;
  86. }
  87. void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
  88. {
  89. /* Prevent unused argument(s) compilation warning */
  90. if(htim->Instance == TIM6){
  91. UartTimerCnt++;
  92. LedTimerCnt++;
  93. // HAL_GPIO_TogglePin(GPIOF, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2);
  94. // HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
  95. // |GPIO_PIN_6|GPIO_PIN_7);
  96. #if 0 // PYJ.2019.02.20_BEGIN --
  97. if(UartTimerCnt % 1000== 1){
  98. HAL_GPIO_TogglePin(GPIOF, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2);
  99. HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
  100. |GPIO_PIN_6|GPIO_PIN_7);
  101. }
  102. #endif // PYJ.2019.02.20_END --
  103. // HAL_GPIO_TogglePin(LD2_GPIO_Port,GPIO_PIN_15);
  104. }
  105. /* NOTE : This function Should not be modified, when the callback is needed,
  106. the __HAL_TIM_PeriodElapsedCallback could be implemented in the user file
  107. */
  108. }
  109. uint8_t UartDataisReved;
  110. void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
  111. {
  112. if(huart->Instance == USART3){
  113. ring_buf[count_in] = rx2_data[0];//(uint8_t)USART2->DR;
  114. if(++count_in>=buf_size) count_in=0;
  115. HAL_UART_Receive_IT(&huart3,&rx2_data,1);
  116. }
  117. }
  118. void UartDataRecvSet(uint8_t val){
  119. data_complete = val;
  120. }
  121. uint8_t UartDataRecvGet(void){
  122. return data_complete;
  123. }
  124. #define ATTEN_0DB 0
  125. #define ATTEN_0_5DB 0.5
  126. #define ATTEN_1DB 1
  127. #define ATTEN_2DB 2
  128. #define ATTEN_4DB 4
  129. #define ATTEN_8DB 8
  130. #define ATTEN_16DB 16
  131. #define ATTEN_31_5DB 31.5
  132. /* USER CODE END 0 */
  133. /**
  134. * @brief The application entry point.
  135. * @retval int
  136. */
  137. int main(void)
  138. {
  139. /* USER CODE BEGIN 1 */
  140. //uint8_t writetemp[10] = {6,4,2,0,1,2,3,4,5,0xab};
  141. uint8_t tempdata[100] = {0,};
  142. Atten_Alarm_t Alarm_st;
  143. /* USER CODE END 1 */
  144. /* MCU Configuration--------------------------------------------------------*/
  145. /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  146. HAL_Init();
  147. /* USER CODE BEGIN Init */
  148. /* USER CODE END Init */
  149. /* Configure the system clock */
  150. SystemClock_Config();
  151. /* USER CODE BEGIN SysInit */
  152. /* USER CODE END SysInit */
  153. /* Initialize all configured peripherals */
  154. MX_GPIO_Init();
  155. MX_USART1_UART_Init();
  156. MX_TIM6_Init();
  157. MX_I2C3_Init();
  158. MX_USART3_UART_Init();
  159. /* Initialize interrupts */
  160. MX_NVIC_Init();
  161. /* USER CODE BEGIN 2 */
  162. HAL_TIM_Base_Start_IT(&htim6);
  163. // TCS34725_enable();
  164. HAL_UART_Receive_IT(&huart3, &rx2_data,1);
  165. setbuf(stdout, NULL); // \n ?��?��?��, printf �????��?���??? ?��?��?��
  166. /* USER CODE END 2 */
  167. /* Infinite loop */
  168. /* USER CODE BEGIN WHILE */
  169. //init_queue();
  170. // unsigned short temp_CrcData = 0;
  171. printf("****************************************\r\n");
  172. printf("TEST Project\r\n");
  173. printf("Build at %s %s\r\n", __DATE__, __TIME__);
  174. printf("Copyright (c) 2019. BLUECELL\r\n");
  175. printf("****************************************\r\n");
  176. //memcpy(&ATT_A_EN_150M_Table.Atten_Table_31_5dB_Value,writetemp,10);
  177. //EEPROM_IM24CM01P_write(EEPROM_ATT_A_EN_150M ,&ATT_A_EN_150M_Table.Atten_Table_31_5dB_Value ,sizeof(Atten_Table_Value_t));
  178. // EEPROM_IM24CM01P_Read(EEPROM_ATT_A_EN_150M ,&ATT_A_EN_150M_Table.Atten_Table_31_5dB_Value ,sizeof(Atten_Table_Value_t));
  179. EEPROM_IM24CM01P_Init();
  180. memcpy(tempdata,&ATT_A_EN_WIFI3_2_4Ghz_Table.Atten_Table_31_5dB_Value,sizeof(Atten_Table_Value_t));
  181. #if 1
  182. printf("HAL_I2C_Mem_Read : data : ");
  183. for(uint8_t i = 0; i < sizeof(Atten_Table_Value_t); i++){
  184. printf("%02x ",tempdata[i]);
  185. }
  186. printf("\r\n");
  187. memset(tempdata,0,sizeof(Atten_Table_Value_t));
  188. #endif
  189. // HAL_UART_Transmit(&huart1, buf, 1, 10);
  190. uint8_t uartindex = 0;
  191. etError crccheck = 0;
  192. while(1)
  193. {
  194. if(count_in != count_out){
  195. UartDataisReved = 1;
  196. UartTimerCnt = 0;
  197. buf[uartindex++] = ring_buf[count_out];
  198. if(++count_out >= buf_size) count_out=0;
  199. }
  200. if(UartDataisReved == 1 && UartTimerCnt > 10){
  201. #if 0
  202. for(uint8_t i = 0; i < (uartindex); i++){
  203. printf("%02x ",buf[i]);
  204. }
  205. printf("\r\n");
  206. #endif
  207. UartDataisReved =0;
  208. crccheck = STH30_CheckCrc(&buf[Bluecell_Type],buf[Bluecell_Length]+2,buf[3 + buf[Bluecell_Length]]);
  209. if(crccheck == CHECKSUM_ERROR){
  210. printf("CHECKSUM_ERROR RecvCRC : %02x , index %d\r\n",buf[3 + buf[Bluecell_Length]],3 + buf[Bluecell_Length]);
  211. }
  212. else if(crccheck == NO_ERROR){
  213. Atten_Operate_Mem_RW(&buf[Bluecell_STX]);
  214. // printf("NO_ERROR\r\n");
  215. }
  216. else{
  217. printf("What Happen?\r\n");
  218. /*NOP*/
  219. }
  220. memset(buf,0x00,buf_size);
  221. uartindex = 0;
  222. }
  223. else{
  224. //Alarm Timer
  225. if(LedTimerCnt > 500){
  226. Alarm_st = Atten_Alarm_Read();
  227. Alarm_Operate(Alarm_st);
  228. tempdata[Bluecell_STX] = 0xBE;
  229. tempdata[Bluecell_Type] = ATT_AB_ALARM_READ;
  230. tempdata[Bluecell_Length] = sizeof(Atten_Alarm_t) + 2;
  231. memcpy(&tempdata[Bluecell_DATA],&Alarm_st.Atten_Ach_Alarm_150M,sizeof(Atten_Alarm_t));
  232. tempdata[tempdata[Bluecell_Length] + 3] = STH30_CreateCrc(&tempdata[Bluecell_Type],tempdata[Bluecell_Length] + 2);
  233. tempdata[tempdata[Bluecell_Length] + 4] = 0xeb;
  234. Uart_Data_Send(&tempdata[Bluecell_STX],tempdata[Bluecell_Length]+5);
  235. HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_15);
  236. LedTimerCnt = 0;
  237. }
  238. }
  239. }
  240. HAL_Delay(1);
  241. /* USER CODE END WHILE */
  242. /* USER CODE BEGIN 3 */
  243. /* USER CODE END 3 */
  244. }
  245. /**
  246. * @brief System Clock Configuration
  247. * @retval None
  248. */
  249. void SystemClock_Config(void)
  250. {
  251. RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  252. RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
  253. /**Initializes the CPU, AHB and APB busses clocks
  254. */
  255. RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
  256. RCC_OscInitStruct.HSIState = RCC_HSI_ON;
  257. RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
  258. RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
  259. if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  260. {
  261. Error_Handler();
  262. }
  263. /**Initializes the CPU, AHB and APB busses clocks
  264. */
  265. RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
  266. |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
  267. RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
  268. RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  269. RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
  270. RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
  271. if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
  272. {
  273. Error_Handler();
  274. }
  275. }
  276. /**
  277. * @brief NVIC Configuration.
  278. * @retval None
  279. */
  280. static void MX_NVIC_Init(void)
  281. {
  282. /* USART1_IRQn interrupt configuration */
  283. HAL_NVIC_SetPriority(USART1_IRQn, 0, 0);
  284. HAL_NVIC_EnableIRQ(USART1_IRQn);
  285. /* TIM6_DAC_IRQn interrupt configuration */
  286. HAL_NVIC_SetPriority(TIM6_DAC_IRQn, 0, 0);
  287. HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn);
  288. /* USART3_IRQn interrupt configuration */
  289. HAL_NVIC_SetPriority(USART3_IRQn, 0, 0);
  290. HAL_NVIC_EnableIRQ(USART3_IRQn);
  291. }
  292. /**
  293. * @brief I2C3 Initialization Function
  294. * @param None
  295. * @retval None
  296. */
  297. static void MX_I2C3_Init(void)
  298. {
  299. /* USER CODE BEGIN I2C3_Init 0 */
  300. /* USER CODE END I2C3_Init 0 */
  301. /* USER CODE BEGIN I2C3_Init 1 */
  302. /* USER CODE END I2C3_Init 1 */
  303. hi2c3.Instance = I2C3;
  304. hi2c3.Init.ClockSpeed = 400000;
  305. hi2c3.Init.DutyCycle = I2C_DUTYCYCLE_2;
  306. hi2c3.Init.OwnAddress1 = 0;
  307. hi2c3.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
  308. hi2c3.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
  309. hi2c3.Init.OwnAddress2 = 0;
  310. hi2c3.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
  311. hi2c3.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
  312. if (HAL_I2C_Init(&hi2c3) != HAL_OK)
  313. {
  314. Error_Handler();
  315. }
  316. /* USER CODE BEGIN I2C3_Init 2 */
  317. /* USER CODE END I2C3_Init 2 */
  318. }
  319. /**
  320. * @brief TIM6 Initialization Function
  321. * @param None
  322. * @retval None
  323. */
  324. static void MX_TIM6_Init(void)
  325. {
  326. /* USER CODE BEGIN TIM6_Init 0 */
  327. /* USER CODE END TIM6_Init 0 */
  328. TIM_MasterConfigTypeDef sMasterConfig = {0};
  329. /* USER CODE BEGIN TIM6_Init 1 */
  330. /* USER CODE END TIM6_Init 1 */
  331. htim6.Instance = TIM6;
  332. htim6.Init.Prescaler = 999;
  333. htim6.Init.CounterMode = TIM_COUNTERMODE_UP;
  334. htim6.Init.Period = 15;
  335. htim6.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
  336. if (HAL_TIM_Base_Init(&htim6) != HAL_OK)
  337. {
  338. Error_Handler();
  339. }
  340. sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
  341. sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
  342. if (HAL_TIMEx_MasterConfigSynchronization(&htim6, &sMasterConfig) != HAL_OK)
  343. {
  344. Error_Handler();
  345. }
  346. /* USER CODE BEGIN TIM6_Init 2 */
  347. /* USER CODE END TIM6_Init 2 */
  348. }
  349. /**
  350. * @brief USART1 Initialization Function
  351. * @param None
  352. * @retval None
  353. */
  354. static void MX_USART1_UART_Init(void)
  355. {
  356. /* USER CODE BEGIN USART1_Init 0 */
  357. /* USER CODE END USART1_Init 0 */
  358. /* USER CODE BEGIN USART1_Init 1 */
  359. /* USER CODE END USART1_Init 1 */
  360. huart1.Instance = USART1;
  361. huart1.Init.BaudRate = 115200;
  362. huart1.Init.WordLength = UART_WORDLENGTH_8B;
  363. huart1.Init.StopBits = UART_STOPBITS_1;
  364. huart1.Init.Parity = UART_PARITY_NONE;
  365. huart1.Init.Mode = UART_MODE_TX_RX;
  366. huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
  367. huart1.Init.OverSampling = UART_OVERSAMPLING_16;
  368. if (HAL_UART_Init(&huart1) != HAL_OK)
  369. {
  370. Error_Handler();
  371. }
  372. /* USER CODE BEGIN USART1_Init 2 */
  373. /* USER CODE END USART1_Init 2 */
  374. }
  375. /**
  376. * @brief USART3 Initialization Function
  377. * @param None
  378. * @retval None
  379. */
  380. static void MX_USART3_UART_Init(void)
  381. {
  382. /* USER CODE BEGIN USART3_Init 0 */
  383. /* USER CODE END USART3_Init 0 */
  384. /* USER CODE BEGIN USART3_Init 1 */
  385. /* USER CODE END USART3_Init 1 */
  386. huart3.Instance = USART3;
  387. huart3.Init.BaudRate = 115200;
  388. huart3.Init.WordLength = UART_WORDLENGTH_8B;
  389. huart3.Init.StopBits = UART_STOPBITS_1;
  390. huart3.Init.Parity = UART_PARITY_NONE;
  391. huart3.Init.Mode = UART_MODE_TX_RX;
  392. huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
  393. huart3.Init.OverSampling = UART_OVERSAMPLING_16;
  394. if (HAL_UART_Init(&huart3) != HAL_OK)
  395. {
  396. Error_Handler();
  397. }
  398. /* USER CODE BEGIN USART3_Init 2 */
  399. /* USER CODE END USART3_Init 2 */
  400. }
  401. /**
  402. * @brief GPIO Initialization Function
  403. * @param None
  404. * @retval None
  405. */
  406. static void MX_GPIO_Init(void)
  407. {
  408. GPIO_InitTypeDef GPIO_InitStruct = {0};
  409. /* GPIO Ports Clock Enable */
  410. __HAL_RCC_GPIOE_CLK_ENABLE();
  411. __HAL_RCC_GPIOC_CLK_ENABLE();
  412. __HAL_RCC_GPIOF_CLK_ENABLE();
  413. __HAL_RCC_GPIOH_CLK_ENABLE();
  414. __HAL_RCC_GPIOA_CLK_ENABLE();
  415. __HAL_RCC_GPIOB_CLK_ENABLE();
  416. __HAL_RCC_GPIOG_CLK_ENABLE();
  417. __HAL_RCC_GPIOD_CLK_ENABLE();
  418. /*Configure GPIO pin Output Level */
  419. HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
  420. |GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
  421. |GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_0, GPIO_PIN_RESET);
  422. /*Configure GPIO pin Output Level */
  423. HAL_GPIO_WritePin(GPIOC, GPIO_PIN_14|GPIO_PIN_15|GPIO_PIN_4|GPIO_PIN_5
  424. |GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12, GPIO_PIN_RESET);
  425. /*Configure GPIO pin Output Level */
  426. HAL_GPIO_WritePin(GPIOF, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_11
  427. |GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15, GPIO_PIN_RESET);
  428. /*Configure GPIO pin Output Level */
  429. HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7
  430. |GPIO_PIN_11, GPIO_PIN_RESET);
  431. /*Configure GPIO pin Output Level */
  432. HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7
  433. |GPIO_PIN_9, GPIO_PIN_RESET);
  434. /*Configure GPIO pin Output Level */
  435. HAL_GPIO_WritePin(GPIOG, GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
  436. |GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_9|GPIO_PIN_11
  437. |GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14, GPIO_PIN_RESET);
  438. /*Configure GPIO pin Output Level */
  439. HAL_GPIO_WritePin(GPIOD, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
  440. |GPIO_PIN_6|GPIO_PIN_7, GPIO_PIN_RESET);
  441. /*Configure GPIO pins : PE2 PE3 PE4 PE5
  442. PE8 PE9 PE10 PE11
  443. PE12 PE13 PE14 PE0 */
  444. GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
  445. |GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
  446. |GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_0;
  447. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  448. GPIO_InitStruct.Pull = GPIO_NOPULL;
  449. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  450. HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
  451. /*Configure GPIO pins : PC14 PC15 PC4 PC5
  452. PC10 PC11 PC12 */
  453. GPIO_InitStruct.Pin = GPIO_PIN_14|GPIO_PIN_15|GPIO_PIN_4|GPIO_PIN_5
  454. |GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12;
  455. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  456. GPIO_InitStruct.Pull = GPIO_NOPULL;
  457. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  458. HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  459. /*Configure GPIO pins : PF0 PF1 PF2 PF11
  460. PF13 PF14 PF15 */
  461. GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_11
  462. |GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15;
  463. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  464. GPIO_InitStruct.Pull = GPIO_NOPULL;
  465. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  466. HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
  467. /*Configure GPIO pins : PF6 PF7 PF8 */
  468. GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8;
  469. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  470. GPIO_InitStruct.Pull = GPIO_NOPULL;
  471. HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
  472. /*Configure GPIO pins : PC1 PC2 PC3 */
  473. GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3;
  474. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  475. GPIO_InitStruct.Pull = GPIO_NOPULL;
  476. HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  477. /*Configure GPIO pins : PA4 PA5 PA6 PA7
  478. PA11 */
  479. GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7
  480. |GPIO_PIN_11;
  481. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  482. GPIO_InitStruct.Pull = GPIO_NOPULL;
  483. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  484. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  485. /*Configure GPIO pins : PB0 PB5 PB6 PB7
  486. PB9 */
  487. GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7
  488. |GPIO_PIN_9;
  489. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  490. GPIO_InitStruct.Pull = GPIO_NOPULL;
  491. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  492. HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  493. /*Configure GPIO pins : PG2 PG3 PG4 PG5
  494. PG6 PG7 PG9 PG11
  495. PG12 PG13 PG14 */
  496. GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
  497. |GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_9|GPIO_PIN_11
  498. |GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14;
  499. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  500. GPIO_InitStruct.Pull = GPIO_NOPULL;
  501. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  502. HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
  503. /*Configure GPIO pins : PD0 PD1 PD2 PD3
  504. PD6 PD7 */
  505. GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
  506. |GPIO_PIN_6|GPIO_PIN_7;
  507. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  508. GPIO_InitStruct.Pull = GPIO_NOPULL;
  509. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  510. HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
  511. }
  512. /* USER CODE BEGIN 4 */
  513. /* USER CODE END 4 */
  514. /**
  515. * @brief This function is executed in case of error occurrence.
  516. * @retval None
  517. */
  518. void Error_Handler(void)
  519. {
  520. /* USER CODE BEGIN Error_Handler_Debug */
  521. /* User can add his own implementation to report the HAL error return state */
  522. /* USER CODE END Error_Handler_Debug */
  523. }
  524. #ifdef USE_FULL_ASSERT
  525. /**
  526. * @brief Reports the name of the source file and the source line number
  527. * where the assert_param error has occurred.
  528. * @param file: pointer to the source file name
  529. * @param line: assert_param error line source number
  530. * @retval None
  531. */
  532. void assert_failed(uint8_t *file, uint32_t line)
  533. {
  534. /* USER CODE BEGIN 6 */
  535. /* User can add his own implementation to report the file name and line number,
  536. tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
  537. /* USER CODE END 6 */
  538. }
  539. #endif /* USE_FULL_ASSERT */
  540. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/