/Projects/STM324x9I_EVAL/Examples/ADC/ADC_InjectedConversion_Interrupt/Src/stm32f4xx_hal_msp.c
https://github.com/Bosvark/STM32Cube_FW_F4_V1.1.0 · C · 132 lines · 25 code · 17 blank · 90 comment · 0 complexity · 05b3f145bfffe57ad010f3068e928b02 MD5 · raw file
- /**
- ******************************************************************************
- * @file ADC/ADC_InjectedConversion_Interrupt/Src/stm32f4xx_hal_msp.c
- * @author MCD Application Team
- * @version V1.0.1
- * @date 26-February-2014
- * @brief HAL MSP module.
- ******************************************************************************
- * @attention
- *
- * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
-
- /* Includes ------------------------------------------------------------------*/
- #include "main.h"
-
- /** @addtogroup STM32F4xx_HAL_Examples
- * @{
- */
-
- /** @defgroup ADC_InjectedConversion_Interrupt
- * @{
- */
-
- /* Private typedef -----------------------------------------------------------*/
- /* Private define ------------------------------------------------------------*/
- /* Private macro -------------------------------------------------------------*/
- /* Private variables ---------------------------------------------------------*/
- /* Private function prototypes -----------------------------------------------*/
- /* Private functions ---------------------------------------------------------*/
-
- /** @defgroup HAL_MSP_Private_Functions
- * @{
- */
-
- /**
- * @brief ADC MSP Initialization
- * This function configures the hardware resources used in this example:
- * - Peripheral's clock enable
- * - Peripheral's GPIO Configuration
- * @param huart: UART handle pointer
- * @retval None
- */
- void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
- {
- GPIO_InitTypeDef GPIO_InitStruct;
-
- /*##-1- Enable peripherals and GPIO Clocks #################################*/
- /* ADC3 Periph clock enable */
- ADCx_CLK_ENABLE();
- /* Enable GPIO clock ****************************************/
- ADCx_REG_CHANNEL_GPIO_CLK_ENABLE();
- ADCx_INJ_CHANNEL_GPIO_CLK_ENABLE();
-
- /*##-2- Configure peripheral GPIO ##########################################*/
- /* ADC1 Channel11 GPIO pin configuration */
- GPIO_InitStruct.Pin = ADCx_REG_CHANNEL_PIN;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- HAL_GPIO_Init(ADCx_REG_CHANNEL_GPIO_PORT, &GPIO_InitStruct);
- /* ADC1 Channel12 GPIO pin configuration */
- GPIO_InitStruct.Pin = ADCx_INJ_CHANNEL_PIN;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- HAL_GPIO_Init(ADCx_INJ_CHANNEL_GPIO_PORT, &GPIO_InitStruct);
-
-
- /*##-3- Configure the NVIC #################################################*/
- /* NVIC configuration for conversion complete complete interrupt */
- HAL_NVIC_SetPriority(ADCx_IRQn, 15, 0);
- HAL_NVIC_EnableIRQ(ADCx_IRQn);
- }
-
- /**
- * @brief ADC MSP De-Initialization
- * This function frees the hardware resources used in this example:
- * - Disable the Peripheral's clock
- * - Revert GPIO to their default state
- * @param hadc: ADC handle pointer
- * @retval None
- */
- void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
- {
-
- /*##-1- Reset peripherals ##################################################*/
- ADCx_FORCE_RESET();
- ADCx_RELEASE_RESET();
-
- /*##-2- Disable peripherals and GPIO Clocks ################################*/
- /* De-initialize the ADC1 Channel11 GPIO pin */
- HAL_GPIO_DeInit(ADCx_REG_CHANNEL_GPIO_PORT, ADCx_REG_CHANNEL_PIN);
- /* De-initialize the ADC1 Channel12 GPIO pin */
- HAL_GPIO_DeInit(ADCx_INJ_CHANNEL_GPIO_PORT, ADCx_INJ_CHANNEL_PIN);
- }
-
- /**
- * @}
- */
-
- /**
- * @}
- */
-
- /**
- * @}
- */
-
- /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/