Vehicle Control Unit 0.01
This is the c library for controlling the car.
Loading...
Searching...
No Matches
Functions | Variables
stm32f7xx_it.c File Reference

Interrupt Service Routines. More...

#include "main.h"
#include "stm32f7xx_it.h"
#include "../Inc/Sensors/AnalogSensor.h"
#include "../Inc/Sensors/DigitalSensor.h"
#include "../Inc/Outputs/DigitalOutput.h"
Include dependency graph for stm32f7xx_it.c:

Go to the source code of this file.

Functions

void NMI_Handler (void)
 This function handles Non maskable interrupt. More...
 
void HardFault_Handler (void)
 This function handles Hard fault interrupt. More...
 
void MemManage_Handler (void)
 This function handles Memory management fault. More...
 
void BusFault_Handler (void)
 This function handles Pre-fetch fault, memory access fault. More...
 
void UsageFault_Handler (void)
 This function handles Undefined instruction or illegal state. More...
 
void SVC_Handler (void)
 This function handles System service call via SWI instruction. More...
 
void DebugMon_Handler (void)
 This function handles Debug monitor. More...
 
void PendSV_Handler (void)
 This function handles Pendable request for system service. More...
 
void SysTick_Handler (void)
 This function handles System tick timer. More...
 
void DMA1_Stream5_IRQHandler (void)
 This function handles DMA1 stream5 global interrupt. More...
 
void DMA1_Stream6_IRQHandler (void)
 This function handles DMA1 stream6 global interrupt. More...
 
void CAN1_RX0_IRQHandler (void)
 This function handles CAN1 RX0 interrupts. More...
 
void TIM2_IRQHandler (void)
 This function handles TIM2 global interrupt. More...
 
void DMA2_Stream0_IRQHandler (void)
 This function handles DMA2 stream0 global interrupt. More...
 
void DMA2_Stream1_IRQHandler (void)
 This function handles DMA2 stream1 global interrupt. More...
 
void DMA2_Stream2_IRQHandler (void)
 This function handles DMA2 stream2 global interrupt. More...
 
void CAN2_RX0_IRQHandler (void)
 This function handles CAN2 RX0 interrupts. More...
 
void CAN3_RX0_IRQHandler (void)
 This function handles CAN3 RX0 interrupt. More...
 
void HAL_TIM_PeriodElapsedCallback (TIM_HandleTypeDef *htim)
 
int send_CAN_message_helper (CANBus bus, CAN_TxHeaderTypeDef *TxHeader, uint8_t *data)
 
void HAL_CAN_RxFifo0MsgPendingCallback (CAN_HandleTypeDef *hcan)
 
void HAL_ADC_ConvCpltCallback (ADC_HandleTypeDef *hadc)
 

Variables

CAN_RxHeaderTypeDef RxHeader1
 
CAN_RxHeaderTypeDef RxHeader2
 
uint8_t RxData1 [8]
 
uint8_t RxData2 [8]
 
DMA_HandleTypeDef hdma_adc1
 
DMA_HandleTypeDef hdma_adc2
 
DMA_HandleTypeDef hdma_adc3
 
CAN_HandleTypeDef hcan1
 
CAN_HandleTypeDef hcan2
 
CAN_HandleTypeDef hcan3
 
DMA_HandleTypeDef hdma_dac1
 
DMA_HandleTypeDef hdma_dac2
 
TIM_HandleTypeDef htim2
 
volatile uint32_t timer_flag = 0
 

Detailed Description

Interrupt Service Routines.

Attention

Copyright (c) 2024 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.

Definition in file stm32f7xx_it.c.

Function Documentation

◆ BusFault_Handler()

void BusFault_Handler ( void  )

This function handles Pre-fetch fault, memory access fault.

Definition at line 129 of file stm32f7xx_it.c.

130{
131 /* USER CODE BEGIN BusFault_IRQn 0 */
132
133 /* USER CODE END BusFault_IRQn 0 */
134 while (1)
135 {
136 /* USER CODE BEGIN W1_BusFault_IRQn 0 */
137 /* USER CODE END W1_BusFault_IRQn 0 */
138 }
139}

◆ CAN1_RX0_IRQHandler()

void CAN1_RX0_IRQHandler ( void  )

This function handles CAN1 RX0 interrupts.

