mirror of
https://github.com/STMicroelectronics/STM32CubeF4.git
synced 2025-04-28 13:48:54 +08:00
90 lines
2.5 KiB
C
90 lines
2.5 KiB
C
/**
|
|
******************************************************************************
|
|
* @file Demonstrations/Src/stm32f4xx_hal_msp.c
|
|
* @author MCD Application Team
|
|
* @brief HAL MSP module.
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* Copyright (c) 2017 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.
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "main.h"
|
|
|
|
/** @addtogroup STM32F4xx_HAL_Applications
|
|
* @{
|
|
*/
|
|
|
|
/** @defgroup HAL_MSP
|
|
* @brief HAL MSP module.
|
|
* @{
|
|
*/
|
|
|
|
/* Private typedef -----------------------------------------------------------*/
|
|
/* Private define ------------------------------------------------------------*/
|
|
/* Private macro -------------------------------------------------------------*/
|
|
/* Private variables ---------------------------------------------------------*/
|
|
/* Private function prototypes -----------------------------------------------*/
|
|
/* Private functions ---------------------------------------------------------*/
|
|
|
|
/** @defgroup HAL_MSP_Private_Functions
|
|
* @{
|
|
*/
|
|
|
|
/**
|
|
* @brief Initializes the TIM PWM MSP.
|
|
* @param htim: TIM handle
|
|
* @retval None
|
|
*/
|
|
void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim)
|
|
{
|
|
GPIO_InitTypeDef GPIO_InitStructure;
|
|
/* --------------------------- System Clocks Configuration -----------------*/
|
|
/* TIM4 clock enable */
|
|
__HAL_RCC_TIM4_CLK_ENABLE();
|
|
|
|
/* GPIOD clock enable */
|
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
|
|
|
/*-------------------------- GPIO Configuration ----------------------------*/
|
|
/* GPIOD Configuration: Pins 12, 13, 14 and 15 in output push-pull */
|
|
GPIO_InitStructure.Pin = GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
|
|
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
|
|
GPIO_InitStructure.Pull = GPIO_NOPULL;
|
|
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
|
|
GPIO_InitStructure.Alternate = GPIO_AF2_TIM4;
|
|
HAL_GPIO_Init(GPIOD, &GPIO_InitStructure);
|
|
}
|
|
|
|
/**
|
|
* @brief DeInitializes the TIM PWM MSP.
|
|
* @param htim: TIM handle
|
|
* @retval None
|
|
*/
|
|
void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim)
|
|
{
|
|
/* TIM4 clock reset */
|
|
__HAL_RCC_TIM4_FORCE_RESET();
|
|
__HAL_RCC_TIM4_RELEASE_RESET();
|
|
}
|
|
|
|
/**
|
|
* @}
|
|
*/
|
|
|
|
/**
|
|
* @}
|
|
*/
|
|
|
|
/**
|
|
* @}
|
|
*/
|