source: trunk/firmware/CubeMX/Src/gpio.c@ 3

Last change on this file since 3 was 1, checked in by f.jahn, 3 years ago
File size: 4.4 KB
Line 
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
21/* Includes ------------------------------------------------------------------*/
22#include "gpio.h"
23
24/* USER CODE BEGIN 0 */
25
26/* USER CODE END 0 */
27
28/*----------------------------------------------------------------------------*/
29/* Configure GPIO */
30/*----------------------------------------------------------------------------*/
31/* USER CODE BEGIN 1 */
32
33/* USER CODE END 1 */
34
35/** Configure pins as
36 * Analog
37 * Input
38 * Output
39 * EVENT_OUT
40 * EXTI
41*/
42void MX_GPIO_Init(void)
43{
44
45 GPIO_InitTypeDef GPIO_InitStruct = {0};
46
47 /* GPIO Ports Clock Enable */
48 __HAL_RCC_GPIOC_CLK_ENABLE();
49 __HAL_RCC_GPIOF_CLK_ENABLE();
50 __HAL_RCC_GPIOA_CLK_ENABLE();
51 __HAL_RCC_GPIOB_CLK_ENABLE();
52 __HAL_RCC_GPIOD_CLK_ENABLE();
53
54 /*Configure GPIO pin Output Level */
55 HAL_GPIO_WritePin(DISABLE_VBOOST_GPIO_Port, DISABLE_VBOOST_Pin, GPIO_PIN_SET);
56
57 /*Configure GPIO pin Output Level */
58 HAL_GPIO_WritePin(TP2_GPIO_Port, TP2_Pin, GPIO_PIN_RESET);
59
60 /*Configure GPIO pin Output Level */
61 HAL_GPIO_WritePin(GPIOB, LED_FUNCTION_Pin|LED_ERROR_Pin|LED_STATE_Pin|LED_SW_ERROR_Pin
62 |LED_SW_STATE_Pin, GPIO_PIN_RESET);
63
64 /*Configure GPIO pin Output Level */
65 HAL_GPIO_WritePin(OUT_CTRL_GPIO_Port, OUT_CTRL_Pin, GPIO_PIN_RESET);
66
67 /*Configure GPIO pins : PCPin PCPin */
68 GPIO_InitStruct.Pin = DISABLE_VBOOST_Pin|TP2_Pin;
69 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
70 GPIO_InitStruct.Pull = GPIO_NOPULL;
71 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
72 HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
73
74 /*Configure GPIO pin : PtPin */
75 GPIO_InitStruct.Pin = TP4_Pin;
76 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
77 GPIO_InitStruct.Pull = GPIO_NOPULL;
78 HAL_GPIO_Init(TP4_GPIO_Port, &GPIO_InitStruct);
79
80 /*Configure GPIO pins : PBPin PBPin PBPin PBPin
81 PBPin */
82 GPIO_InitStruct.Pin = LED_FUNCTION_Pin|LED_ERROR_Pin|LED_STATE_Pin|LED_SW_ERROR_Pin
83 |LED_SW_STATE_Pin;
84 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
85 GPIO_InitStruct.Pull = GPIO_NOPULL;
86 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
87 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
88
89 /*Configure GPIO pins : PBPin PBPin PBPin PBPin
90 PBPin PBPin PBPin PBPin */
91 GPIO_InitStruct.Pin = DIP2_Pin|DIP3_Pin|DIP4_Pin|DIP5_Pin
92 |DIP6_Pin|DIP7_Pin|DIP0_Pin|DIP1_Pin;
93 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
94 GPIO_InitStruct.Pull = GPIO_PULLUP;
95 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
96
97 /*Configure GPIO pins : PAPin PAPin */
98 GPIO_InitStruct.Pin = OUT_CS_Pin|R2_Pin;
99 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
100 GPIO_InitStruct.Pull = GPIO_NOPULL;
101 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
102
103 /*Configure GPIO pins : PCPin PCPin */
104 GPIO_InitStruct.Pin = OVP_IN_Pin|LVP_IN_Pin;
105 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
106 GPIO_InitStruct.Pull = GPIO_PULLUP;
107 HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
108
109 /*Configure GPIO pin : PtPin */
110 GPIO_InitStruct.Pin = BTN1_Pin;
111 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
112 GPIO_InitStruct.Pull = GPIO_PULLUP;
113 HAL_GPIO_Init(BTN1_GPIO_Port, &GPIO_InitStruct);
114
115 /*Configure GPIO pin : PtPin */
116 GPIO_InitStruct.Pin = OUT_CTRL_Pin;
117 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
118 GPIO_InitStruct.Pull = GPIO_NOPULL;
119 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
120 HAL_GPIO_Init(OUT_CTRL_GPIO_Port, &GPIO_InitStruct);
121
122 /*Configure GPIO pins : PDPin PDPin */
123 GPIO_InitStruct.Pin = SW_OFF_Pin|SW_ON_Pin;
124 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
125 GPIO_InitStruct.Pull = GPIO_PULLUP;
126 HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
127
128}
129
130/* USER CODE BEGIN 2 */
131
132/* USER CODE END 2 */
Note: See TracBrowser for help on using the repository browser.