You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.4 KiB

3 years ago
  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) 2023 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 htim6;
  25. /* TIM6 init function */
  26. void MX_TIM6_Init(void)
  27. {
  28. /* USER CODE BEGIN TIM6_Init 0 */
  29. /* USER CODE END TIM6_Init 0 */
  30. TIM_MasterConfigTypeDef sMasterConfig = {0};
  31. /* USER CODE BEGIN TIM6_Init 1 */
  32. /* USER CODE END TIM6_Init 1 */
  33. htim6.Instance = TIM6;
  34. htim6.Init.Prescaler = 0;
  35. htim6.Init.CounterMode = TIM_COUNTERMODE_UP;
  36. htim6.Init.Period = 65535;
  37. htim6.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
  38. if (HAL_TIM_Base_Init(&htim6) != HAL_OK)
  39. {
  40. Error_Handler();
  41. }
  42. sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
  43. sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
  44. if (HAL_TIMEx_MasterConfigSynchronization(&htim6, &sMasterConfig) != HAL_OK)
  45. {
  46. Error_Handler();
  47. }
  48. /* USER CODE BEGIN TIM6_Init 2 */
  49. /* USER CODE END TIM6_Init 2 */
  50. }
  51. void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
  52. {
  53. if(tim_baseHandle->Instance==TIM6)
  54. {
  55. /* USER CODE BEGIN TIM6_MspInit 0 */
  56. /* USER CODE END TIM6_MspInit 0 */
  57. /* TIM6 clock enable */
  58. __HAL_RCC_TIM6_CLK_ENABLE();
  59. /* USER CODE BEGIN TIM6_MspInit 1 */
  60. /* USER CODE END TIM6_MspInit 1 */
  61. }
  62. }
  63. void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
  64. {
  65. if(tim_baseHandle->Instance==TIM6)
  66. {
  67. /* USER CODE BEGIN TIM6_MspDeInit 0 */
  68. /* USER CODE END TIM6_MspDeInit 0 */
  69. /* Peripheral clock disable */
  70. __HAL_RCC_TIM6_CLK_DISABLE();
  71. /* USER CODE BEGIN TIM6_MspDeInit 1 */
  72. /* USER CODE END TIM6_MspDeInit 1 */
  73. }
  74. }
  75. /* USER CODE BEGIN 1 */
  76. /* USER CODE END 1 */