Definition at line 247 of file stm32f7xx_it.c.

248{
249 /* USER CODE BEGIN CAN1_RX0_IRQn 0 */
250
251 /* USER CODE END CAN1_RX0_IRQn 0 */
252 HAL_CAN_IRQHandler(&hcan1);
253 /* USER CODE BEGIN CAN1_RX0_IRQn 1 */
254
255 /* USER CODE END CAN1_RX0_IRQn 1 */
256}
CAN_HandleTypeDef hcan1
Definition: main.c:67

◆ CAN2_RX0_IRQHandler()

void CAN2_RX0_IRQHandler ( void  )

This function handles CAN2 RX0 interrupts.

Definition at line 317 of file stm32f7xx_it.c.

318{
319 /* USER CODE BEGIN CAN2_RX0_IRQn 0 */
320
321 /* USER CODE END CAN2_RX0_IRQn 0 */
322 HAL_CAN_IRQHandler(&hcan2);
323 /* USER CODE BEGIN CAN2_RX0_IRQn 1 */
324
325 /* USER CODE END CAN2_RX0_IRQn 1 */
326}
CAN_HandleTypeDef hcan2
Definition: main.c:68

◆ CAN3_RX0_IRQHandler()

void CAN3_RX0_IRQHandler ( void  )

This function handles CAN3 RX0 interrupt.

Definition at line 331 of file stm32f7xx_it.c.

332{
333 /* USER CODE BEGIN CAN3_RX0_IRQn 0 */
334
335 /* USER CODE END CAN3_RX0_IRQn 0 */
336 HAL_CAN_IRQHandler(&hcan3);
337 /* USER CODE BEGIN CAN3_RX0_IRQn 1 */
338
339 /* USER CODE END CAN3_RX0_IRQn 1 */
340}
CAN_HandleTypeDef hcan3
Definition: main.c:69

◆ DebugMon_Handler()

void DebugMon_Handler ( void  )

This function handles Debug monitor.

Definition at line 172 of file stm32f7xx_it.c.

173{
174 /* USER CODE BEGIN DebugMonitor_IRQn 0 */
175
176 /* USER CODE END DebugMonitor_IRQn 0 */
177 /* USER CODE BEGIN DebugMonitor_IRQn 1 */
178
179 /* USER CODE END DebugMonitor_IRQn 1 */
180}

◆ DMA1_Stream5_IRQHandler()

void DMA1_Stream5_IRQHandler ( void  )

This function handles DMA1 stream5 global interrupt.

Definition at line 219 of file stm32f7xx_it.c.

220{
221 /* USER CODE BEGIN DMA1_Stream5_IRQn 0 */
222
223 /* USER CODE END DMA1_Stream5_IRQn 0 */
224 HAL_DMA_IRQHandler(&hdma_dac1);
225 /* USER CODE BEGIN DMA1_Stream5_IRQn 1 */
226
227 /* USER CODE END DMA1_Stream5_IRQn 1 */
228}
DMA_HandleTypeDef hdma_dac1
Definition: main.c:72

◆ DMA1_Stream6_IRQHandler()

void DMA1_Stream6_IRQHandler ( void  )

This function handles DMA1 stream6 global interrupt.

Definition at line 233 of file stm32f7xx_it.c.

234{
235 /* USER CODE BEGIN DMA1_Stream6_IRQn 0 */
236
237 /* USER CODE END DMA1_Stream6_IRQn 0 */
238 HAL_DMA_IRQHandler(&hdma_dac2);
239 /* USER CODE BEGIN DMA1_Stream6_IRQn 1 */
240
241 /* USER CODE END DMA1_Stream6_IRQn 1 */
242}
DMA_HandleTypeDef hdma_dac2
Definition: main.c:73

◆ DMA2_Stream0_IRQHandler()

void DMA2_Stream0_IRQHandler ( void  )

This function handles DMA2 stream0 global interrupt.

Definition at line 275 of file stm32f7xx_it.c.

276{
277 /* USER CODE BEGIN DMA2_Stream0_IRQn 0 */
278
279 /* USER CODE END DMA2_Stream0_IRQn 0 */
280 HAL_DMA_IRQHandler(&hdma_adc1);
281 /* USER CODE BEGIN DMA2_Stream0_IRQn 1 */
282
283 /* USER CODE END DMA2_Stream0_IRQn 1 */
284}
DMA_HandleTypeDef hdma_adc1
Definition: main.c:63

