Select one of the symbols to view example projects that use it.
 
Outline
Includes
#include "main.h"
HAL_TIM_OC_MspInit(TIM_HandleTypeDef *)
Files
loading...
SourceVuSTM32 Libraries and SamplesTIM_OCToggleSrc/stm32f4xx_hal_msp.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file TIM/TIM_OCToggle/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_Examples * @{ *//* ... */ /** @defgroup HAL_MSP * @brief HAL MSP module. * @{ *//* ... */ Includes /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /** @defgroup HAL_MSP_Private_Functions * @{ *//* ... */ /** * @brief TIM MSP Initialization * This function configures the hardware resources used in this example: * - Peripheral's clock enable * - Peripheral's GPIO Configuration * @param htim: TIM handle pointer * @retval None *//* ... */ void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim) { GPIO_InitTypeDef GPIO_InitStruct; /*##-1- Enable peripherals and GPIO Clocks #################################*/ /* TIM3 Peripheral clock enable */ TIMx_CLK_ENABLE(); /* Enable GPIO Channels Clock */ TIMx_CHANNEL_GPIO_PORT; /*##-2- Configure I/Os #####################################################*/ /* Configure PB.04 (TIM3_Channel1), PB.05 (TIM3_Channel2), PB.00 (TIM3_Channel3), PB.01 (TIM3_Channel4) in output, pull-up, alternate function mode *//* ... */ /* Common configuration for all channels */ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = TIMx_GPIO_AF_CHANNEL1; GPIO_InitStruct.Pin = TIMx_GPIO_PIN_CHANNEL1; HAL_GPIO_Init(TIMx_GPIO_PORT_CHANNEL1, &GPIO_InitStruct); GPIO_InitStruct.Alternate = TIMx_GPIO_AF_CHANNEL2; GPIO_InitStruct.Pin = TIMx_GPIO_PIN_CHANNEL2; HAL_GPIO_Init(TIMx_GPIO_PORT_CHANNEL2, &GPIO_InitStruct); GPIO_InitStruct.Alternate = TIMx_GPIO_AF_CHANNEL3; GPIO_InitStruct.Pin = TIMx_GPIO_PIN_CHANNEL3; HAL_GPIO_Init(TIMx_GPIO_PORT_CHANNEL3, &GPIO_InitStruct); GPIO_InitStruct.Alternate = TIMx_GPIO_AF_CHANNEL4; GPIO_InitStruct.Pin = TIMx_GPIO_PIN_CHANNEL4; HAL_GPIO_Init(TIMx_GPIO_PORT_CHANNEL4, &GPIO_InitStruct); /*##-3- Enable the TIM2 global Interrupt & set priority ####################*/ HAL_NVIC_SetPriority(TIM3_IRQn, 0, 1); HAL_NVIC_EnableIRQ(TIM3_IRQn); }{ ... } /** * @} *//* ... */ /** * @} *//* ... */ /** * @} *//* ... */
Details