gpio.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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) 2019 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under Ultimate Liberty license
  13. * SLA0044, the "License"; You may not use this file except in compliance with
  14. * the License. You may obtain a copy of the License at:
  15. * www.st.com/SLA0044
  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. PA9 ------> USB_OTG_FS_VBUS
  35. PA10 ------> USB_OTG_FS_ID
  36. PA11 ------> USB_OTG_FS_DM
  37. PA12 ------> USB_OTG_FS_DP
  38. */
  39. void MX_GPIO_Init(void)
  40. {
  41. GPIO_InitTypeDef GPIO_InitStruct = {0};
  42. /* GPIO Ports Clock Enable */
  43. __HAL_RCC_GPIOC_CLK_ENABLE();
  44. __HAL_RCC_GPIOH_CLK_ENABLE();
  45. __HAL_RCC_GPIOA_CLK_ENABLE();
  46. __HAL_RCC_GPIOB_CLK_ENABLE();
  47. __HAL_RCC_GPIOD_CLK_ENABLE();
  48. /*Configure GPIO pin Output Level */
  49. HAL_GPIO_WritePin(GPIOC, Relais1_Pin|wc_Pin|D1_Pin|D0_Pin
  50. |E_Pin|R_W_Pin|Peristatique_Pin|Osmolateur_Pin, GPIO_PIN_RESET);
  51. /*Configure GPIO pin Output Level */
  52. HAL_GPIO_WritePin(GPIOA, MFP_Pin|RS_Pin|Remonter_Pin, GPIO_PIN_RESET);
  53. /*Configure GPIO pin Output Level */
  54. HAL_GPIO_WritePin(GPIOB, D5_Pin|D4_Pin|D3_Pin|D2_Pin
  55. |Ecumeur_Pin|Relais2_Pin|D7_Pin|D6_Pin, GPIO_PIN_RESET);
  56. /*Configure GPIO pin Output Level */
  57. HAL_GPIO_WritePin(Chauffage_GPIO_Port, Chauffage_Pin, GPIO_PIN_RESET);
  58. /*Configure GPIO pins : PCPin PCPin PCPin PCPin
  59. PCPin PCPin PCPin PCPin */
  60. GPIO_InitStruct.Pin = Relais1_Pin|wc_Pin|D1_Pin|D0_Pin
  61. |E_Pin|R_W_Pin|Peristatique_Pin|Osmolateur_Pin;
  62. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  63. GPIO_InitStruct.Pull = GPIO_NOPULL;
  64. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  65. HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  66. /*Configure GPIO pin : PtPin */
  67. GPIO_InitStruct.Pin = Reserve_Haut_Pin;
  68. GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
  69. GPIO_InitStruct.Pull = GPIO_NOPULL;
  70. HAL_GPIO_Init(Reserve_Haut_GPIO_Port, &GPIO_InitStruct);
  71. /*Configure GPIO pins : PAPin PAPin */
  72. GPIO_InitStruct.Pin = Technique_Bas_Pin|Cuve_Haut_Pin;
  73. GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
  74. GPIO_InitStruct.Pull = GPIO_NOPULL;
  75. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  76. /*Configure GPIO pins : PAPin PAPin PAPin */
  77. GPIO_InitStruct.Pin = MFP_Pin|RS_Pin|Remonter_Pin;
  78. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  79. GPIO_InitStruct.Pull = GPIO_NOPULL;
  80. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  81. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  82. /*Configure GPIO pins : PCPin PCPin PCPin */
  83. GPIO_InitStruct.Pin = Left_Pin|UP_Pin|RAH_Pin;
  84. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  85. GPIO_InitStruct.Pull = GPIO_NOPULL;
  86. HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  87. /*Configure GPIO pins : PBPin PBPin */
  88. GPIO_InitStruct.Pin = Right_Pin|Select_Pin;
  89. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  90. GPIO_InitStruct.Pull = GPIO_NOPULL;
  91. HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  92. /*Configure GPIO pins : PBPin PBPin PBPin PBPin
  93. PBPin PBPin PBPin PBPin */
  94. GPIO_InitStruct.Pin = D5_Pin|D4_Pin|D3_Pin|D2_Pin
  95. |Ecumeur_Pin|Relais2_Pin|D7_Pin|D6_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. /*Configure GPIO pin : PA9 */
  101. GPIO_InitStruct.Pin = GPIO_PIN_9;
  102. GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  103. GPIO_InitStruct.Pull = GPIO_NOPULL;
  104. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  105. /*Configure GPIO pins : PA10 PA11 PA12 */
  106. GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12;
  107. GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  108. GPIO_InitStruct.Pull = GPIO_NOPULL;
  109. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  110. GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
  111. HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  112. /*Configure GPIO pin : PtPin */
  113. GPIO_InitStruct.Pin = Chauffage_Pin;
  114. GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  115. GPIO_InitStruct.Pull = GPIO_NOPULL;
  116. GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  117. HAL_GPIO_Init(Chauffage_GPIO_Port, &GPIO_InitStruct);
  118. /* EXTI interrupt init*/
  119. HAL_NVIC_SetPriority(EXTI1_IRQn, 5, 0);
  120. HAL_NVIC_EnableIRQ(EXTI1_IRQn);
  121. HAL_NVIC_SetPriority(EXTI2_IRQn, 5, 0);
  122. HAL_NVIC_EnableIRQ(EXTI2_IRQn);
  123. HAL_NVIC_SetPriority(EXTI15_10_IRQn, 5, 0);
  124. HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
  125. }
  126. /* USER CODE BEGIN 2 */
  127. /* USER CODE END 2 */
  128. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/