gpio.c.bak 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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) 2022 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_GPIOF_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, ENC_RST_Pin|ENC_CS_Pin, GPIO_PIN_RESET);
  45. /*Configure GPIO pin : PF1 */
  46. GPIO_InitStruct.Pin = GPIO_PIN_1;
  47. GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
  48. GPIO_InitStruct.Pull = GPIO_NOPULL;
  49. HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
  50. /*Configure GPIO pins : PAPin PAPin */
  51. GPIO_InitStruct.Pin = ENC_RST_Pin|ENC_CS_Pin;
  52. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  53. GPIO_InitStruct.Pull = GPIO_NOPULL;
  54. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  55. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  56. /* EXTI interrupt init*/
  57. HAL_NVIC_SetPriority(EXTI0_1_IRQn, 0, 0);
  58. HAL_NVIC_EnableIRQ(EXTI0_1_IRQn);
  59. }
  60. /* USER CODE BEGIN 2 */
  61. /* USER CODE END 2 */