Yuliya Smirnova / ADE7912

Dependents:   h7adc

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers gpio.cpp Source File

gpio.cpp

00001 /**
00002   ******************************************************************************
00003   * File Name          : gpio.c
00004   * Description        : This file provides code for the configuration
00005   *                      of all used GPIO pins.
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
00010   * All rights reserved.</center></h2>
00011   *
00012   * This software component is licensed by ST under Ultimate Liberty license
00013   * SLA0044, the "License"; You may not use this file except in compliance with
00014   * the License. You may obtain a copy of the License at:
00015   *                             www.st.com/SLA0044
00016   *
00017   ******************************************************************************
00018   */
00019 
00020 /* Includes ------------------------------------------------------------------*/
00021 #include "gpio.h"
00022 /* USER CODE BEGIN 0 */
00023 
00024 /* USER CODE END 0 */
00025 
00026 /*----------------------------------------------------------------------------*/
00027 /* Configure GPIO                                                             */
00028 /*----------------------------------------------------------------------------*/
00029 /* USER CODE BEGIN 1 */
00030 
00031 /* USER CODE END 1 */
00032 
00033 /** Configure pins
00034      PC14-OSC32_IN (OSC32_IN)   ------> RCC_OSC32_IN
00035      PC15-OSC32_OUT (OSC32_OUT)   ------> RCC_OSC32_OUT
00036      PH0-OSC_IN (PH0)   ------> RCC_OSC_IN
00037      PH1-OSC_OUT (PH1)   ------> RCC_OSC_OUT
00038 */
00039 void MX_GPIO_Init(void)
00040 {
00041 
00042   GPIO_InitTypeDef GPIO_InitStruct = {0};
00043 
00044   /* GPIO Ports Clock Enable */
00045   __HAL_RCC_GPIOC_CLK_ENABLE();
00046   __HAL_RCC_GPIOH_CLK_ENABLE();
00047   __HAL_RCC_GPIOA_CLK_ENABLE();
00048   __HAL_RCC_GPIOB_CLK_ENABLE();
00049   __HAL_RCC_GPIOD_CLK_ENABLE();
00050   __HAL_RCC_GPIOG_CLK_ENABLE();
00051   __HAL_RCC_GPIOE_CLK_ENABLE();
00052 
00053   /*Configure GPIO pin Output Level */
00054   HAL_GPIO_WritePin(GPIOB, LD1_Pin|LD3_Pin, GPIO_PIN_RESET);
00055 
00056   /*Configure GPIO pin Output Level */
00057   HAL_GPIO_WritePin(GPIOD, USB_OTG_FS_PWR_EN_Pin|PHASE_A_CS_Pin|PHASE_B_CS_Pin, GPIO_PIN_RESET);
00058 
00059   /*Configure GPIO pin Output Level */
00060   HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
00061 
00062   /*Configure GPIO pin : PtPin */
00063   GPIO_InitStruct.Pin = B1_Pin;
00064   GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
00065   GPIO_InitStruct.Pull = GPIO_NOPULL;
00066   HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
00067 
00068   /*Configure GPIO pins : PBPin PBPin */
00069   GPIO_InitStruct.Pin = LD1_Pin|LD3_Pin;
00070   GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
00071   GPIO_InitStruct.Pull = GPIO_NOPULL;
00072   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
00073   HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
00074 
00075   /*Configure GPIO pins : PDPin PDPin PDPin */
00076   GPIO_InitStruct.Pin = USB_OTG_FS_PWR_EN_Pin|PHASE_A_CS_Pin|PHASE_B_CS_Pin;
00077   GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
00078   GPIO_InitStruct.Pull = GPIO_NOPULL;
00079   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
00080   HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
00081 
00082   /*Configure GPIO pin : PtPin */
00083   GPIO_InitStruct.Pin = USB_OTG_FS_OVCR_Pin;
00084   GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
00085   GPIO_InitStruct.Pull = GPIO_NOPULL;
00086   HAL_GPIO_Init(USB_OTG_FS_OVCR_GPIO_Port, &GPIO_InitStruct);
00087 
00088   /*Configure GPIO pin : PtPin */
00089   GPIO_InitStruct.Pin = LD2_Pin;
00090   GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
00091   GPIO_InitStruct.Pull = GPIO_NOPULL;
00092   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
00093   HAL_GPIO_Init(LD2_GPIO_Port, &GPIO_InitStruct);
00094 
00095 }
00096 
00097 /* USER CODE BEGIN 2 */
00098 
00099 /* USER CODE END 2 */
00100 
00101 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
00102