You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
3.0 KiB

  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 as
  30. * Analog
  31. * Input
  32. * Output
  33. * EVENT_OUT
  34. * EXTI
  35. */
  36. void MX_GPIO_Init(void)
  37. {
  38. GPIO_InitTypeDef GPIO_InitStruct = {0};
  39. /* GPIO Ports Clock Enable */
  40. __HAL_RCC_GPIOE_CLK_ENABLE();
  41. __HAL_RCC_GPIOC_CLK_ENABLE();
  42. __HAL_RCC_GPIOH_CLK_ENABLE();
  43. __HAL_RCC_GPIOA_CLK_ENABLE();
  44. __HAL_RCC_GPIOB_CLK_ENABLE();
  45. __HAL_RCC_GPIOD_CLK_ENABLE();
  46. /*Configure GPIO pin Output Level */
  47. HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, GPIO_PIN_RESET);
  48. /*Configure GPIO pin Output Level */
  49. HAL_GPIO_WritePin(GPIOD, GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15, GPIO_PIN_RESET);
  50. /*Configure GPIO pin : PE2 */
  51. GPIO_InitStruct.Pin = GPIO_PIN_2;
  52. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  53. GPIO_InitStruct.Pull = GPIO_NOPULL;
  54. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  55. HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
  56. /*Configure GPIO pins : PE3 PE6 PE0 PE1 */
  57. GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_6|GPIO_PIN_0|GPIO_PIN_1;
  58. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  59. GPIO_InitStruct.Pull = GPIO_NOPULL;
  60. HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
  61. /*Configure GPIO pins : PD13 PD14 PD15 */
  62. GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15;
  63. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  64. GPIO_InitStruct.Pull = GPIO_NOPULL;
  65. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  66. HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
  67. /*Configure GPIO pins : PD0 PD1 PD2 PD3
  68. PD4 */
  69. GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
  70. |GPIO_PIN_4;
  71. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  72. GPIO_InitStruct.Pull = GPIO_NOPULL;
  73. HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
  74. /*Configure GPIO pins : PB5 PB8 */
  75. GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_8;
  76. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  77. GPIO_InitStruct.Pull = GPIO_NOPULL;
  78. HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  79. }
  80. /* USER CODE BEGIN 2 */
  81. /* USER CODE END 2 */