gpio.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /**
  2. ******************************************************************************
  3. * File Name : gpio.c
  4. * Description : This file provides code for the configuration
  5. * of all used GPIO pins.
  6. ******************************************************************************
  7. *
  8. * Copyright (c) 2017 STMicroelectronics International N.V.
  9. * All rights reserved.
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted, provided that the following conditions are met:
  13. *
  14. * 1. Redistribution of source code must retain the above copyright notice,
  15. * this list of conditions and the following disclaimer.
  16. * 2. Redistributions in binary form must reproduce the above copyright notice,
  17. * this list of conditions and the following disclaimer in the documentation
  18. * and/or other materials provided with the distribution.
  19. * 3. Neither the name of STMicroelectronics nor the names of other
  20. * contributors to this software may be used to endorse or promote products
  21. * derived from this software without specific written permission.
  22. * 4. This software, including modifications and/or derivative works of this
  23. * software, must execute solely and exclusively on microcontroller or
  24. * microprocessor devices manufactured by or for STMicroelectronics.
  25. * 5. Redistribution and use of this software other than as permitted under
  26. * this license is void and will automatically terminate your rights under
  27. * this license.
  28. *
  29. * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
  30. * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
  31. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  32. * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
  33. * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
  34. * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  35. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  36. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  37. * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  38. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  39. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  40. * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  41. *
  42. ******************************************************************************
  43. */
  44. /* Includes ------------------------------------------------------------------*/
  45. #include "gpio.h"
  46. /* USER CODE BEGIN 0 */
  47. /* USER CODE END 0 */
  48. /*----------------------------------------------------------------------------*/
  49. /* Configure GPIO */
  50. /*----------------------------------------------------------------------------*/
  51. /* USER CODE BEGIN 1 */
  52. /* USER CODE END 1 */
  53. /** Configure pins as
  54. * Analog
  55. * Input
  56. * Output
  57. * EVENT_OUT
  58. * EXTI
  59. */
  60. void MX_GPIO_Init(void)
  61. {
  62. GPIO_InitTypeDef GPIO_InitStruct;
  63. /* GPIO Ports Clock Enable */
  64. __HAL_RCC_GPIOC_CLK_ENABLE();
  65. __HAL_RCC_GPIOF_CLK_ENABLE();
  66. __HAL_RCC_GPIOA_CLK_ENABLE();
  67. __HAL_RCC_GPIOB_CLK_ENABLE();
  68. /*Configure GPIO pin Output Level */
  69. HAL_GPIO_WritePin(GPIOC, S8_Pin|S9_Pin|S10_Pin, GPIO_PIN_RESET);
  70. /*Configure GPIO pin Output Level */
  71. HAL_GPIO_WritePin(GPIOF, S11_Pin|S12_Pin, GPIO_PIN_RESET);
  72. /*Configure GPIO pin Output Level */
  73. HAL_GPIO_WritePin(GPIOB, S1_Pin|S2_Pin|S3_Pin|S4_Pin
  74. |S5_Pin|S6_Pin|S7_Pin, GPIO_PIN_RESET);
  75. /*Configure GPIO pins : PCPin PCPin PCPin */
  76. GPIO_InitStruct.Pin = S8_Pin|S9_Pin|S10_Pin;
  77. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  78. GPIO_InitStruct.Pull = GPIO_NOPULL;
  79. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  80. HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  81. /*Configure GPIO pins : PFPin PFPin */
  82. GPIO_InitStruct.Pin = S11_Pin|S12_Pin;
  83. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  84. GPIO_InitStruct.Pull = GPIO_NOPULL;
  85. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  86. HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
  87. /*Configure GPIO pins : PAPin PAPin */
  88. GPIO_InitStruct.Pin = mfp_Pin|WC_Pin;
  89. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  90. GPIO_InitStruct.Pull = GPIO_NOPULL;
  91. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  92. /*Configure GPIO pins : PBPin PBPin PBPin PBPin
  93. PBPin PBPin PBPin */
  94. GPIO_InitStruct.Pin = S1_Pin|S2_Pin|S3_Pin|S4_Pin
  95. |S5_Pin|S6_Pin|S7_Pin;
  96. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  97. GPIO_InitStruct.Pull = GPIO_NOPULL;
  98. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  99. HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  100. }
  101. /* USER CODE BEGIN 2 */
  102. /* USER CODE END 2 */
  103. /**
  104. * @}
  105. */
  106. /**
  107. * @}
  108. */
  109. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/