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 "FreeRTOS.h"
#include "task.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 DebugMon_Handler (void)
 This function handles Debug monitor. 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 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
 
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 130 of file stm32f7xx_it.c.

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

◆ CAN1_RX0_IRQHandler()

void CAN1_RX0_IRQHandler ( void  )

This function handles CAN1 RX0 interrupts.

Definition at line 230 of file stm32f7xx_it.c.

231{
232 /* USER CODE BEGIN CAN1_RX0_IRQn 0 */
233
234 /* USER CODE END CAN1_RX0_IRQn 0 */
235 HAL_CAN_IRQHandler(&hcan1);
236 /* USER CODE BEGIN CAN1_RX0_IRQn 1 */
237
238 /* USER CODE END CAN1_RX0_IRQn 1 */
239}
CAN_HandleTypeDef hcan1
Definition: main.c:68

◆ CAN2_RX0_IRQHandler()

void CAN2_RX0_IRQHandler ( void  )

This function handles CAN2 RX0 interrupts.

Definition at line 300 of file stm32f7xx_it.c.

301{
302 /* USER CODE BEGIN CAN2_RX0_IRQn 0 */
303
304 /* USER CODE END CAN2_RX0_IRQn 0 */
305 HAL_CAN_IRQHandler(&hcan2);
306 /* USER CODE BEGIN CAN2_RX0_IRQn 1 */
307
308 /* USER CODE END CAN2_RX0_IRQn 1 */
309}
CAN_HandleTypeDef hcan2
Definition: main.c:69

◆ DebugMon_Handler()

void DebugMon_Handler ( void  )

This function handles Debug monitor.

Definition at line 160 of file stm32f7xx_it.c.

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

◆ DMA1_Stream5_IRQHandler()

void DMA1_Stream5_IRQHandler ( void  )

This function handles DMA1 stream5 global interrupt.

Definition at line 202 of file stm32f7xx_it.c.

203{
204 /* USER CODE BEGIN DMA1_Stream5_IRQn 0 */
205
206 /* USER CODE END DMA1_Stream5_IRQn 0 */
207 HAL_DMA_IRQHandler(&hdma_dac1);
208 /* USER CODE BEGIN DMA1_Stream5_IRQn 1 */
209
210 /* USER CODE END DMA1_Stream5_IRQn 1 */
211}
DMA_HandleTypeDef hdma_dac1
Definition: main.c:73

◆ DMA1_Stream6_IRQHandler()

void DMA1_Stream6_IRQHandler ( void  )

This function handles DMA1 stream6 global interrupt.

Definition at line 216 of file stm32f7xx_it.c.

217{
218 /* USER CODE BEGIN DMA1_Stream6_IRQn 0 */
219
220 /* USER CODE END DMA1_Stream6_IRQn 0 */
221 HAL_DMA_IRQHandler(&hdma_dac2);
222 /* USER CODE BEGIN DMA1_Stream6_IRQn 1 */
223
224 /* USER CODE END DMA1_Stream6_IRQn 1 */
225}
DMA_HandleTypeDef hdma_dac2
Definition: main.c:74

◆ DMA2_Stream0_IRQHandler()

void DMA2_Stream0_IRQHandler ( void  )

This function handles DMA2 stream0 global interrupt.

Definition at line 258 of file stm32f7xx_it.c.

259{
260 /* USER CODE BEGIN DMA2_Stream0_IRQn 0 */
261
262 /* USER CODE END DMA2_Stream0_IRQn 0 */
263 HAL_DMA_IRQHandler(&hdma_adc1);
264 /* USER CODE BEGIN DMA2_Stream0_IRQn 1 */
265
266 /* USER CODE END DMA2_Stream0_IRQn 1 */
267}
DMA_HandleTypeDef hdma_adc1
Definition: main.c:64

◆ DMA2_Stream1_IRQHandler()

void DMA2_Stream1_IRQHandler ( void  )

This function handles DMA2 stream1 global interrupt.

Definition at line 272 of file stm32f7xx_it.c.

273{
274 /* USER CODE BEGIN DMA2_Stream1_IRQn 0 */
275
276 /* USER CODE END DMA2_Stream1_IRQn 0 */
277 HAL_DMA_IRQHandler(&hdma_adc3);
278 /* USER CODE BEGIN DMA2_Stream1_IRQn 1 */
279
280 /* USER CODE END DMA2_Stream1_IRQn 1 */
281}
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 286 of file stm32f7xx_it.c.

