annotate f103c8/Src/stm32f1xx_hal_msp.c @ 6:ca42336826bd default tip

working on clock sources
author cin
date Mon, 23 Jan 2017 02:40:17 +0300
parents 0c59e7a7782a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
2 ******************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
3 * File Name : stm32f1xx_hal_msp.c
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
4 * Description : This file provides code for the MSP Initialization
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
5 * and de-Initialization codes.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
6 ******************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
7 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
8 * COPYRIGHT(c) 2017 STMicroelectronics
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
9 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
10 * Redistribution and use in source and binary forms, with or without modification,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
11 * are permitted provided that the following conditions are met:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
12 * 1. Redistributions of source code must retain the above copyright notice,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
13 * this list of conditions and the following disclaimer.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
14 * 2. Redistributions in binary form must reproduce the above copyright notice,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
15 * this list of conditions and the following disclaimer in the documentation
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
16 * and/or other materials provided with the distribution.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
17 * 3. Neither the name of STMicroelectronics nor the names of its contributors
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
18 * may be used to endorse or promote products derived from this software
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
19 * without specific prior written permission.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
20 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
24 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
28 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
31 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
32 ******************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
33 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
34 /* Includes ------------------------------------------------------------------*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
35 #include "stm32f1xx_hal.h"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
36
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
37 extern void Error_Handler(void);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
38 /* USER CODE BEGIN 0 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
39
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
40 /* USER CODE END 0 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
41 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
42 * Initializes the Global MSP.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
43 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
44 void HAL_MspInit(void)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
45 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
46 /* USER CODE BEGIN MspInit 0 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
47
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
48 /* USER CODE END MspInit 0 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
49
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
50 __HAL_RCC_AFIO_CLK_ENABLE();
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
51
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
52 HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
53
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
54 /* System interrupt init*/
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
55 /* MemoryManagement_IRQn interrupt configuration */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
56 HAL_NVIC_SetPriority(MemoryManagement_IRQn, 0, 0);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
57 /* BusFault_IRQn interrupt configuration */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
58 HAL_NVIC_SetPriority(BusFault_IRQn, 0, 0);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
59 /* UsageFault_IRQn interrupt configuration */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
60 HAL_NVIC_SetPriority(UsageFault_IRQn, 0, 0);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
61 /* SVCall_IRQn interrupt configuration */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
62 HAL_NVIC_SetPriority(SVCall_IRQn, 0, 0);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
63 /* DebugMonitor_IRQn interrupt configuration */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
64 HAL_NVIC_SetPriority(DebugMonitor_IRQn, 0, 0);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
65 /* PendSV_IRQn interrupt configuration */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
66 HAL_NVIC_SetPriority(PendSV_IRQn, 0, 0);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
67 /* SysTick_IRQn interrupt configuration */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
68 HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
69
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
70 /**DISABLE: JTAG-DP Disabled and SW-DP Disabled
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
71 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
72 __HAL_AFIO_REMAP_SWJ_DISABLE();
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
73
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
74 /* USER CODE BEGIN MspInit 1 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
75
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
76 /* USER CODE END MspInit 1 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
77 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
78
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
79 void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
80 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
81
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
82 if(htim_base->Instance==TIM4)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
83 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
84 /* USER CODE BEGIN TIM4_MspInit 0 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
85
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
86 /* USER CODE END TIM4_MspInit 0 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
87 /* Peripheral clock enable */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
88 __HAL_RCC_TIM4_CLK_ENABLE();
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
89 /* USER CODE BEGIN TIM4_MspInit 1 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
90
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
91 /* USER CODE END TIM4_MspInit 1 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
92 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
93
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
94 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
95
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
96 void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
97 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
98
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
99 GPIO_InitTypeDef GPIO_InitStruct;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
100 if(htim->Instance==TIM4)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
101 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
102 /* USER CODE BEGIN TIM4_MspPostInit 0 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
103
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
104 /* USER CODE END TIM4_MspPostInit 0 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
105
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
106 /**TIM4 GPIO Configuration
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
107 PB6 ------> TIM4_CH1
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
108 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
109 GPIO_InitStruct.Pin = GPIO_PIN_6;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
110 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
111 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
112 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
113
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
114 /* USER CODE BEGIN TIM4_MspPostInit 1 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
115
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
116 /* USER CODE END TIM4_MspPostInit 1 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
117 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
118
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
119 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
120
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
121 void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
122 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
123
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
124 if(htim_base->Instance==TIM4)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
125 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
126 /* USER CODE BEGIN TIM4_MspDeInit 0 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
127
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
128 /* USER CODE END TIM4_MspDeInit 0 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
129 /* Peripheral clock disable */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
130 __HAL_RCC_TIM4_CLK_DISABLE();
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
131 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
132 /* USER CODE BEGIN TIM4_MspDeInit 1 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
133
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
134 /* USER CODE END TIM4_MspDeInit 1 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
135
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
136 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
137
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
138 /* USER CODE BEGIN 1 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
139
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
140 /* USER CODE END 1 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
141
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
142 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
143 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
144 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
145
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
146 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
147 * @}
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
148 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
149
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
150 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/