gpio.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file gpio.c
  5. * @brief This file provides code for the configuration
  6. * of all used GPIO pins.
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * Copyright (c) 2024 STMicroelectronics.
  11. * All rights reserved.
  12. *
  13. * This software is licensed under terms that can be found in the LICENSE file
  14. * in the root directory of this software component.
  15. * If no LICENSE file comes with this software, it is provided AS-IS.
  16. *
  17. ******************************************************************************
  18. */
  19. /* USER CODE END Header */
  20. /* Includes ------------------------------------------------------------------*/
  21. #include "gpio.h"
  22. /* USER CODE BEGIN 0 */
  23. /* USER CODE END 0 */
  24. /*----------------------------------------------------------------------------*/
  25. /* Configure GPIO */
  26. /*----------------------------------------------------------------------------*/
  27. /* USER CODE BEGIN 1 */
  28. /* USER CODE END 1 */
  29. /** Configure pins
  30. PC14-OSC32_IN (OSC32_IN) ------> RCC_OSC32_IN
  31. PC15-OSC32_OUT (OSC32_OUT) ------> RCC_OSC32_OUT
  32. PH0-OSC_IN (PH0) ------> RCC_OSC_IN
  33. PH1-OSC_OUT (PH1) ------> RCC_OSC_OUT
  34. PA13 (JTMS/SWDIO) ------> DEBUG_JTMS-SWDIO
  35. PA14 (JTCK/SWCLK) ------> DEBUG_JTCK-SWCLK
  36. */
  37. void MX_GPIO_Init(void)
  38. {
  39. GPIO_InitTypeDef GPIO_InitStruct = {0};
  40. /* GPIO Ports Clock Enable */
  41. __HAL_RCC_GPIOE_CLK_ENABLE();
  42. __HAL_RCC_GPIOC_CLK_ENABLE();
  43. __HAL_RCC_GPIOH_CLK_ENABLE();
  44. __HAL_RCC_GPIOA_CLK_ENABLE();
  45. __HAL_RCC_GPIOB_CLK_ENABLE();
  46. __HAL_RCC_GPIOD_CLK_ENABLE();
  47. /*Configure GPIO pin Output Level */
  48. HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13|GPIO_PIN_1, GPIO_PIN_RESET);
  49. /*Configure GPIO pin Output Level */
  50. HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, GPIO_PIN_RESET);
  51. /*Configure GPIO pins : PC13 PC1 */
  52. GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_1;
  53. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  54. GPIO_InitStruct.Pull = GPIO_NOPULL;
  55. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  56. HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  57. /*Configure GPIO pin : PA3 */
  58. GPIO_InitStruct.Pin = GPIO_PIN_3;
  59. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  60. GPIO_InitStruct.Pull = GPIO_NOPULL;
  61. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  62. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  63. }
  64. /* USER CODE BEGIN 2 */
  65. /* USER CODE END 2 */