◆ DMA2_Stream1_IRQHandler()

void DMA2_Stream1_IRQHandler ( void  )

This function handles DMA2 stream1 global interrupt.

Definition at line 289 of file stm32f7xx_it.c.

290{
291 /* USER CODE BEGIN DMA2_Stream1_IRQn 0 */
292
293 /* USER CODE END DMA2_Stream1_IRQn 0 */
294 HAL_DMA_IRQHandler(&hdma_adc3);
295 /* USER CODE BEGIN DMA2_Stream1_IRQn 1 */
296
297 /* USER CODE END DMA2_Stream1_IRQn 1 */
298}
DMA_HandleTypeDef hdma_adc3
Definition: AnalogSensor.h:69

◆ DMA2_Stream2_IRQHandler()

void DMA2_Stream2_IRQHandler ( void  )

This function handles DMA2 stream2 global interrupt.

Definition at line 303 of file stm32f7xx_it.c.

304{
305 /* USER CODE BEGIN DMA2_Stream2_IRQn 0 */
306
307 /* USER CODE END DMA2_Stream2_IRQn 0 */
308 HAL_DMA_IRQHandler(&hdma_adc2);
309 /* USER CODE BEGIN DMA2_Stream2_IRQn 1 */
310
311 /* USER CODE END DMA2_Stream2_IRQn 1 */
312}
DMA_HandleTypeDef hdma_adc2
Definition: AnalogSensor.h:69

◆ HAL_ADC_ConvCpltCallback()

void HAL_ADC_ConvCpltCallback ( ADC_HandleTypeDef *  hadc)

Definition at line 420 of file stm32f7xx_it.c.

420 {
421 if (hadc == &hadc1) {
423 } else if (hadc == &hadc2) {
425 } else if (hadc == &hadc3) {
427 }
428}
ADC_HandleTypeDef hadc1
Definition: main.c:60
uint32_t adc3_buffer[8]
Definition: main.c:115
void ProcessADCData(uint32_t *adc1_buffer, uint32_t *adc2_buffer, uint32_t *adc3_buffer)
Processes ADC data from all three ADCs and stores it in the circular buffer.
Definition: AnalogSensor.c:58
uint32_t adc1_buffer[7]
Definition: main.c:113
ADC_HandleTypeDef hadc3
Definition: AnalogSensor.h:68
ADC_HandleTypeDef hadc2
Definition: AnalogSensor.h:68
uint32_t adc2_buffer[7]
Definition: main.c:114
Here is the call graph for this function:

◆ HAL_CAN_RxFifo0MsgPendingCallback()

void HAL_CAN_RxFifo0MsgPendingCallback ( CAN_HandleTypeDef *  hcan)

Definition at line 408 of file stm32f7xx_it.c.

409{
410 if (hcan == &hcan1) {
411 HAL_CAN_GetRxMessage(hcan, CAN_RX_FIFO0, &RxHeader1, RxData1);
413 } else if (hcan == &hcan2) {
414 HAL_CAN_GetRxMessage(hcan, CAN_RX_FIFO0, &RxHeader2, RxData2);
416 }
417}
@ CAN_1
Definition: Can.h:99
@ CAN_2
Definition: Can.h:100
void receive_CAN_message(CAN_RxHeaderTypeDef *header, uint8_t *data, CANBus bus)
Receives a CAN message.
Definition: Can.c:112
uint8_t RxData1[8]
Definition: stm32f7xx_it.c:50
uint8_t RxData2[8]
Definition: stm32f7xx_it.c:51
CAN_RxHeaderTypeDef RxHeader1
Definition: stm32f7xx_it.c:48
CAN_RxHeaderTypeDef RxHeader2
Definition: stm32f7xx_it.c:49
Here is the call graph for this function:

◆ HAL_TIM_PeriodElapsedCallback()

void HAL_TIM_PeriodElapsedCallback ( TIM_HandleTypeDef *  htim)

Definition at line 345 of file stm32f7xx_it.c.

