tdse-tp0_02-hw_sw_test

FIUBA - Electrónica - Taller de Sistemas Embebidos - Trabajo Práctico N°: 0 - Proyecto N°: 02
Index Commits Files Refs
Core/Src/stm32f1xx_hal_msp.c (3848B)
   1 /* USER CODE BEGIN Header */
   2 /**
   3  ******************************************************************************
   4  * @file         stm32f1xx_hal_msp.c
   5  * @brief        This file provides code for the MSP Initialization
   6  *               and de-Initialization codes.
   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 "main.h"
  23 /* USER CODE BEGIN Includes */
  24 
  25 /* USER CODE END Includes */
  26 
  27 /* Private typedef -----------------------------------------------------------*/
  28 /* USER CODE BEGIN TD */
  29 
  30 /* USER CODE END TD */
  31 
  32 /* Private define ------------------------------------------------------------*/
  33 /* USER CODE BEGIN Define */
  34 
  35 /* USER CODE END Define */
  36 
  37 /* Private macro -------------------------------------------------------------*/
  38 /* USER CODE BEGIN Macro */
  39 
  40 /* USER CODE END Macro */
  41 
  42 /* Private variables ---------------------------------------------------------*/
  43 /* USER CODE BEGIN PV */
  44 
  45 /* USER CODE END PV */
  46 
  47 /* Private function prototypes -----------------------------------------------*/
  48 /* USER CODE BEGIN PFP */
  49 
  50 /* USER CODE END PFP */
  51 
  52 /* External functions --------------------------------------------------------*/
  53 /* USER CODE BEGIN ExternalFunctions */
  54 
  55 /* USER CODE END ExternalFunctions */
  56 
  57 /* USER CODE BEGIN 0 */
  58 
  59 /* USER CODE END 0 */
  60 /**
  61  * Initializes the Global MSP.
  62  */
  63 void HAL_MspInit(void)
  64 {
  65 
  66     /* USER CODE BEGIN MspInit 0 */
  67 
  68     /* USER CODE END MspInit 0 */
  69 
  70     __HAL_RCC_AFIO_CLK_ENABLE();
  71     __HAL_RCC_PWR_CLK_ENABLE();
  72 
  73     /* System interrupt init*/
  74 
  75     /** NOJTAG: JTAG-DP Disabled and SW-DP Enabled
  76      */
  77     __HAL_AFIO_REMAP_SWJ_NOJTAG();
  78 
  79     /* USER CODE BEGIN MspInit 1 */
  80 
  81     /* USER CODE END MspInit 1 */
  82 }
  83 
  84 /**
  85  * @brief UART MSP Initialization
  86  * This function configures the hardware resources used in this example
  87  * @param huart: UART handle pointer
  88  * @retval None
  89  */
  90 void HAL_UART_MspInit(UART_HandleTypeDef *huart)
  91 {
  92     GPIO_InitTypeDef GPIO_InitStruct = { 0 };
  93     if (huart->Instance == USART2) {
  94         /* USER CODE BEGIN USART2_MspInit 0 */
  95 
  96         /* USER CODE END USART2_MspInit 0 */
  97         /* Peripheral clock enable */
  98         __HAL_RCC_USART2_CLK_ENABLE();
  99 
 100         __HAL_RCC_GPIOA_CLK_ENABLE();
 101         /**USART2 GPIO Configuration
 102          PA2     ------> USART2_TX
 103          PA3     ------> USART2_RX
 104          */
 105         GPIO_InitStruct.Pin = USART_TX_Pin | USART_RX_Pin;
 106         GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
 107         GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
 108         HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 109 
 110         /* USER CODE BEGIN USART2_MspInit 1 */
 111 
 112         /* USER CODE END USART2_MspInit 1 */
 113 
 114     }
 115 
 116 }
 117 
 118 /**
 119  * @brief UART MSP De-Initialization
 120  * This function freeze the hardware resources used in this example
 121  * @param huart: UART handle pointer
 122  * @retval None
 123  */
 124 void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
 125 {
 126     if (huart->Instance == USART2) {
 127         /* USER CODE BEGIN USART2_MspDeInit 0 */
 128 
 129         /* USER CODE END USART2_MspDeInit 0 */
 130         /* Peripheral clock disable */
 131         __HAL_RCC_USART2_CLK_DISABLE();
 132 
 133         /**USART2 GPIO Configuration
 134          PA2     ------> USART2_TX
 135          PA3     ------> USART2_RX
 136          */
 137         HAL_GPIO_DeInit(GPIOA, USART_TX_Pin | USART_RX_Pin);
 138 
 139         /* USER CODE BEGIN USART2_MspDeInit 1 */
 140 
 141         /* USER CODE END USART2_MspDeInit 1 */
 142     }
 143 
 144 }
 145 
 146 /* USER CODE BEGIN 1 */
 147 
 148 /* USER CODE END 1 */