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.

95 lines
3.1 KiB

4 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. */
  35. void MX_GPIO_Init(void)
  36. {
  37. GPIO_InitTypeDef GPIO_InitStruct = {0};
  38. /* GPIO Ports Clock Enable */
  39. __HAL_RCC_GPIOC_CLK_ENABLE();
  40. __HAL_RCC_GPIOD_CLK_ENABLE();
  41. __HAL_RCC_GPIOA_CLK_ENABLE();
  42. __HAL_RCC_GPIOB_CLK_ENABLE();
  43. /*Configure GPIO pin Output Level */
  44. HAL_GPIO_WritePin(GPIOA, DBG_LED_Pin|FAN_ON_Pin, GPIO_PIN_RESET);
  45. /*Configure GPIO pin Output Level */
  46. HAL_GPIO_WritePin(GPIOA, LED0_Pin|LED1_Pin|LED2_Pin|LED3_Pin, GPIO_PIN_SET);
  47. /*Configure GPIO pin Output Level */
  48. HAL_GPIO_WritePin(GPIOB, LED_R_Pin|LED_G_Pin|LED_B_Pin, GPIO_PIN_RESET);
  49. /*Configure GPIO pins : PAPin PAPin PAPin PAPin
  50. PAPin PAPin */
  51. GPIO_InitStruct.Pin = DBG_LED_Pin|FAN_ON_Pin|LED0_Pin|LED1_Pin
  52. |LED2_Pin|LED3_Pin;
  53. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  54. GPIO_InitStruct.Pull = GPIO_NOPULL;
  55. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  56. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  57. /*Configure GPIO pins : PBPin PBPin PBPin */
  58. GPIO_InitStruct.Pin = LED_R_Pin|LED_G_Pin|LED_B_Pin;
  59. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  60. GPIO_InitStruct.Pull = GPIO_NOPULL;
  61. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
  62. HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  63. /*Configure GPIO pins : PBPin PBPin */
  64. GPIO_InitStruct.Pin = KEY1_Pin|KEY2_Pin;
  65. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  66. GPIO_InitStruct.Pull = GPIO_PULLUP;
  67. HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  68. /*Configure GPIO pin : PtPin */
  69. GPIO_InitStruct.Pin = KEY3_Pin;
  70. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  71. GPIO_InitStruct.Pull = GPIO_NOPULL;
  72. HAL_GPIO_Init(KEY3_GPIO_Port, &GPIO_InitStruct);
  73. }
  74. /* USER CODE BEGIN 2 */
  75. /* USER CODE END 2 */
  76. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/