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.

101 lines
3.3 KiB

3 years ago
  1. /**
  2. ******************************************************************************
  3. * @file gpio.c
  4. * @brief This file provides code for the configuration
  5. * of all used GPIO pins.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2022 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Includes ------------------------------------------------------------------*/
  20. #include "gpio.h"
  21. /* USER CODE BEGIN 0 */
  22. /* USER CODE END 0 */
  23. /*----------------------------------------------------------------------------*/
  24. /* Configure GPIO */
  25. /*----------------------------------------------------------------------------*/
  26. /* USER CODE BEGIN 1 */
  27. /* USER CODE END 1 */
  28. /** Configure pins as
  29. * Analog
  30. * Input
  31. * Output
  32. * EVENT_OUT
  33. * EXTI
  34. * Free pins are configured automatically as Analog (this feature is enabled through
  35. * the Code Generation settings)
  36. */
  37. void MX_GPIO_Init(void)
  38. {
  39. GPIO_InitTypeDef GPIO_InitStruct = {0};
  40. /* GPIO Ports Clock Enable */
  41. __HAL_RCC_GPIOC_CLK_ENABLE();
  42. __HAL_RCC_GPIOD_CLK_ENABLE();
  43. __HAL_RCC_GPIOA_CLK_ENABLE();
  44. __HAL_RCC_GPIOB_CLK_ENABLE();
  45. /*Configure GPIO pin Output Level */
  46. HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0, GPIO_PIN_RESET);
  47. /*Configure GPIO pins : PC13 PC14 PC15 */
  48. GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15;
  49. GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  50. HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  51. /*Configure GPIO pins : PD0 PD1 */
  52. GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1;
  53. GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  54. HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
  55. /*Configure GPIO pin : PA0 */
  56. GPIO_InitStruct.Pin = GPIO_PIN_0;
  57. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  58. GPIO_InitStruct.Pull = GPIO_NOPULL;
  59. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  60. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  61. /*Configure GPIO pins : PA4 PA5 PA6 PA7
  62. PA12 PA15 */
  63. GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7
  64. |GPIO_PIN_12|GPIO_PIN_15;
  65. GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  66. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  67. /*Configure GPIO pins : PB0 PB1 PB2 PB10
  68. PB11 PB12 PB13 PB14
  69. PB15 PB3 PB4 PB5
  70. PB8 PB9 */
  71. GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_10
  72. |GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14
  73. |GPIO_PIN_15|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
  74. |GPIO_PIN_8|GPIO_PIN_9;
  75. GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  76. HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  77. /*Configure peripheral I/O remapping */
  78. __HAL_AFIO_REMAP_PD01_ENABLE();
  79. }
  80. /* USER CODE BEGIN 2 */
  81. /* USER CODE END 2 */
  82. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/