346{
347 if (htim->Instance == TIM1)
348 {
349 timer_flag++;
350 } else if (htim->Instance == TIM2) {
351 // OUTPUTS
352 // D10
353 HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, digital_out_buffer[0]);
354 // D9
355 HAL_GPIO_WritePin(GPIOD, GPIO_PIN_15, digital_out_buffer[1]);
356 // D8
357 HAL_GPIO_WritePin(GPIOF, GPIO_PIN_12, digital_out_buffer[2]);
358 // D7
359 HAL_GPIO_WritePin(GPIOF, GPIO_PIN_13, digital_out_buffer[3]);
360 // D6
361 HAL_GPIO_WritePin(GPIOE, GPIO_PIN_9 , digital_out_buffer[4]);
362 // D5
363 HAL_GPIO_WritePin(GPIOE, GPIO_PIN_11, digital_out_buffer[5]);
364 // D4 for I2C
365 // HAL_GPIO_WritePin(GPIOF, GPIO_PIN_14, digital_out_buffer[6]);
366 // D3
367 HAL_GPIO_WritePin(GPIOE, GPIO_PIN_13, digital_out_buffer[6]);
368 // D2
369 // HAL_GPIO_WritePin(GPIOF, GPIO_PIN_15, digital_out_buffer[8]);
370 // D1
371 // HAL_GPIO_WritePin(GPIOG, GPIO_PIN_14, digital_out_buffer[9]);
372 // D0
373 HAL_GPIO_WritePin(GPIOG, GPIO_PIN_9, digital_out_buffer[7]);
374
375 // INPUTS
376 // D42
377 digital_in_buffer[0] = HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_8);
378 // D41
379 digital_in_buffer[1] = HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_7);
380 // D40
381 digital_in_buffer[2] = HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_10);
382 }
383}
uint8_t digital_out_buffer[NUM_DIGITAL_OUTPUTS]
Definition: main.c:118
uint8_t digital_in_buffer[NUM_DIGITAL_INPUTS]
Definition: main.c:119
volatile uint32_t timer_flag
Definition: stm32f7xx_it.c:343

◆ HardFault_Handler()

void HardFault_Handler ( void  )

This function handles Hard fault interrupt.

Definition at line 99 of file stm32f7xx_it.c.

100{
101 /* USER CODE BEGIN HardFault_IRQn 0 */
102
103 /* USER CODE END HardFault_IRQn 0 */
104 while (1)
105 {
106 /* USER CODE BEGIN W1_HardFault_IRQn 0 */
107 /* USER CODE END W1_HardFault_IRQn 0 */
108 }
109}

◆ MemManage_Handler()

void MemManage_Handler ( void  )

This function handles Memory management fault.

Definition at line 114 of file stm32f7xx_it.c.

115{
116 /* USER CODE BEGIN MemoryManagement_IRQn 0 */
117
118 /* USER CODE END MemoryManagement_IRQn 0 */
119 while (1)
120 {
121 /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */
122 /* USER CODE END W1_MemoryManagement_IRQn 0 */
123 }
124}

◆ NMI_Handler()

void NMI_Handler ( void  )

This function handles Non maskable interrupt.

Definition at line 84 of file stm32f7xx_it.c.

85{
86 /* USER CODE BEGIN NonMaskableInt_IRQn 0 */
87
88 /* USER CODE END NonMaskableInt_IRQn 0 */
89 /* USER CODE BEGIN NonMaskableInt_IRQn 1 */
90 while (1)
91 {
92 }
93 /* USER CODE END NonMaskableInt_IRQn 1 */
94}

◆ PendSV_Handler()

void PendSV_Handler ( void  )

This function handles Pendable request for system service.

Definition at line 185 of file stm32f7xx_it.c.

186{
187 /* USER CODE BEGIN PendSV_IRQn 0 */
188
189 /* USER CODE END PendSV_IRQn 0 */
190 /* USER CODE BEGIN PendSV_IRQn 1 */
191
192 /* USER CODE END PendSV_IRQn 1 */
193}

◆ send_CAN_message_helper()

int send_CAN_message_helper ( CANBus  bus,
CAN_TxHeaderTypeDef *  TxHeader,
uint8_t *  data 
)

Definition at line 386 of file stm32f7xx_it.c.

