| | |
| | | /* USER CODE BEGIN 0 */ |
| | | |
| | | /* USER CODE END 0 */ |
| | | |
| | | void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim); |
| | | /** |
| | | /** |
| | | * Initializes the Global MSP. |
| | | */ |
| | | void HAL_MspInit(void) |
| | |
| | | /* USER CODE BEGIN MspInit 1 */ |
| | | |
| | | /* USER CODE END MspInit 1 */ |
| | | } |
| | | |
| | | /** |
| | | * @brief ADC MSP Initialization |
| | | * This function configures the hardware resources used in this example |
| | | * @param hadc: ADC handle pointer |
| | | * @retval None |
| | | */ |
| | | void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc) |
| | | { |
| | | GPIO_InitTypeDef GPIO_InitStruct = {0}; |
| | | if(hadc->Instance==ADC1) |
| | | { |
| | | /* USER CODE BEGIN ADC1_MspInit 0 */ |
| | | |
| | | /* USER CODE END ADC1_MspInit 0 */ |
| | | /* Peripheral clock enable */ |
| | | __HAL_RCC_ADC1_CLK_ENABLE(); |
| | | |
| | | __HAL_RCC_GPIOA_CLK_ENABLE(); |
| | | /**ADC GPIO Configuration |
| | | PA1 ------> ADC_IN1 |
| | | */ |
| | | GPIO_InitStruct.Pin = BAT_MEAS_Pin; |
| | | GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; |
| | | GPIO_InitStruct.Pull = GPIO_NOPULL; |
| | | HAL_GPIO_Init(BAT_MEAS_GPIO_Port, &GPIO_InitStruct); |
| | | |
| | | /* USER CODE BEGIN ADC1_MspInit 1 */ |
| | | |
| | | /* USER CODE END ADC1_MspInit 1 */ |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * @brief ADC MSP De-Initialization |
| | | * This function freeze the hardware resources used in this example |
| | | * @param hadc: ADC handle pointer |
| | | * @retval None |
| | | */ |
| | | void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc) |
| | | { |
| | | if(hadc->Instance==ADC1) |
| | | { |
| | | /* USER CODE BEGIN ADC1_MspDeInit 0 */ |
| | | |
| | | /* USER CODE END ADC1_MspDeInit 0 */ |
| | | /* Peripheral clock disable */ |
| | | __HAL_RCC_ADC1_CLK_DISABLE(); |
| | | |
| | | /**ADC GPIO Configuration |
| | | PA1 ------> ADC_IN1 |
| | | */ |
| | | HAL_GPIO_DeInit(BAT_MEAS_GPIO_Port, BAT_MEAS_Pin); |
| | | |
| | | /* USER CODE BEGIN ADC1_MspDeInit 1 */ |
| | | |
| | | /* USER CODE END ADC1_MspDeInit 1 */ |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | } |
| | | |
| | | void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim) |
| | | { |
| | | GPIO_InitTypeDef GPIO_InitStruct = {0}; |
| | | if(htim->Instance==TIM2) |
| | | { |
| | | /* USER CODE BEGIN TIM2_MspPostInit 0 */ |
| | | |
| | | /* USER CODE END TIM2_MspPostInit 0 */ |
| | | |
| | | __HAL_RCC_GPIOB_CLK_ENABLE(); |
| | | /**TIM2 GPIO Configuration |
| | | PB10 ------> TIM2_CH3 |
| | | */ |
| | | GPIO_InitStruct.Pin = GPIO_PIN_10; |
| | | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; |
| | | GPIO_InitStruct.Pull = GPIO_NOPULL; |
| | | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
| | | GPIO_InitStruct.Alternate = GPIO_AF2_TIM2; |
| | | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
| | | |
| | | /* USER CODE BEGIN TIM2_MspPostInit 1 */ |
| | | |
| | | /* USER CODE END TIM2_MspPostInit 1 */ |
| | | } |
| | | |
| | | } |
| | | /** |
| | | * @brief TIM_Base MSP De-Initialization |
| | | * This function freeze the hardware resources used in this example |