gpio.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 Ultimate Liberty license
  13. * SLA0044, the "License"; You may not use this file except in compliance with
  14. * the License. You may obtain a copy of the License at:
  15. * www.st.com/SLA0044
  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_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(WC_GPIO_Port, WC_Pin, GPIO_PIN_RESET);
  48. /*Configure GPIO pin Output Level */
  49. HAL_GPIO_WritePin(aquit_GPIO_Port, aquit_Pin, GPIO_PIN_RESET);
  50. /*Configure GPIO pin Output Level */
  51. HAL_GPIO_WritePin(GPIOB, MFP_Pin|LED_rouge_Pin|LED_vert_Pin|LED_Orange_Pin, GPIO_PIN_RESET);
  52. /*Configure GPIO pins : PC13 PC15 PC0 PC1
  53. PC2 PC3 PC4 PC5
  54. PC8 PC10 PC11 PC12 */
  55. GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1
  56. |GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
  57. |GPIO_PIN_8|GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12;
  58. GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  59. GPIO_InitStruct.Pull = GPIO_NOPULL;
  60. HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  61. /*Configure GPIO pin : PtPin */
  62. GPIO_InitStruct.Pin = WC_Pin;
  63. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  64. GPIO_InitStruct.Pull = GPIO_NOPULL;
  65. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  66. HAL_GPIO_Init(WC_GPIO_Port, &GPIO_InitStruct);
  67. /*Configure GPIO pin : PtPin */
  68. GPIO_InitStruct.Pin = aquit_Pin;
  69. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  70. GPIO_InitStruct.Pull = GPIO_NOPULL;
  71. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  72. HAL_GPIO_Init(aquit_GPIO_Port, &GPIO_InitStruct);
  73. /*Configure GPIO pins : PA5 PA9 PA10 PA11
  74. PA12 PA15 */
  75. GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
  76. |GPIO_PIN_12|GPIO_PIN_15;
  77. GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  78. GPIO_InitStruct.Pull = GPIO_NOPULL;
  79. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  80. /*Configure GPIO pins : PBPin PBPin PBPin PBPin */
  81. GPIO_InitStruct.Pin = MFP_Pin|LED_rouge_Pin|LED_vert_Pin|LED_Orange_Pin;
  82. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  83. GPIO_InitStruct.Pull = GPIO_NOPULL;
  84. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  85. HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  86. /*Configure GPIO pins : PB15 PB4 PB5 */
  87. GPIO_InitStruct.Pin = GPIO_PIN_15|GPIO_PIN_4|GPIO_PIN_5;
  88. GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  89. GPIO_InitStruct.Pull = GPIO_NOPULL;
  90. HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  91. /*Configure GPIO pin : PD2 */
  92. GPIO_InitStruct.Pin = GPIO_PIN_2;
  93. GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  94. GPIO_InitStruct.Pull = GPIO_NOPULL;
  95. HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
  96. }
  97. /* USER CODE BEGIN 2 */
  98. /* USER CODE END 2 */
  99. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/