tdse-tp4_04-led_ldr

FIUBA - Electrónica - Taller de Sistemas Embebidos - Trabajo Práctico N°: 4 - LED & LDR
Index Commits Files Refs README
Core/Src/stm32f1xx_hal_msp.c (7009B)
   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) 2024 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 void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
  62                     /**
  63   * Initializes the Global MSP.
  64   */
  65 void HAL_MspInit(void)
  66 {
  67 
  68   /* USER CODE BEGIN MspInit 0 */
  69 
  70   /* USER CODE END MspInit 0 */
  71 
  72   __HAL_RCC_AFIO_CLK_ENABLE();
  73   __HAL_RCC_PWR_CLK_ENABLE();
  74 
  75   /* System interrupt init*/
  76 
  77   /** NOJTAG: JTAG-DP Disabled and SW-DP Enabled
  78   */
  79   __HAL_AFIO_REMAP_SWJ_NOJTAG();
  80 
  81   /* USER CODE BEGIN MspInit 1 */
  82 
  83   /* USER CODE END MspInit 1 */
  84 }
  85 
  86 /**
  87 * @brief ADC MSP Initialization
  88 * This function configures the hardware resources used in this example
  89 * @param hadc: ADC handle pointer
  90 * @retval None
  91 */
  92 void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
  93 {
  94   GPIO_InitTypeDef GPIO_InitStruct = {0};
  95   if(hadc->Instance==ADC1)
  96   {
  97   /* USER CODE BEGIN ADC1_MspInit 0 */
  98 
  99   /* USER CODE END ADC1_MspInit 0 */
 100     /* Peripheral clock enable */
 101     __HAL_RCC_ADC1_CLK_ENABLE();
 102 
 103     __HAL_RCC_GPIOA_CLK_ENABLE();
 104     /**ADC1 GPIO Configuration
 105     PA0-WKUP     ------> ADC1_IN0
 106     */
 107     GPIO_InitStruct.Pin = GPIO_PIN_0;
 108     GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
 109     HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 110 
 111   /* USER CODE BEGIN ADC1_MspInit 1 */
 112 
 113   /* USER CODE END ADC1_MspInit 1 */
 114 
 115   }
 116 
 117 }
 118 
 119 /**
 120 * @brief ADC MSP De-Initialization
 121 * This function freeze the hardware resources used in this example
 122 * @param hadc: ADC handle pointer
 123 * @retval None
 124 */
 125 void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc)
 126 {
 127   if(hadc->Instance==ADC1)
 128   {
 129   /* USER CODE BEGIN ADC1_MspDeInit 0 */
 130 
 131   /* USER CODE END ADC1_MspDeInit 0 */
 132     /* Peripheral clock disable */
 133     __HAL_RCC_ADC1_CLK_DISABLE();
 134 
 135     /**ADC1 GPIO Configuration
 136     PA0-WKUP     ------> ADC1_IN0
 137     */
 138     HAL_GPIO_DeInit(GPIOA, GPIO_PIN_0);
 139 
 140   /* USER CODE BEGIN ADC1_MspDeInit 1 */
 141 
 142   /* USER CODE END ADC1_MspDeInit 1 */
 143   }
 144 
 145 }
 146 
 147 /**
 148 * @brief TIM_PWM MSP Initialization
 149 * This function configures the hardware resources used in this example
 150 * @param htim_pwm: TIM_PWM handle pointer
 151 * @retval None
 152 */
 153 void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef* htim_pwm)
 154 {
 155   if(htim_pwm->Instance==TIM3)
 156   {
 157   /* USER CODE BEGIN TIM3_MspInit 0 */
 158 
 159   /* USER CODE END TIM3_MspInit 0 */
 160     /* Peripheral clock enable */
 161     __HAL_RCC_TIM3_CLK_ENABLE();
 162   /* USER CODE BEGIN TIM3_MspInit 1 */
 163 
 164   /* USER CODE END TIM3_MspInit 1 */
 165 
 166   }
 167 
 168 }
 169 
 170 void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
 171 {
 172   GPIO_InitTypeDef GPIO_InitStruct = {0};
 173   if(htim->Instance==TIM3)
 174   {
 175   /* USER CODE BEGIN TIM3_MspPostInit 0 */
 176 
 177   /* USER CODE END TIM3_MspPostInit 0 */
 178 
 179     __HAL_RCC_GPIOA_CLK_ENABLE();
 180     /**TIM3 GPIO Configuration
 181     PA6     ------> TIM3_CH1
 182     */
 183     GPIO_InitStruct.Pin = GPIO_PIN_6;
 184     GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
 185     GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
 186     HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 187 
 188   /* USER CODE BEGIN TIM3_MspPostInit 1 */
 189 
 190   /* USER CODE END TIM3_MspPostInit 1 */
 191   }
 192 
 193 }
 194 /**
 195 * @brief TIM_PWM MSP De-Initialization
 196 * This function freeze the hardware resources used in this example
 197 * @param htim_pwm: TIM_PWM handle pointer
 198 * @retval None
 199 */
 200 void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef* htim_pwm)
 201 {
 202   if(htim_pwm->Instance==TIM3)
 203   {
 204   /* USER CODE BEGIN TIM3_MspDeInit 0 */
 205 
 206   /* USER CODE END TIM3_MspDeInit 0 */
 207     /* Peripheral clock disable */
 208     __HAL_RCC_TIM3_CLK_DISABLE();
 209   /* USER CODE BEGIN TIM3_MspDeInit 1 */
 210 
 211   /* USER CODE END TIM3_MspDeInit 1 */
 212   }
 213 
 214 }
 215 
 216 /**
 217 * @brief UART MSP Initialization
 218 * This function configures the hardware resources used in this example
 219 * @param huart: UART handle pointer
 220 * @retval None
 221 */
 222 void HAL_UART_MspInit(UART_HandleTypeDef* huart)
 223 {
 224   GPIO_InitTypeDef GPIO_InitStruct = {0};
 225   if(huart->Instance==USART2)
 226   {
 227   /* USER CODE BEGIN USART2_MspInit 0 */
 228 
 229   /* USER CODE END USART2_MspInit 0 */
 230     /* Peripheral clock enable */
 231     __HAL_RCC_USART2_CLK_ENABLE();
 232 
 233     __HAL_RCC_GPIOA_CLK_ENABLE();
 234     /**USART2 GPIO Configuration
 235     PA2     ------> USART2_TX
 236     PA3     ------> USART2_RX
 237     */
 238     GPIO_InitStruct.Pin = USART_TX_Pin|USART_RX_Pin;
 239     GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
 240     GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
 241     HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 242 
 243   /* USER CODE BEGIN USART2_MspInit 1 */
 244 
 245   /* USER CODE END USART2_MspInit 1 */
 246 
 247   }
 248 
 249 }
 250 
 251 /**
 252 * @brief UART MSP De-Initialization
 253 * This function freeze the hardware resources used in this example
 254 * @param huart: UART handle pointer
 255 * @retval None
 256 */
 257 void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
 258 {
 259   if(huart->Instance==USART2)
 260   {
 261   /* USER CODE BEGIN USART2_MspDeInit 0 */
 262 
 263   /* USER CODE END USART2_MspDeInit 0 */
 264     /* Peripheral clock disable */
 265     __HAL_RCC_USART2_CLK_DISABLE();
 266 
 267     /**USART2 GPIO Configuration
 268     PA2     ------> USART2_TX
 269     PA3     ------> USART2_RX
 270     */
 271     HAL_GPIO_DeInit(GPIOA, USART_TX_Pin|USART_RX_Pin);
 272 
 273   /* USER CODE BEGIN USART2_MspDeInit 1 */
 274 
 275   /* USER CODE END USART2_MspDeInit 1 */
 276   }
 277 
 278 }
 279 
 280 /* USER CODE BEGIN 1 */
 281 
 282 /* USER CODE END 1 */