287{
288 /* USER CODE BEGIN DMA2_Stream2_IRQn 0 */
289
290 /* USER CODE END DMA2_Stream2_IRQn 0 */
291 HAL_DMA_IRQHandler(&hdma_adc2);
292 /* USER CODE BEGIN DMA2_Stream2_IRQn 1 */
293
294 /* USER CODE END DMA2_Stream2_IRQn 1 */
295}
DMA_HandleTypeDef hdma_adc2
Definition: AnalogSensor.h:69

◆ HAL_ADC_ConvCpltCallback()

void HAL_ADC_ConvCpltCallback ( ADC_HandleTypeDef *  hadc)

Definition at line 389 of file stm32f7xx_it.c.

389 {
390 if (hadc == &hadc1) {
392 } else if (hadc == &hadc2) {
394 } else if (hadc == &hadc3) {
396 }
397}
ADC_HandleTypeDef hadc1
Definition: main.c:61
uint32_t adc3_buffer[8]
Definition: main.c:125
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:123
ADC_HandleTypeDef hadc3
Definition: AnalogSensor.h:68
ADC_HandleTypeDef hadc2
Definition: AnalogSensor.h:68
uint32_t adc2_buffer[7]
Definition: main.c:124
Here is the call graph for this function:

◆ HAL_CAN_RxFifo0MsgPendingCallback()

void HAL_CAN_RxFifo0MsgPendingCallback ( CAN_HandleTypeDef *  hcan)

Definition at line 377 of file stm32f7xx_it.c.

378{
379 if (hcan == &hcan1) {
380 HAL_CAN_GetRxMessage(hcan, CAN_RX_FIFO0, &RxHeader1, RxData1);
382 } else if (hcan == &hcan2) {
383 HAL_CAN_GetRxMessage(hcan, CAN_RX_FIFO0, &RxHeader2, RxData2);
385 }
386}
@ 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:52
uint8_t RxData2[8]
Definition: stm32f7xx_it.c:53
CAN_RxHeaderTypeDef RxHeader1
Definition: stm32f7xx_it.c:50
CAN_RxHeaderTypeDef RxHeader2
Definition: stm32f7xx_it.c:51
Here is the call graph for this function:

◆ HAL_TIM_PeriodElapsedCallback()

void HAL_TIM_PeriodElapsedCallback ( TIM_HandleTypeDef *  htim)

Definition at line 314 of file stm32f7xx_it.c.

315{
316 if (htim->Instance == TIM1)
317 {
318 timer_flag++;
319 } else if (htim->Instance == TIM2) {
320 // OUTPUTS
321 // D10
322 HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, digital_out_buffer[0]);
323 // D9
324 HAL_GPIO_WritePin(GPIOD, GPIO_PIN_15, digital_out_buffer[1]);
325 // D8
326 HAL_GPIO_WritePin(GPIOF, GPIO_PIN_12, digital_out_buffer[2]);
327 // D7
328 HAL_GPIO_WritePin(GPIOF, GPIO_PIN_13, digital_out_buffer[3]);
329 // D6
330 HAL_GPIO_WritePin(GPIOE, GPIO_PIN_9 , digital_out_buffer[4]);
331 // D5
332 HAL_GPIO_WritePin(GPIOE, GPIO_PIN_11, digital_out_buffer[5]);
333 // D4 for I2C
334 // HAL_GPIO_WritePin(GPIOF, GPIO_PIN_14, digital_out_buffer[6]);
335 // D3
336 HAL_GPIO_WritePin(GPIOE, GPIO_PIN_13, digital_out_buffer[6]);
337 // D2
338 // HAL_GPIO_WritePin(GPIOF, GPIO_PIN_15, digital_out_buffer[8]);
339 // D1
340 // HAL_GPIO_WritePin(GPIOG, GPIO_PIN_14, digital_out_buffer[9]);
341 // D0
342 HAL_GPIO_WritePin(GPIOG, GPIO_PIN_9, digital_out_buffer[7]);
343
344 // INPUTS
345 // D42
346 digital_in_buffer[0] = HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_8);
347 // D41
348 digital_in_buffer[1] = HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_7);
349 // D40
350 digital_in_buffer[2] = HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_10);
351 }
352}
uint8_t digital_out_buffer[NUM_DIGITAL_OUTPUTS]
Definition: main.c:128
uint8_t digital_in_buffer[NUM_DIGITAL_INPUTS]
Definition: main.c:129
volatile uint32_t timer_flag
Definition: stm32f7xx_it.c:312

