| [1] | 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 | */
|
|---|
| 42 | void 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;
|
|---|
| [7] | 76 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|---|
| [1] | 77 | GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|---|
| [7] | 78 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|---|
| [1] | 79 | HAL_GPIO_Init(TP4_GPIO_Port, &GPIO_InitStruct);
|
|---|
| 80 |
|
|---|
| 81 | /*Configure GPIO pins : PBPin PBPin PBPin PBPin
|
|---|
| 82 | PBPin */
|
|---|
| 83 | GPIO_InitStruct.Pin = LED_FUNCTION_Pin|LED_ERROR_Pin|LED_STATE_Pin|LED_SW_ERROR_Pin
|
|---|
| 84 | |LED_SW_STATE_Pin;
|
|---|
| 85 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|---|
| 86 | GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|---|
| 87 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|---|
| 88 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|---|
| 89 |
|
|---|
| 90 | /*Configure GPIO pins : PBPin PBPin PBPin PBPin
|
|---|
| 91 | PBPin PBPin PBPin PBPin */
|
|---|
| 92 | GPIO_InitStruct.Pin = DIP2_Pin|DIP3_Pin|DIP4_Pin|DIP5_Pin
|
|---|
| 93 | |DIP6_Pin|DIP7_Pin|DIP0_Pin|DIP1_Pin;
|
|---|
| 94 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|---|
| 95 | GPIO_InitStruct.Pull = GPIO_PULLUP;
|
|---|
| 96 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|---|
| 97 |
|
|---|
| 98 | /*Configure GPIO pins : PAPin PAPin */
|
|---|
| 99 | GPIO_InitStruct.Pin = OUT_CS_Pin|R2_Pin;
|
|---|
| 100 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|---|
| 101 | GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|---|
| 102 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|---|
| 103 |
|
|---|
| 104 | /*Configure GPIO pins : PCPin PCPin */
|
|---|
| 105 | GPIO_InitStruct.Pin = OVP_IN_Pin|LVP_IN_Pin;
|
|---|
| 106 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|---|
| 107 | GPIO_InitStruct.Pull = GPIO_PULLUP;
|
|---|
| 108 | HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
|---|
| 109 |
|
|---|
| 110 | /*Configure GPIO pin : PtPin */
|
|---|
| 111 | GPIO_InitStruct.Pin = BTN1_Pin;
|
|---|
| 112 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|---|
| 113 | GPIO_InitStruct.Pull = GPIO_PULLUP;
|
|---|
| 114 | HAL_GPIO_Init(BTN1_GPIO_Port, &GPIO_InitStruct);
|
|---|
| 115 |
|
|---|
| 116 | /*Configure GPIO pin : PtPin */
|
|---|
| 117 | GPIO_InitStruct.Pin = OUT_CTRL_Pin;
|
|---|
| 118 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|---|
| 119 | GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|---|
| 120 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|---|
| 121 | HAL_GPIO_Init(OUT_CTRL_GPIO_Port, &GPIO_InitStruct);
|
|---|
| 122 |
|
|---|
| 123 | /*Configure GPIO pins : PDPin PDPin */
|
|---|
| 124 | GPIO_InitStruct.Pin = SW_OFF_Pin|SW_ON_Pin;
|
|---|
| 125 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
|---|
| 126 | GPIO_InitStruct.Pull = GPIO_PULLUP;
|
|---|
| 127 | HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
|---|
| 128 |
|
|---|
| 129 | }
|
|---|
| 130 |
|
|---|
| 131 | /* USER CODE BEGIN 2 */
|
|---|
| 132 |
|
|---|
| 133 | /* USER CODE END 2 */
|
|---|