tim.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file tim.c
  5. * @brief This file provides code for the configuration
  6. * of the TIM instances.
  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. /* Includes ------------------------------------------------------------------*/
  21. #include "tim.h"
  22. /* USER CODE BEGIN 0 */
  23. /* USER CODE END 0 */
  24. TIM_HandleTypeDef htim14;
  25. /* TIM14 init function */
  26. void MX_TIM14_Init(void)
  27. {
  28. /* USER CODE BEGIN TIM14_Init 0 */
  29. /* USER CODE END TIM14_Init 0 */
  30. /* USER CODE BEGIN TIM14_Init 1 */
  31. /* USER CODE END TIM14_Init 1 */
  32. htim14.Instance = TIM14;
  33. htim14.Init.Prescaler = 24-1;
  34. htim14.Init.CounterMode = TIM_COUNTERMODE_UP;
  35. htim14.Init.Period = 10000;
  36. htim14.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
  37. htim14.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
  38. if (HAL_TIM_Base_Init(&htim14) != HAL_OK)
  39. {
  40. Error_Handler();
  41. }
  42. /* USER CODE BEGIN TIM14_Init 2 */
  43. /* USER CODE END TIM14_Init 2 */
  44. }
  45. void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
  46. {
  47. if(tim_baseHandle->Instance==TIM14)
  48. {
  49. /* USER CODE BEGIN TIM14_MspInit 0 */
  50. /* USER CODE END TIM14_MspInit 0 */
  51. /* TIM14 clock enable */
  52. __HAL_RCC_TIM14_CLK_ENABLE();
  53. /* TIM14 interrupt Init */
  54. HAL_NVIC_SetPriority(TIM14_IRQn, 0, 0);
  55. HAL_NVIC_EnableIRQ(TIM14_IRQn);
  56. /* USER CODE BEGIN TIM14_MspInit 1 */
  57. /* USER CODE END TIM14_MspInit 1 */
  58. }
  59. }
  60. void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
  61. {
  62. if(tim_baseHandle->Instance==TIM14)
  63. {
  64. /* USER CODE BEGIN TIM14_MspDeInit 0 */
  65. /* USER CODE END TIM14_MspDeInit 0 */
  66. /* Peripheral clock disable */
  67. __HAL_RCC_TIM14_CLK_DISABLE();
  68. /* TIM14 interrupt Deinit */
  69. HAL_NVIC_DisableIRQ(TIM14_IRQn);
  70. /* USER CODE BEGIN TIM14_MspDeInit 1 */
  71. /* USER CODE END TIM14_MspDeInit 1 */
  72. }
  73. }
  74. /* USER CODE BEGIN 1 */
  75. /* USER CODE END 1 */