387{
388 uint32_t mailbox;
389 if (bus == CAN_1) {
390 if (HAL_CAN_AddTxMessage(&hcan1, TxHeader, data, &mailbox) != HAL_OK) {
391 uint32_t error = HAL_CAN_GetError(&hcan1);
392 printf("CAN1 Transmission Error: %lx\n", error);
393 return -1;
394 }
395 } else if (bus == CAN_2) {
396 if (HAL_CAN_AddTxMessage(&hcan2, TxHeader, data, &mailbox) != HAL_OK) {
397 uint32_t error = HAL_CAN_GetError(&hcan2);
398 printf("CAN2 Transmission Error: %lx\n", error);
399 return -1;
400 }
401 } else {
402 return -1;
403 }
404 return 0;
405}
Here is the caller graph for this function:

◆ SVC_Handler()

void SVC_Handler ( void  )

This function handles System service call via SWI instruction.

Definition at line 159 of file stm32f7xx_it.c.

160{
161 /* USER CODE BEGIN SVCall_IRQn 0 */
162
163 /* USER CODE END SVCall_IRQn 0 */
164 /* USER CODE BEGIN SVCall_IRQn 1 */
165
166 /* USER CODE END SVCall_IRQn 1 */
167}

◆ SysTick_Handler()

void SysTick_Handler ( void  )

This function handles System tick timer.

Definition at line 198 of file stm32f7xx_it.c.

199{
200 /* USER CODE BEGIN SysTick_IRQn 0 */
201
202 /* USER CODE END SysTick_IRQn 0 */
203 HAL_IncTick();
204 /* USER CODE BEGIN SysTick_IRQn 1 */
205
206 /* USER CODE END SysTick_IRQn 1 */
207}

◆ TIM2_IRQHandler()

void TIM2_IRQHandler ( void  )

This function handles TIM2 global interrupt.

Definition at line 261 of file stm32f7xx_it.c.

262{
263 /* USER CODE BEGIN TIM2_IRQn 0 */
264
265 /* USER CODE END TIM2_IRQn 0 */
266 HAL_TIM_IRQHandler(&htim2);
267 /* USER CODE BEGIN TIM2_IRQn 1 */
268
269 /* USER CODE END TIM2_IRQn 1 */
270}
TIM_HandleTypeDef htim2
Definition: main.c:82

◆ UsageFault_Handler()

void UsageFault_Handler ( void  )

This function handles Undefined instruction or illegal state.

Definition at line 144 of file stm32f7xx_it.c.

145{
146 /* USER CODE BEGIN UsageFault_IRQn 0 */
147
148 /* USER CODE END UsageFault_IRQn 0 */
149 while (1)
150 {
151 /* USER CODE BEGIN W1_UsageFault_IRQn 0 */
152 /* USER CODE END W1_UsageFault_IRQn 0 */
153 }
154}

Variable Documentation

◆ hcan1

CAN_HandleTypeDef hcan1
extern

Definition at line 67 of file main.c.

◆ hcan2

CAN_HandleTypeDef hcan2
extern

Definition at line 68 of file main.c.

◆ hcan3

CAN_HandleTypeDef hcan3
extern

Definition at line 69 of file main.c.

◆ hdma_adc1

DMA_HandleTypeDef hdma_adc1
extern

Definition at line 63 of file main.c.

◆ hdma_adc2

DMA_HandleTypeDef hdma_adc2
extern

Definition at line 69 of file AnalogSensor.h.

◆ hdma_adc3

DMA_HandleTypeDef hdma_adc3
extern

Definition at line 69 of file AnalogSensor.h.

◆ hdma_dac1

DMA_HandleTypeDef hdma_dac1
extern

Definition at line 72 of file main.c.

◆ hdma_dac2

DMA_HandleTypeDef hdma_dac2
extern

Definition at line 73 of file main.c.

◆ htim2

TIM_HandleTypeDef htim2
extern

Definition at line 82 of file main.c.

◆ RxData1

uint8_t RxData1[8]

Definition at line 50 of file stm32f7xx_it.c.

◆ RxData2

uint8_t RxData2[8]

Definition at line 51 of file stm32f7xx_it.c.

◆ RxHeader1

CAN_RxHeaderTypeDef RxHeader1

Definition at line 48 of file stm32f7xx_it.c.

◆ RxHeader2

CAN_RxHeaderTypeDef RxHeader2

Definition at line 49 of file stm32f7xx_it.c.

◆ timer_flag

volatile uint32_t timer_flag = 0

Definition at line 343 of file stm32f7xx_it.c.