gpio.c 2.7 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) 2025 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 as
  30. * Analog
  31. * Input
  32. * Output
  33. * EVENT_OUT
  34. * EXTI
  35. * Free pins are configured automatically as Analog (this feature is enabled through
  36. * the Code Generation settings)
  37. */
  38. void MX_GPIO_Init(void)
  39. {
  40. GPIO_InitTypeDef GPIO_InitStruct = {0};
  41. /* GPIO Ports Clock Enable */
  42. __HAL_RCC_GPIOC_CLK_ENABLE();
  43. __HAL_RCC_GPIOD_CLK_ENABLE();
  44. __HAL_RCC_GPIOA_CLK_ENABLE();
  45. __HAL_RCC_GPIOB_CLK_ENABLE();
  46. /*Configure GPIO pins : PC13 PC14 PC15 */
  47. GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15;
  48. GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  49. HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  50. /*Configure GPIO pins : PA4 PA5 PA6 PA7
  51. PA8 PA9 PA10 PA15 */
  52. GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7
  53. |GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_15;
  54. GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  55. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  56. /*Configure GPIO pins : PB0 PB1 PB2 PB12
  57. PB13 PB14 PB15 PB3
  58. PB4 PB5 PB6 PB7
  59. PB8 PB9 */
  60. GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_12
  61. |GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15|GPIO_PIN_3
  62. |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7
  63. |GPIO_PIN_8|GPIO_PIN_9;
  64. GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  65. HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  66. }
  67. /* USER CODE BEGIN 2 */
  68. /* USER CODE END 2 */