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>© Copyright (c) 2021 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 | |
---|
20 | /* Includes ------------------------------------------------------------------*/ |
---|
21 | #include "gpio.h" |
---|
22 | |
---|
23 | /* USER CODE BEGIN 0 */ |
---|
24 | |
---|
25 | /* USER CODE END 0 */ |
---|
26 | |
---|
27 | /*----------------------------------------------------------------------------*/ |
---|
28 | /* Configure GPIO */ |
---|
29 | /*----------------------------------------------------------------------------*/ |
---|
30 | /* USER CODE BEGIN 1 */ |
---|
31 | |
---|
32 | /* USER CODE END 1 */ |
---|
33 | |
---|
34 | /** Configure pins as |
---|
35 | * Analog |
---|
36 | * Input |
---|
37 | * Output |
---|
38 | * EVENT_OUT |
---|
39 | * EXTI |
---|
40 | * Free pins are configured automatically as Analog (this feature is enabled through |
---|
41 | * the Code Generation settings) |
---|
42 | */ |
---|
43 | void MX_GPIO_Init(void) |
---|
44 | { |
---|
45 | |
---|
46 | GPIO_InitTypeDef GPIO_InitStruct = {0}; |
---|
47 | |
---|
48 | /* GPIO Ports Clock Enable */ |
---|
49 | __HAL_RCC_GPIOC_CLK_ENABLE(); |
---|
50 | __HAL_RCC_GPIOF_CLK_ENABLE(); |
---|
51 | __HAL_RCC_GPIOA_CLK_ENABLE(); |
---|
52 | __HAL_RCC_GPIOB_CLK_ENABLE(); |
---|
53 | __HAL_RCC_GPIOD_CLK_ENABLE(); |
---|
54 | |
---|
55 | /*Configure GPIO pin Output Level */ |
---|
56 | HAL_GPIO_WritePin(GPIOD, LVP_Pin|OVP_Pin|LED_FUNC_Pin|LED_ERROR_Pin, GPIO_PIN_RESET); |
---|
57 | |
---|
58 | /*Configure GPIO pins : PC13 PC14 PC15 PC6 |
---|
59 | PC7 */ |
---|
60 | GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15|GPIO_PIN_6 |
---|
61 | |GPIO_PIN_7; |
---|
62 | GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; |
---|
63 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
---|
64 | HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); |
---|
65 | |
---|
66 | /*Configure GPIO pin : PF2 */ |
---|
67 | GPIO_InitStruct.Pin = GPIO_PIN_2; |
---|
68 | GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; |
---|
69 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
---|
70 | HAL_GPIO_Init(GPIOF, &GPIO_InitStruct); |
---|
71 | |
---|
72 | /*Configure GPIO pins : PA0 PA15 */ |
---|
73 | GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_15; |
---|
74 | GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; |
---|
75 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
---|
76 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
---|
77 | |
---|
78 | /*Configure GPIO pins : PB1 PB2 PB10 PB11 |
---|
79 | PB12 PB13 PB14 PB15 |
---|
80 | PB4 PB6 PB7 |
---|
81 | PB8 PB9 */ |
---|
82 | GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_10|GPIO_PIN_11 |
---|
83 | |GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15 |
---|
84 | |GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_6|GPIO_PIN_7 |
---|
85 | |GPIO_PIN_8|GPIO_PIN_9; |
---|
86 | GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; |
---|
87 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
---|
88 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
---|
89 | |
---|
90 | /*Configure GPIO pins : PB3 */ |
---|
91 | GPIO_InitStruct.Pin = GPIO_PIN_3; |
---|
92 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT; |
---|
93 | GPIO_InitStruct.Pull = GPIO_PULLUP; |
---|
94 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
---|
95 | |
---|
96 | /*Configure GPIO pins : PDPin PDPin PDPin PDPin */ |
---|
97 | GPIO_InitStruct.Pin = LVP_Pin|OVP_Pin|LED_FUNC_Pin|LED_ERROR_Pin; |
---|
98 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
---|
99 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
---|
100 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
---|
101 | HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); |
---|
102 | |
---|
103 | HAL_GPIO_WritePin(GPIOC, BUZZER_Pin, GPIO_PIN_RESET); |
---|
104 | GPIO_InitStruct.Pin = BUZZER_Pin; |
---|
105 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
---|
106 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
---|
107 | HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); |
---|
108 | } |
---|
109 | |
---|
110 | /* USER CODE BEGIN 2 */ |
---|
111 | |
---|
112 | /* USER CODE END 2 */ |
---|
113 | |
---|
114 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
---|