source: trunk/fw_g473rct/Core/Src/gpio.c

Last change on this file was 20, checked in by f.jahn, 5 days ago

adc dma funktioniert und modbus funktioniert

File size: 3.6 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) 2025 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(GPIOC, AUX_ENABLE_Pin|ADC_START_CONV_Pin|ADC_RESET_Pin, GPIO_PIN_RESET);
56
57  /*Configure GPIO pin Output Level */
58  HAL_GPIO_WritePin(GPIOA, LED_FUNC_Pin|LED_ERROR_Pin, GPIO_PIN_RESET);
59
60  /*Configure GPIO pin Output Level */
61  HAL_GPIO_WritePin(GPIOB, BUZZER_Pin|DISCHARGE_ENABLE_Pin|CHARGE_ENABLE_Pin, GPIO_PIN_RESET);
62
63  /*Configure GPIO pins : AUX_ENABLE_Pin ADC_START_CONV_Pin ADC_RESET_Pin */
64  GPIO_InitStruct.Pin = AUX_ENABLE_Pin|ADC_START_CONV_Pin|ADC_RESET_Pin;
65  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
66  GPIO_InitStruct.Pull = GPIO_NOPULL;
67  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
68  HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
69
70  /*Configure GPIO pins : LED_FUNC_Pin LED_ERROR_Pin */
71  GPIO_InitStruct.Pin = LED_FUNC_Pin|LED_ERROR_Pin;
72  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
73  GPIO_InitStruct.Pull = GPIO_NOPULL;
74  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
75  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
76
77  /*Configure GPIO pins : BUZZER_Pin DISCHARGE_ENABLE_Pin CHARGE_ENABLE_Pin */
78  GPIO_InitStruct.Pin = BUZZER_Pin|DISCHARGE_ENABLE_Pin|CHARGE_ENABLE_Pin;
79  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
80  GPIO_InitStruct.Pull = GPIO_NOPULL;
81  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
82  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
83
84  /*Configure GPIO pin : GPIO_INPUT_BTN_MODE_Pin */
85  GPIO_InitStruct.Pin = GPIO_INPUT_BTN_MODE_Pin;
86  GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
87  GPIO_InitStruct.Pull = GPIO_PULLUP;
88  HAL_GPIO_Init(GPIO_INPUT_BTN_MODE_GPIO_Port, &GPIO_InitStruct);
89
90  /*Configure GPIO pin : ADC_DATA_READY_Pin */
91  GPIO_InitStruct.Pin = ADC_DATA_READY_Pin;
92  GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
93  GPIO_InitStruct.Pull = GPIO_NOPULL;
94  HAL_GPIO_Init(ADC_DATA_READY_GPIO_Port, &GPIO_InitStruct);
95
96  /*Configure GPIO pins : FAULT_Pin COM_POWERPRO_RES_Pin */
97  GPIO_InitStruct.Pin = FAULT_Pin|COM_POWERPRO_RES_Pin;
98  GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
99  GPIO_InitStruct.Pull = GPIO_NOPULL;
100  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
101
102}
103
104/* USER CODE BEGIN 2 */
105
106/* USER CODE END 2 */
Note: See TracBrowser for help on using the repository browser.