Advertisement
Guest User

Untitled

a guest
Apr 7th, 2020
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.66 KB | None | 0 0
  1.  
  2. /**
  3.   * @brief GPIO Initialization Function
  4.   * @param None
  5.   * @retval None
  6.   */
  7. static void MX_GPIO_Init(void)
  8. {
  9.   GPIO_InitTypeDef GPIO_InitStruct = {0};
  10.  
  11.   /* GPIO Ports Clock Enable */
  12.   __HAL_RCC_GPIOC_CLK_ENABLE();
  13.   __HAL_RCC_GPIOH_CLK_ENABLE();
  14.   __HAL_RCC_GPIOB_CLK_ENABLE();
  15.   __HAL_RCC_GPIOD_CLK_ENABLE();
  16.   __HAL_RCC_GPIOG_CLK_ENABLE();
  17.   __HAL_RCC_GPIOA_CLK_ENABLE();
  18.  
  19.   /*Configure GPIO pin Output Level */
  20.   HAL_GPIO_WritePin(GPIOB, LD1_Pin|LD3_Pin|LD2_Pin, GPIO_PIN_RESET);
  21.  
  22.   /*Configure GPIO pin Output Level */
  23.   HAL_GPIO_WritePin(USB_PowerSwitchOn_GPIO_Port, USB_PowerSwitchOn_Pin, GPIO_PIN_RESET);
  24.  
  25.   /*Configure GPIO pin : USER_Btn_Pin */
  26.   GPIO_InitStruct.Pin = USER_Btn_Pin;
  27.   GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
  28.   GPIO_InitStruct.Pull = GPIO_NOPULL;
  29.   HAL_GPIO_Init(USER_Btn_GPIO_Port, &GPIO_InitStruct);
  30.  
  31.   /*Configure GPIO pins : LD1_Pin LD3_Pin LD2_Pin */
  32.   GPIO_InitStruct.Pin = LD1_Pin|LD3_Pin|LD2_Pin;
  33.   GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  34.   GPIO_InitStruct.Pull = GPIO_NOPULL;
  35.   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  36.   HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  37.  
  38.   /*Configure GPIO pin : USB_PowerSwitchOn_Pin */
  39.   GPIO_InitStruct.Pin = USB_PowerSwitchOn_Pin;
  40.   GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  41.   GPIO_InitStruct.Pull = GPIO_NOPULL;
  42.   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  43.   HAL_GPIO_Init(USB_PowerSwitchOn_GPIO_Port, &GPIO_InitStruct);
  44.  
  45.   /*Configure GPIO pin : USB_OverCurrent_Pin */
  46.   GPIO_InitStruct.Pin = USB_OverCurrent_Pin;
  47.   GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  48.   GPIO_InitStruct.Pull = GPIO_NOPULL;
  49.   HAL_GPIO_Init(USB_OverCurrent_GPIO_Port, &GPIO_InitStruct);
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement