2021-06-03 15:12:34 +02:00
|
|
|
#include "interrupts.h"
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
2021-06-03 16:11:49 +02:00
|
|
|
void (*spi1_user_handler) (void* args) = NULL;
|
|
|
|
void * spi1_user_args = NULL;
|
|
|
|
|
|
|
|
void (*spi2_user_handler) (void* args) = NULL;
|
|
|
|
void * spi2_user_args = NULL;
|
2021-06-03 15:12:34 +02:00
|
|
|
|
2021-06-03 16:11:49 +02:00
|
|
|
void assign_spi_user_handler(SpiBus spi_idx, user_handler_t user_handler, user_args_t user_args) {
|
|
|
|
if(spi_idx == SPI_1) {
|
|
|
|
spi1_user_handler = user_handler;
|
|
|
|
spi1_user_args = user_args;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
spi2_user_handler = user_handler;
|
|
|
|
spi2_user_args = user_args;
|
|
|
|
}
|
2021-06-03 15:12:34 +02:00
|
|
|
}
|
|
|
|
|
2021-06-03 16:11:49 +02:00
|
|
|
/* Do not change these function names! They need to be exactly equal to the name of the functions
|
|
|
|
defined in the startup_stm32h743xx.s files! */
|
2021-06-03 15:12:34 +02:00
|
|
|
|
2021-06-03 16:11:49 +02:00
|
|
|
void SPI1_IRQHandler() {
|
|
|
|
if(spi1_user_handler != NULL) {
|
|
|
|
spi1_user_handler(spi1_user_args);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Default_Handler();
|
2021-06-03 15:12:34 +02:00
|
|
|
}
|
|
|
|
|
2021-06-03 16:11:49 +02:00
|
|
|
void SPI2_IRQHandler() {
|
|
|
|
if(spi2_user_handler != NULL) {
|
|
|
|
spi2_user_handler(spi2_user_args);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Default_Handler();
|
|
|
|
}
|