gpio.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /**
  2. ******************************************************************************
  3. * File Name : gpio.c
  4. * Description : 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_GPIOF_CLK_ENABLE();
  40. __HAL_RCC_GPIOA_CLK_ENABLE();
  41. __HAL_RCC_GPIOB_CLK_ENABLE();
  42. __HAL_RCC_GPIOC_CLK_ENABLE();
  43. /*Configure GPIO pin Output Level */
  44. HAL_GPIO_WritePin(CAN_Sleep_GPIO_Port, CAN_Sleep_Pin, GPIO_PIN_RESET);
  45. HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1, GPIO_PIN_SET);
  46. /*Configure GPIO pin : PtPin */
  47. GPIO_InitStruct.Pin = CAN_Sleep_Pin;
  48. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  49. GPIO_InitStruct.Pull = GPIO_NOPULL;
  50. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  51. HAL_GPIO_Init(CAN_Sleep_GPIO_Port, &GPIO_InitStruct);
  52. GPIO_InitStruct.Pin = GPIO_PIN_1;
  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(GPIOC, &GPIO_InitStruct);
  57. }
  58. /* USER CODE BEGIN 2 */
  59. /* USER CODE END 2 */
  60. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/