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.

117 lines
3.7 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  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) 2023 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_GPIOH_CLK_ENABLE();
  42. __HAL_RCC_GPIOC_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(DEBUG_LIGHT_GPIO_Port, DEBUG_LIGHT_Pin, GPIO_PIN_RESET);
  48. /*Configure GPIO pin Output Level */
  49. HAL_GPIO_WritePin(GPIOA, DIS_R1_Pin|DIS_G1_Pin|DIS_B1_Pin, GPIO_PIN_RESET);
  50. /*Configure GPIO pin Output Level */
  51. HAL_GPIO_WritePin(GPIOB, DIS_R2_Pin|DIS_G2_Pin|DIS_B2_Pin, GPIO_PIN_RESET);
  52. /*Configure GPIO pin Output Level */
  53. HAL_GPIO_WritePin(ETH_RST_GPIO_Port, ETH_RST_Pin, GPIO_PIN_RESET);
  54. /*Configure GPIO pin : PtPin */
  55. GPIO_InitStruct.Pin = DEBUG_LIGHT_Pin;
  56. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  57. GPIO_InitStruct.Pull = GPIO_PULLUP;
  58. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  59. HAL_GPIO_Init(DEBUG_LIGHT_GPIO_Port, &GPIO_InitStruct);
  60. /*Configure GPIO pins : PAPin PAPin PAPin */
  61. GPIO_InitStruct.Pin = DIS_R1_Pin|DIS_G1_Pin|DIS_B1_Pin;
  62. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  63. GPIO_InitStruct.Pull = GPIO_NOPULL;
  64. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  65. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  66. /*Configure GPIO pin : PtPin */
  67. GPIO_InitStruct.Pin = KEY1_Pin;
  68. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  69. GPIO_InitStruct.Pull = GPIO_PULLUP;
  70. HAL_GPIO_Init(KEY1_GPIO_Port, &GPIO_InitStruct);
  71. /*Configure GPIO pins : PBPin PBPin PBPin */
  72. GPIO_InitStruct.Pin = DIS_R2_Pin|DIS_G2_Pin|DIS_B2_Pin;
  73. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  74. GPIO_InitStruct.Pull = GPIO_NOPULL;
  75. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  76. HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  77. /*Configure GPIO pin : PtPin */
  78. GPIO_InitStruct.Pin = GENLOCK_Pin;
  79. GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
  80. GPIO_InitStruct.Pull = GPIO_NOPULL;
  81. HAL_GPIO_Init(GENLOCK_GPIO_Port, &GPIO_InitStruct);
  82. /*Configure GPIO pin : PtPin */
  83. GPIO_InitStruct.Pin = KEY0_Pin;
  84. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  85. GPIO_InitStruct.Pull = GPIO_PULLUP;
  86. HAL_GPIO_Init(KEY0_GPIO_Port, &GPIO_InitStruct);
  87. /*Configure GPIO pin : PtPin */
  88. GPIO_InitStruct.Pin = ETH_RST_Pin;
  89. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  90. GPIO_InitStruct.Pull = GPIO_NOPULL;
  91. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  92. HAL_GPIO_Init(ETH_RST_GPIO_Port, &GPIO_InitStruct);
  93. }
  94. /* USER CODE BEGIN 2 */
  95. /* USER CODE END 2 */