◆ HardFault_Handler()

void HardFault_Handler ( void  )

This function handles Hard fault interrupt.

Definition at line 100 of file stm32f7xx_it.c.

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

◆ MemManage_Handler()

void MemManage_Handler ( void  )

This function handles Memory management fault.

Definition at line 115 of file stm32f7xx_it.c.

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

◆ NMI_Handler()

void NMI_Handler ( void  )

This function handles Non maskable interrupt.

Definition at line 85 of file stm32f7xx_it.c.

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

◆ send_CAN_message_helper()

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

Definition at line 355 of file stm32f7xx_it.c.

356{
357 uint32_t mailbox;
358 if (bus == CAN_1) {
359 if (HAL_CAN_AddTxMessage(&hcan1, TxHeader, data, &mailbox) != HAL_OK) {
360 uint32_t error = HAL_CAN_GetError(&hcan1);
361 printf("CAN1 Transmission Error: %lx\n", error);
362 return -1;
363 }
364 } else if (bus == CAN_2) {
365 if (HAL_CAN_AddTxMessage(&hcan2, TxHeader, data, &mailbox) != HAL_OK) {
366 uint32_t error = HAL_CAN_GetError(&hcan2);
367 printf("CAN2 Transmission Error: %lx\n", error);
368 return -1;
369 }
370 } else {
371 return -1;
372 }
373 return 0;
374}
Here is the caller graph for this function:

◆ SysTick_Handler()

void SysTick_Handler ( void  )

This function handles System tick timer.

Definition at line 173 of file stm32f7xx_it.c.

174{
175 /* USER CODE BEGIN SysTick_IRQn 0 */
176
177 /* USER CODE END SysTick_IRQn 0 */
178 HAL_IncTick();
179#if (INCLUDE_xTaskGetSchedulerState == 1 )
180 if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
181 {
182#endif /* INCLUDE_xTaskGetSchedulerState */
183 xPortSysTickHandler();
184#if (INCLUDE_xTaskGetSchedulerState == 1 )
185 }
186#endif /* INCLUDE_xTaskGetSchedulerState */
187 /* USER CODE BEGIN SysTick_IRQn 1 */
188
189 /* USER CODE END SysTick_IRQn 1 */
190}

◆ TIM2_IRQHandler()

void TIM2_IRQHandler ( void  )

This function handles TIM2 global interrupt.

Definition at line 244 of file stm32f7xx_it.c.

245{
246 /* USER CODE BEGIN TIM2_IRQn 0 */
247
248 /* USER CODE END TIM2_IRQn 0 */
249 HAL_TIM_IRQHandler(&htim2);
250 /* USER CODE BEGIN TIM2_IRQn 1 */
251
252 /* USER CODE END TIM2_IRQn 1 */
253}
TIM_HandleTypeDef htim2
Definition: main.c:83

◆ UsageFault_Handler()

void UsageFault_Handler ( void  )

This function handles Undefined instruction or illegal state.

Definition at line 145 of file stm32f7xx_it.c.

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

Variable Documentation

◆ hcan1

CAN_HandleTypeDef hcan1
extern

Definition at line 68 of file main.c.

◆ hcan2

CAN_HandleTypeDef hcan2
extern

Definition at line 69 of file main.c.

◆ hdma_adc1

DMA_HandleTypeDef hdma_adc1
extern

Definition at line 64 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 73 of file main.c.

◆ hdma_dac2

DMA_HandleTypeDef hdma_dac2
extern

Definition at line 74 of file main.c.

◆ htim2

TIM_HandleTypeDef htim2
extern

Definition at line 83 of file main.c.

◆ RxData1

uint8_t RxData1[8]

Definition at line 52 of file stm32f7xx_it.c.

◆ RxData2

uint8_t RxData2[8]

Definition at line 53 of file stm32f7xx_it.c.

◆ RxHeader1

CAN_RxHeaderTypeDef RxHeader1

Definition at line 50 of file stm32f7xx_it.c.

◆ RxHeader2

CAN_RxHeaderTypeDef RxHeader2

Definition at line 51 of file stm32f7xx_it.c.

◆ timer_flag

volatile uint32_t timer_flag = 0

Definition at line 312 of file stm32f7xx_it.c.