gpio.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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) 2024 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_GPIOA_CLK_ENABLE();
  40. __HAL_RCC_GPIOC_CLK_ENABLE();
  41. /*Configure GPIO pin Output Level */
  42. HAL_GPIO_WritePin(GPIOA, RST_Pin|DC_Pin|CS_M_Pin|PWR_Pin, GPIO_PIN_RESET);
  43. /*Configure GPIO pin Output Level */
  44. HAL_GPIO_WritePin(CS_S_GPIO_Port, CS_S_Pin, GPIO_PIN_RESET);
  45. /*Configure GPIO pins : PAPin PAPin PAPin PAPin */
  46. GPIO_InitStruct.Pin = RST_Pin|DC_Pin|CS_M_Pin|PWR_Pin;
  47. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  48. GPIO_InitStruct.Pull = GPIO_NOPULL;
  49. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  50. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  51. /*Configure GPIO pin : PtPin */
  52. GPIO_InitStruct.Pin = BUSY_Pin;
  53. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  54. GPIO_InitStruct.Pull = GPIO_NOPULL;
  55. HAL_GPIO_Init(BUSY_GPIO_Port, &GPIO_InitStruct);
  56. /*Configure GPIO pin : PtPin */
  57. GPIO_InitStruct.Pin = CS_S_Pin;
  58. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  59. GPIO_InitStruct.Pull = GPIO_NOPULL;
  60. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  61. HAL_GPIO_Init(CS_S_GPIO_Port, &GPIO_InitStruct);
  62. }
  63. /* USER CODE BEGIN 2 */
  64. /* USER CODE END 2 */
  65. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/