F439_CPP_BMP390_Barometric_Pressure_and_Altimeter_01 1.0
STM32F439 BMP390 barometric pressure and altimeter tutorial
Loading...
Searching...
No Matches
stm32f4xx_hal_msp.c
Go to the documentation of this file.
1/* USER CODE BEGIN Header */
19/* USER CODE END Header */
20
21/* Includes ------------------------------------------------------------------*/
22#include "main.h"
23/* USER CODE BEGIN Includes */
24
25/* USER CODE END Includes */
26
27/* Private typedef -----------------------------------------------------------*/
28/* USER CODE BEGIN TD */
29
30/* USER CODE END TD */
31
32/* Private define ------------------------------------------------------------*/
33/* USER CODE BEGIN Define */
34
35/* USER CODE END Define */
36
37/* Private macro -------------------------------------------------------------*/
38/* USER CODE BEGIN Macro */
39
40/* USER CODE END Macro */
41
42/* Private variables ---------------------------------------------------------*/
43/* USER CODE BEGIN PV */
44
45/* USER CODE END PV */
46
47/* Private function prototypes -----------------------------------------------*/
48/* USER CODE BEGIN PFP */
49
50/* USER CODE END PFP */
51
52/* External functions --------------------------------------------------------*/
53/* USER CODE BEGIN ExternalFunctions */
54
55/* USER CODE END ExternalFunctions */
56
57/* USER CODE BEGIN 0 */
58
59/* USER CODE END 0 */
63void HAL_MspInit(void)
64{
65
66 /* USER CODE BEGIN MspInit 0 */
67
68 /* USER CODE END MspInit 0 */
69
70 __HAL_RCC_SYSCFG_CLK_ENABLE();
71 __HAL_RCC_PWR_CLK_ENABLE();
72
73 /* System interrupt init*/
74
75 /* USER CODE BEGIN MspInit 1 */
76
77 /* USER CODE END MspInit 1 */
78}
79
86void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
87{
88 GPIO_InitTypeDef GPIO_InitStruct = {0};
89 if(hi2c->Instance==I2C1)
90 {
91 /* USER CODE BEGIN I2C1_MspInit 0 */
92
93 /* USER CODE END I2C1_MspInit 0 */
94
95 __HAL_RCC_GPIOB_CLK_ENABLE();
100 GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;
101 GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
102 GPIO_InitStruct.Pull = GPIO_NOPULL;
103 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
104 GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;
105 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
106
107 /* Peripheral clock enable */
108 __HAL_RCC_I2C1_CLK_ENABLE();
109 /* USER CODE BEGIN I2C1_MspInit 1 */
110
111 /* USER CODE END I2C1_MspInit 1 */
112
113 }
114
115}
116
123void HAL_I2C_MspDeInit(I2C_HandleTypeDef* hi2c)
124{
125 if(hi2c->Instance==I2C1)
126 {
127 /* USER CODE BEGIN I2C1_MspDeInit 0 */
128
129 /* USER CODE END I2C1_MspDeInit 0 */
130 /* Peripheral clock disable */
131 __HAL_RCC_I2C1_CLK_DISABLE();
132
137 HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8);
138
139 HAL_GPIO_DeInit(GPIOB, GPIO_PIN_9);
140
141 /* USER CODE BEGIN I2C1_MspDeInit 1 */
142
143 /* USER CODE END I2C1_MspDeInit 1 */
144 }
145
146}
147
154void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
155{
156 if(htim_base->Instance==TIM1)
157 {
158 /* USER CODE BEGIN TIM1_MspInit 0 */
159
160 /* USER CODE END TIM1_MspInit 0 */
161 /* Peripheral clock enable */
162 __HAL_RCC_TIM1_CLK_ENABLE();
163 /* USER CODE BEGIN TIM1_MspInit 1 */
164
165 /* USER CODE END TIM1_MspInit 1 */
166
167 }
168
169}
170
177void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
178{
179 if(htim_base->Instance==TIM1)
180 {
181 /* USER CODE BEGIN TIM1_MspDeInit 0 */
182
183 /* USER CODE END TIM1_MspDeInit 0 */
184 /* Peripheral clock disable */
185 __HAL_RCC_TIM1_CLK_DISABLE();
186 /* USER CODE BEGIN TIM1_MspDeInit 1 */
187
188 /* USER CODE END TIM1_MspDeInit 1 */
189 }
190
191}
192
199void HAL_UART_MspInit(UART_HandleTypeDef* huart)
200{
201 GPIO_InitTypeDef GPIO_InitStruct = {0};
202 if(huart->Instance==USART1)
203 {
204 /* USER CODE BEGIN USART1_MspInit 0 */
205
206 /* USER CODE END USART1_MspInit 0 */
207 /* Peripheral clock enable */
208 __HAL_RCC_USART1_CLK_ENABLE();
209
210 __HAL_RCC_GPIOA_CLK_ENABLE();
215 GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10;
216 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
217 GPIO_InitStruct.Pull = GPIO_NOPULL;
218 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
219 GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
220 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
221
222 /* USER CODE BEGIN USART1_MspInit 1 */
223
224 /* USER CODE END USART1_MspInit 1 */
225
226 }
227
228}
229
236void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
237{
238 if(huart->Instance==USART1)
239 {
240 /* USER CODE BEGIN USART1_MspDeInit 0 */
241
242 /* USER CODE END USART1_MspDeInit 0 */
243 /* Peripheral clock disable */
244 __HAL_RCC_USART1_CLK_DISABLE();
245
250 HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10);
251
252 /* USER CODE BEGIN USART1_MspDeInit 1 */
253
254 /* USER CODE END USART1_MspDeInit 1 */
255 }
256
257}
258
259/* USER CODE BEGIN 1 */
260
261/* USER CODE END 1 */
: Header for main.c file. This file contains the common defines of the application.
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
UART MSP Initialization This function configures the hardware resources used in this example.
void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c)
I2C MSP De-Initialization This function freeze the hardware resources used in this example.
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example.
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
UART MSP De-Initialization This function freeze the hardware resources used in this example.
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
TIM_Base MSP Initialization This function configures the hardware resources used in this example.
void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
I2C MSP Initialization This function configures the hardware resources used in this example.
void HAL_MspInit(void)