This commit is contained in:
2023-11-08 20:06:03 +01:00
parent a7ccf2ce66
commit 53e8d774c8
7 changed files with 61 additions and 60 deletions

View File

@@ -1,21 +1,21 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file tim.c
* @brief This file provides code for the configuration
* of the TIM instances.
******************************************************************************
* @attention
*
* Copyright (c) 2023 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.
*
******************************************************************************
*/
******************************************************************************
* @file tim.c
* @brief This file provides code for the configuration
* of the TIM instances.
******************************************************************************
* @attention
*
* Copyright (c) 2023 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.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "tim.h"
@@ -43,7 +43,7 @@ void MX_TIM15_Init(void)
/* USER CODE END TIM15_Init 1 */
htim15.Instance = TIM15;
htim15.Init.Prescaler = 19999;
htim15.Init.Prescaler = 124;
htim15.Init.CounterMode = TIM_COUNTERMODE_UP;
htim15.Init.Period = 31;
htim15.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
@@ -99,21 +99,20 @@ void MX_TIM15_Init(void)
/* USER CODE END TIM15_Init 2 */
HAL_TIM_MspPostInit(&htim15);
}
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *tim_baseHandle)
{
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
if(tim_baseHandle->Instance==TIM15)
if (tim_baseHandle->Instance == TIM15)
{
/* USER CODE BEGIN TIM15_MspInit 0 */
/* USER CODE BEGIN TIM15_MspInit 0 */
/* USER CODE END TIM15_MspInit 0 */
/* USER CODE END TIM15_MspInit 0 */
/** Initializes the peripherals clocks
*/
/** Initializes the peripherals clocks
*/
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_TIM15;
PeriphClkInit.Tim15ClockSelection = RCC_TIM15CLKSOURCE_PCLK1;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
@@ -123,20 +122,20 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
/* TIM15 clock enable */
__HAL_RCC_TIM15_CLK_ENABLE();
/* USER CODE BEGIN TIM15_MspInit 1 */
/* USER CODE BEGIN TIM15_MspInit 1 */
/* USER CODE END TIM15_MspInit 1 */
/* USER CODE END TIM15_MspInit 1 */
}
}
void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *timHandle)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(timHandle->Instance==TIM15)
if (timHandle->Instance == TIM15)
{
/* USER CODE BEGIN TIM15_MspPostInit 0 */
/* USER CODE BEGIN TIM15_MspPostInit 0 */
/* USER CODE END TIM15_MspPostInit 0 */
/* USER CODE END TIM15_MspPostInit 0 */
__HAL_RCC_GPIOC_CLK_ENABLE();
/**TIM15 GPIO Configuration
@@ -149,26 +148,25 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
GPIO_InitStruct.Alternate = GPIO_AF2_TIM15;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/* USER CODE BEGIN TIM15_MspPostInit 1 */
/* USER CODE BEGIN TIM15_MspPostInit 1 */
/* USER CODE END TIM15_MspPostInit 1 */
/* USER CODE END TIM15_MspPostInit 1 */
}
}
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *tim_baseHandle)
{
if(tim_baseHandle->Instance==TIM15)
if (tim_baseHandle->Instance == TIM15)
{
/* USER CODE BEGIN TIM15_MspDeInit 0 */
/* USER CODE BEGIN TIM15_MspDeInit 0 */
/* USER CODE END TIM15_MspDeInit 0 */
/* USER CODE END TIM15_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_TIM15_CLK_DISABLE();
/* USER CODE BEGIN TIM15_MspDeInit 1 */
/* USER CODE BEGIN TIM15_MspDeInit 1 */
/* USER CODE END TIM15_MspDeInit 1 */
/* USER CODE END TIM15_MspDeInit 1 */
}
}