stm32l4xx_it.c
Go to the documentation of this file.
1 /* USER CODE BEGIN Header */
2 /**
3 ******************************************************************************
4 * @file stm32l4xx_it.c
5 * @brief Interrupt Service Routines.
6 ******************************************************************************
7 * @attention
8 *
9 * <h2><center>&copy; Copyright (c) 2022 STMicroelectronics.
10 * All rights reserved.</center></h2>
11 *
12 * This software component is licensed by ST under BSD 3-Clause license,
13 * the "License"; You may not use this file except in compliance with the
14 * License. You may obtain a copy of the License at:
15 * opensource.org/licenses/BSD-3-Clause
16 *
17 ******************************************************************************
18 */
19 /* USER CODE END Header */
20
21 /* Includes ------------------------------------------------------------------*/
22 #include "stm32l4xx_it.h"
23 #include "main.h"
24 /* Private includes ----------------------------------------------------------*/
25 /* USER CODE BEGIN Includes */
26 /* USER CODE END Includes */
27
28 /* Private typedef -----------------------------------------------------------*/
29 /* USER CODE BEGIN TD */
30
31 /* USER CODE END TD */
32
33 /* Private define ------------------------------------------------------------*/
34 /* USER CODE BEGIN PD */
35
36 /* USER CODE END PD */
37
38 /* Private macro -------------------------------------------------------------*/
39 /* USER CODE BEGIN PM */
40
41 /* USER CODE END PM */
42
43 /* Private variables ---------------------------------------------------------*/
44 /* USER CODE BEGIN PV */
45
46 /* USER CODE END PV */
47
48 /* Private function prototypes -----------------------------------------------*/
49 /* USER CODE BEGIN PFP */
50
51 /* USER CODE END PFP */
52
53 /* Private user code ---------------------------------------------------------*/
54 /* USER CODE BEGIN 0 */
55
56 /* USER CODE END 0 */
57
58 /* External variables --------------------------------------------------------*/
59 extern I2C_HandleTypeDef hi2c2;
60 extern RTC_HandleTypeDef hrtc;
61 extern DMA_HandleTypeDef hdma_spi1_rx;
62 extern DMA_HandleTypeDef hdma_spi1_tx;
63 extern DMA_HandleTypeDef hdma_usart2_rx;
64 extern DMA_HandleTypeDef hdma_usart2_tx;
65 extern UART_HandleTypeDef huart2;
66 /* USER CODE BEGIN EV */
67
68 /* USER CODE END EV */
69
70 /******************************************************************************/
71 /* Cortex-M4 Processor Interruption and Exception Handlers */
72 /******************************************************************************/
73 /**
74 * @brief This function handles Non maskable interrupt.
75 */
76 void NMI_Handler(void)
77 {
78 /* USER CODE BEGIN NonMaskableInt_IRQn 0 */
79
80 /* USER CODE END NonMaskableInt_IRQn 0 */
81 /* USER CODE BEGIN NonMaskableInt_IRQn 1 */
82 while (1)
83 {
84 }
85 /* USER CODE END NonMaskableInt_IRQn 1 */
86 }
87
88 /**
89 * @brief This function handles Hard fault interrupt.
90 */
91 void HardFault_Handler(void)
92 {
93 /* USER CODE BEGIN HardFault_IRQn 0 */
94
95 /* USER CODE END HardFault_IRQn 0 */
96 while (1)
97 {
98 /* USER CODE BEGIN W1_HardFault_IRQn 0 */
99 /* USER CODE END W1_HardFault_IRQn 0 */
100 }
101 }
102
103 /**
104 * @brief This function handles Memory management fault.
105 */
106 void MemManage_Handler(void)
107 {
108 /* USER CODE BEGIN MemoryManagement_IRQn 0 */
109
110 /* USER CODE END MemoryManagement_IRQn 0 */
111 while (1)
112 {
113 /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
114 /* USER CODE END W1_MemoryManagement_IRQn 0 */
115 }
116 }
117
118 /**
119 * @brief This function handles Prefetch fault, memory access fault.
120 */
121 void BusFault_Handler(void)
122 {
123 /* USER CODE BEGIN BusFault_IRQn 0 */
124
125 /* USER CODE END BusFault_IRQn 0 */
126 while (1)
127 {
128 /* USER CODE BEGIN W1_BusFault_IRQn 0 */
129 /* USER CODE END W1_BusFault_IRQn 0 */
130 }
131 }
132
133 /**
134 * @brief This function handles Undefined instruction or illegal state.
135 */
136 void UsageFault_Handler(void)
137 {
138 /* USER CODE BEGIN UsageFault_IRQn 0 */
139
140 /* USER CODE END UsageFault_IRQn 0 */
141 while (1)
142 {
143 /* USER CODE BEGIN W1_UsageFault_IRQn 0 */
144 /* USER CODE END W1_UsageFault_IRQn 0 */
145 }
146 }
147
148 /**
149 * @brief This function handles System service call via SWI instruction.
150 */
151 void SVC_Handler(void)
152 {
153 /* USER CODE BEGIN SVCall_IRQn 0 */
154
155 /* USER CODE END SVCall_IRQn 0 */
156 /* USER CODE BEGIN SVCall_IRQn 1 */
157
158 /* USER CODE END SVCall_IRQn 1 */
159 }
160
161 /**
162 * @brief This function handles Debug monitor.
163 */
164 void DebugMon_Handler(void)
165 {
166 /* USER CODE BEGIN DebugMonitor_IRQn 0 */
167
168 /* USER CODE END DebugMonitor_IRQn 0 */
169 /* USER CODE BEGIN DebugMonitor_IRQn 1 */
170
171 /* USER CODE END DebugMonitor_IRQn 1 */
172 }
173
174 /**
175 * @brief This function handles Pendable request for system service.
176 */
177 void PendSV_Handler(void)
178 {
179 /* USER CODE BEGIN PendSV_IRQn 0 */
180
181 /* USER CODE END PendSV_IRQn 0 */
182 /* USER CODE BEGIN PendSV_IRQn 1 */
183
184 /* USER CODE END PendSV_IRQn 1 */
185 }
186
187 /**
188 * @brief This function handles System tick timer.
189 */
190 void SysTick_Handler(void)
191 {
192 /* USER CODE BEGIN SysTick_IRQn 0 */
193
194 /* USER CODE END SysTick_IRQn 0 */
195 HAL_IncTick();
196 /* USER CODE BEGIN SysTick_IRQn 1 */
197 /* USER CODE END SysTick_IRQn 1 */
198 }
199
200 /******************************************************************************/
201 /* STM32L4xx Peripheral Interrupt Handlers */
202 /* Add here the Interrupt Handlers for the used peripherals. */
203 /* For the available peripheral interrupt handler names, */
204 /* please refer to the startup file (startup_stm32l4xx.s). */
205 /******************************************************************************/
206
207 /**
208 * @brief This function handles RTC wake-up interrupt through EXTI line 20.
209 */
210 void RTC_WKUP_IRQHandler(void)
211 {
212 /* USER CODE BEGIN RTC_WKUP_IRQn 0 */
213
214 /* USER CODE END RTC_WKUP_IRQn 0 */
215 HAL_RTCEx_WakeUpTimerIRQHandler(&hrtc);
216 /* USER CODE BEGIN RTC_WKUP_IRQn 1 */
217
218 /* USER CODE END RTC_WKUP_IRQn 1 */
219 }
220
221 /**
222 * @brief This function handles EXTI line3 interrupt.
223 */
224 void EXTI3_IRQHandler(void)
225 {
226 /* USER CODE BEGIN EXTI3_IRQn 0 */
227
228 /* USER CODE END EXTI3_IRQn 0 */
229 HAL_GPIO_EXTI_IRQHandler(INTERRUPT_Pin);
230 /* USER CODE BEGIN EXTI3_IRQn 1 */
231
232 /* USER CODE END EXTI3_IRQn 1 */
233 }
234
235 /**
236 * @brief This function handles DMA1 channel2 global interrupt.
237 */
238 void DMA1_Channel2_IRQHandler(void)
239 {
240 /* USER CODE BEGIN DMA1_Channel2_IRQn 0 */
241
242 /* USER CODE END DMA1_Channel2_IRQn 0 */
243 HAL_DMA_IRQHandler(&hdma_spi1_rx);
244 /* USER CODE BEGIN DMA1_Channel2_IRQn 1 */
245
246 /* USER CODE END DMA1_Channel2_IRQn 1 */
247 }
248
249 /**
250 * @brief This function handles DMA1 channel3 global interrupt.
251 */
252 void DMA1_Channel3_IRQHandler(void)
253 {
254 /* USER CODE BEGIN DMA1_Channel3_IRQn 0 */
255
256 /* USER CODE END DMA1_Channel3_IRQn 0 */
257 HAL_DMA_IRQHandler(&hdma_spi1_tx);
258 /* USER CODE BEGIN DMA1_Channel3_IRQn 1 */
259
260 /* USER CODE END DMA1_Channel3_IRQn 1 */
261 }
262
263 /**
264 * @brief This function handles DMA1 channel6 global interrupt.
265 */
266 void DMA1_Channel6_IRQHandler(void)
267 {
268 /* USER CODE BEGIN DMA1_Channel6_IRQn 0 */
269
270 /* USER CODE END DMA1_Channel6_IRQn 0 */
271 HAL_DMA_IRQHandler(&hdma_usart2_rx);
272 /* USER CODE BEGIN DMA1_Channel6_IRQn 1 */
273
274 /* USER CODE END DMA1_Channel6_IRQn 1 */
275 }
276
277 /**
278 * @brief This function handles DMA1 channel7 global interrupt.
279 */
280 void DMA1_Channel7_IRQHandler(void)
281 {
282 /* USER CODE BEGIN DMA1_Channel7_IRQn 0 */
283
284 /* USER CODE END DMA1_Channel7_IRQn 0 */
285 HAL_DMA_IRQHandler(&hdma_usart2_tx);
286 /* USER CODE BEGIN DMA1_Channel7_IRQn 1 */
287
288 /* USER CODE END DMA1_Channel7_IRQn 1 */
289 }
290
291 /**
292 * @brief This function handles I2C2 event interrupt.
293 */
294 void I2C2_EV_IRQHandler(void)
295 {
296 /* USER CODE BEGIN I2C2_EV_IRQn 0 */
297
298 /* USER CODE END I2C2_EV_IRQn 0 */
299 HAL_I2C_EV_IRQHandler(&hi2c2);
300 /* USER CODE BEGIN I2C2_EV_IRQn 1 */
301
302 /* USER CODE END I2C2_EV_IRQn 1 */
303 }
304
305 /**
306 * @brief This function handles USART2 global interrupt.
307 */
308 void USART2_IRQHandler(void)
309 {
310 /* USER CODE BEGIN USART2_IRQn 0 */
311
312 /* USER CODE END USART2_IRQn 0 */
313 HAL_UART_IRQHandler(&huart2);
314 /* USER CODE BEGIN USART2_IRQn 1 */
315
316 /* USER CODE END USART2_IRQn 1 */
317 }
318
319 /**
320 * @brief This function handles EXTI line[15:10] interrupts.
321 */
322 void EXTI15_10_IRQHandler(void)
323 {
324 /* USER CODE BEGIN EXTI15_10_IRQn 0 */
325
326 /* USER CODE END EXTI15_10_IRQn 0 */
327 HAL_GPIO_EXTI_IRQHandler(WAKE_UP_Pin);
328 /* USER CODE BEGIN EXTI15_10_IRQn 1 */
329
330 /* USER CODE END EXTI15_10_IRQn 1 */
331 }
332
333 /**
334 * @brief This function handles RTC alarm interrupt through EXTI line 18.
335 */
336 void RTC_Alarm_IRQHandler(void)
337 {
338 /* USER CODE BEGIN RTC_Alarm_IRQn 0 */
339
340 /* USER CODE END RTC_Alarm_IRQn 0 */
341 HAL_RTC_AlarmIRQHandler(&hrtc);
342 /* USER CODE BEGIN RTC_Alarm_IRQn 1 */
343
344 /* USER CODE END RTC_Alarm_IRQn 1 */
345 }
346
347 /* USER CODE BEGIN 1 */
348
349 /* USER CODE END 1 */
I2C2_EV_IRQHandler
void I2C2_EV_IRQHandler(void)
This function handles I2C2 event interrupt.
Definition: stm32l4xx_it.c:294
stm32l4xx_it.h
This file contains the headers of the interrupt handlers.
NMI_Handler
void NMI_Handler(void)
This function handles Non maskable interrupt.
Definition: stm32l4xx_it.c:76
DMA1_Channel6_IRQHandler
void DMA1_Channel6_IRQHandler(void)
This function handles DMA1 channel6 global interrupt.
Definition: stm32l4xx_it.c:266
hrtc
RTC_HandleTypeDef hrtc
DebugMon_Handler
void DebugMon_Handler(void)
This function handles Debug monitor.
Definition: stm32l4xx_it.c:164
WAKE_UP_Pin
#define WAKE_UP_Pin
Definition: main.h:67
BusFault_Handler
void BusFault_Handler(void)
This function handles Prefetch fault, memory access fault.
Definition: stm32l4xx_it.c:121
PendSV_Handler
void PendSV_Handler(void)
This function handles Pendable request for system service.
Definition: stm32l4xx_it.c:177
USART2_IRQHandler
void USART2_IRQHandler(void)
This function handles USART2 global interrupt.
Definition: stm32l4xx_it.c:308
DMA1_Channel3_IRQHandler
void DMA1_Channel3_IRQHandler(void)
This function handles DMA1 channel3 global interrupt.
Definition: stm32l4xx_it.c:252
hdma_spi1_rx
DMA_HandleTypeDef hdma_spi1_rx
hdma_usart2_rx
DMA_HandleTypeDef hdma_usart2_rx
RTC_WKUP_IRQHandler
void RTC_WKUP_IRQHandler(void)
This function handles RTC wake-up interrupt through EXTI line 20.
Definition: stm32l4xx_it.c:210
huart2
UART_HandleTypeDef huart2
EXTI15_10_IRQHandler
void EXTI15_10_IRQHandler(void)
This function handles EXTI line[15:10] interrupts.
Definition: stm32l4xx_it.c:322
HardFault_Handler
void HardFault_Handler(void)
This function handles Hard fault interrupt.
Definition: stm32l4xx_it.c:91
hdma_usart2_tx
DMA_HandleTypeDef hdma_usart2_tx
SysTick_Handler
void SysTick_Handler(void)
This function handles System tick timer.
Definition: stm32l4xx_it.c:190
hi2c2
I2C_HandleTypeDef hi2c2
SVC_Handler
void SVC_Handler(void)
This function handles System service call via SWI instruction.
Definition: stm32l4xx_it.c:151
EXTI3_IRQHandler
void EXTI3_IRQHandler(void)
This function handles EXTI line3 interrupt.
Definition: stm32l4xx_it.c:224
MemManage_Handler
void MemManage_Handler(void)
This function handles Memory management fault.
Definition: stm32l4xx_it.c:106
DMA1_Channel2_IRQHandler
void DMA1_Channel2_IRQHandler(void)
This function handles DMA1 channel2 global interrupt.
Definition: stm32l4xx_it.c:238
main.h
: Header for main.c file. This file contains the common defines of the application.
DMA1_Channel7_IRQHandler
void DMA1_Channel7_IRQHandler(void)
This function handles DMA1 channel7 global interrupt.
Definition: stm32l4xx_it.c:280
hdma_spi1_tx
DMA_HandleTypeDef hdma_spi1_tx
INTERRUPT_Pin
#define INTERRUPT_Pin
Definition: main.h:62
UsageFault_Handler
void UsageFault_Handler(void)
This function handles Undefined instruction or illegal state.
Definition: stm32l4xx_it.c:136
RTC_Alarm_IRQHandler
void RTC_Alarm_IRQHandler(void)
This function handles RTC alarm interrupt through EXTI line 18.
Definition: stm32l4xx_it.c:336