text: /* USER CODE BEGIN Header */
  /**
    ******************************************************************************
    * @file    gpio.c
    * @brief   This file provides code for the configuration
    *          of all used GPIO pins.
    ******************************************************************************
    * @attention
    *
    * Copyright (c) 2022 STMicroelectronics.
    * All rights reserved.
    *
    * This software is licensed under terms that can be found in the LICENSE file
    * in the root directory of this software component.
    * If no LICENSE file comes with this software, it is provided AS-IS.
    *
    ******************************************************************************
    */
  /* USER CODE END Header */
  
  /* Includes ------------------------------------------------------------------*/
  #include "gpio.h"
  
  /* USER CODE BEGIN 0 */
  
  /* USER CODE END 0 */
  
  /*----------------------------------------------------------------------------*/
  /* Configure GPIO                                                             */
  /*----------------------------------------------------------------------------*/
  /* USER CODE BEGIN 1 */
  
  /* USER CODE END 1 */
  
  /** Configure pins
       PB3   ------> SPI1_SCK
       PA7   ------> SPI1_MOSI
       PA6   ------> SPI1_MISO
  */
  void MX_GPIO_Init(void)
  {
  
    GPIO_InitTypeDef GPIO_InitStruct = {0};
  
    /* GPIO Ports Clock Enable */
    __HAL_RCC_GPIOA_CLK_ENABLE();
    __HAL_RCC_GPIOB_CLK_ENABLE();
    __HAL_RCC_GPIOC_CLK_ENABLE();
    __HAL_RCC_GPIOH_CLK_ENABLE();
  
    /*Configure GPIO pin Output Level */
    HAL_GPIO_WritePin(GPIOA, PA15_RESERVED_Pin|PA12_RESERVED_Pin|RS485_DE_GPIO_Pin|RS485_RE_GPIO_Pin, GPIO_PIN_RESET);
  
    /*Configure GPIO pin Output Level */
    HAL_GPIO_WritePin(GPIOC, PC1_RESERVED_Pin|PC0_RESERVED_Pin|PC2_RESERVED_Pin, GPIO_PIN_RESET);
  
    /*Configure GPIO pin Output Level */
    HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, GPIO_PIN_RESET);
  
    /*Configure GPIO pins : PAPin PAPin PAPin PAPin */
    GPIO_InitStruct.Pin = PA15_RESERVED_Pin|PA12_RESERVED_Pin|RS485_DE_GPIO_Pin|RS485_RE_GPIO_Pin;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  
    /*Configure GPIO pin : PtPin */
    GPIO_InitStruct.Pin = PB3_RESERVED_Pin;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
    GPIO_InitStruct.Alternate = GPIO_AF0_SPI1;
    HAL_GPIO_Init(PB3_RESERVED_GPIO_Port, &GPIO_InitStruct);
  
    /*Configure GPIO pins : PB5 PB9 PB6 PB8
                             PB7 PB15 PB2 PB14
                             PB13 PB11 PB10 */
    GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_9|GPIO_PIN_6|GPIO_PIN_8
                            |GPIO_PIN_7|GPIO_PIN_15|GPIO_PIN_2|GPIO_PIN_14
                            |GPIO_PIN_13|GPIO_PIN_11|GPIO_PIN_10;
    GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  
    /*Configure GPIO pins : PA14 PA10 PA13 PA8
                             PA11 PA9 PA1 PA5 */
  //  GPIO_InitStruct.Pin = GPIO_PIN_14|GPIO_PIN_10|GPIO_PIN_13|GPIO_PIN_8
  //                          |GPIO_PIN_11|GPIO_PIN_9|GPIO_PIN_1|GPIO_PIN_5;
  //  GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  //  GPIO_InitStruct.Pull = GPIO_NOPULL;
  //  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  
    /*Configure GPIO pins : PBPin PBPin PBPin */
    GPIO_InitStruct.Pin = PB4_RESERVED_Pin|PB1_RESERVED_Pin|PB0_RESERVED_Pin;
    GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  
    /*Configure GPIO pin : PtPin */
    GPIO_InitStruct.Pin = PC13_RESERVED_Pin;
    GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    HAL_GPIO_Init(PC13_RESERVED_GPIO_Port, &GPIO_InitStruct);
  
    /*Configure GPIO pins : PCPin PCPin PCPin */
    GPIO_InitStruct.Pin = PC1_RESERVED_Pin|PC0_RESERVED_Pin|PC2_RESERVED_Pin;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  
    /*Configure GPIO pins : PC14 PC15 */
    GPIO_InitStruct.Pin = GPIO_PIN_14|GPIO_PIN_15;
    GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  
    /*Configure GPIO pins : PAPin PAPin */
    GPIO_InitStruct.Pin = PA7_RESERVED_Pin|PA6_RESERVED_Pin;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
    GPIO_InitStruct.Alternate = GPIO_AF0_SPI1;
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  
    /*Configure GPIO pin : PB12 */
    GPIO_InitStruct.Pin = GPIO_PIN_12;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  
    /* EXTI interrupt init*/
    HAL_NVIC_SetPriority(EXTI0_1_IRQn, 0, 0);
    HAL_NVIC_EnableIRQ(EXTI0_1_IRQn);
  
    HAL_NVIC_SetPriority(EXTI4_15_IRQn, 0, 0);
    HAL_NVIC_EnableIRQ(EXTI4_15_IRQn);
  
  }
  
  /* USER CODE BEGIN 2 */
  
  /* USER CODE END 2 */
  